1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,20565,e=>{"use strict";var t,n=e.i(8487),i=e.i(75),r=e.i(4570),s=e.i(71645),o=(0,s.createContext)({get client(){return t},bootstrap:void 0}),a=function(e){return"function"==typeof e},u=function(e,t){return(u=Object.setPrototypeOf||(0,n._)({__proto__:[]},Array)&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var l={componentStack:null,exceptionEvent:null,error:null};!function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}function n(t){var n=e.call(this,t)||this;return n.state=l,n}u(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),n.prototype.componentDidCatch=function(e,t){var n,r=this.props.additionalProperties;a(r)?n=r(e):(void 0===r?"undefined":(0,i._)(r))==="object"&&(n=r);var s=this.context.client.captureException(e,n),o=t.componentStack;this.setState({error:e,componentStack:null!=o?o:null,exceptionEvent:s})},n.prototype.render=function(){var e=this.props,t=e.children,n=e.fallback,i=this.state;if(null==i.componentStack)return a(t)?t():t;var r=a(n)?s.default.createElement(n,{error:i.error,componentStack:i.componentStack,exceptionEvent:i.exceptionEvent}):n;return s.default.isValidElement(r)?r:(console.warn("[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."),s.default.createElement(s.default.Fragment,null))},n.contextType=o}(s.default.Component),t=r.default,e.s(["useFeatureFlagVariantKey",0,function(e){var t,n=(0,s.useContext)(o),i=n.client,r=n.bootstrap,a=(0,s.useState)(function(){return i.getFeatureFlag(e)}),u=a[0],l=a[1];return((0,s.useEffect)(function(){return i.onFeatureFlags(function(){l(i.getFeatureFlag(e))})},[i,e]),!(null==(t=null==i?void 0:i.featureFlags)?void 0:t.hasLoadedFlags)&&(null==r?void 0:r.featureFlags))?r.featureFlags[e]:u}])},44738,4570,91098,e=>{"use strict";var t,n,i,r,s=e.i(71645),o=e.i(50601),a=e.i(38981),u=e.i(92955),l=e.i(80646),c=e.i(99749),h=e.i(64217),f=e.i(8487),d=e.i(40316),v=e.i(75),p=e.i(13935),g="u">typeof window?window:void 0,_="u">typeof globalThis?globalThis:g,y=null==_?void 0:_.navigator,m=null==_?void 0:_.document,k=null==_?void 0:_.location,b=null==_?void 0:_.fetch,w=null!=_&&_.XMLHttpRequest&&"withCredentials"in new _.XMLHttpRequest?_.XMLHttpRequest:void 0,x=null==_?void 0:_.AbortController,E=null==_?void 0:_.CompressionStream,S=null==y?void 0:y.userAgent;function P(){return!(!g||!1===g.navigator.onLine)}var F="u">typeof globalThis?globalThis:g;F&&"u"<typeof self&&(F.self=F),F&&"u"<typeof File&&(F.File=function(){});var $=null!=g?g:{},I={DEBUG:!1,LIB_VERSION:"0.5.0",LIB_NAME:"browser-common"};function R(e,t,n,i,r,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(i,r)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){R(s,i,r,o,a,"next",e)}function a(e){R(s,i,r,o,a,"throw",e)}o(void 0)})}}function C(){return(C=Object.assign.bind()).apply(null,arguments)}function O(e,t){if(null==e)return{};var n={};for(var i in e)if(({}).hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}var T=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function N(e){return"string"==typeof e||e}function A(e){return"string"==typeof e?e:void 0}var L,D,j,q,H=["$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"],B=((L={}).AnonymousId="anonymous_id",L.DistinctId="distinct_id",L.Props="props",L.EnablePersonProcessing="enable_person_processing",L.PersonMode="person_mode",L.FeatureFlagDetails="feature_flag_details",L.FeatureFlags="feature_flags",L.FeatureFlagPayloads="feature_flag_payloads",L.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",L.BootstrapFeatureFlags="bootstrap_feature_flags",L.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",L.OverrideFeatureFlags="override_feature_flags",L.Queue="queue",L.AiQueue="ai_queue",L.LogsQueue="logs_queue",L.OptedOut="opted_out",L.SessionId="session_id",L.SessionStartTimestamp="session_start_timestamp",L.SessionLastTimestamp="session_timestamp",L.PersonProperties="person_properties",L.GroupProperties="group_properties",L.InstalledAppBuild="installed_app_build",L.InstalledAppVersion="installed_app_version",L.SessionReplay="session_replay",L.PushRegistered="push_registered",L.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",L.SurveyLastSeenDate="survey_last_seen_date",L.SurveysSeen="surveys_seen",L.Surveys="surveys",L.RemoteConfig="remote_config",L.FlagsEndpointWasHit="flags_endpoint_was_hit",L.DeviceId="device_id",L),z=((D={}).GZipJS="gzip-js",D.Base64="base64",D),U=["$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"],V=["token"],W="NativeGzipValidationError",G
1=function(e){return e.length>=2&&31===e[0]&&139===e[1]},J=function(e,t){return e===z.GZipJS||t===z.GZipJS||"gzip"===t},K=function(e){return!(!e||"object"!=(void 0===e?"undefined":(0,v._)(e)))&&"NotReadableError"===("name"in e?String(e.name):"")},Y=function(e){var t=Error("Native gzip produced invalid output: "+e);throw t.name=W,t},Q=(j=M(function(e,t){var n,i,r,s,o;return(0,p._)(this,function(a){switch(a.label){case 0:return 18>e.size&&Y("too-short"),i=Uint8Array.bind,[4,e.slice(0,10).arrayBuffer()];case 1:return G(n=new(i.apply(Uint8Array,[void 0,a.sent()])))&&8===n[2]||Y("invalid-header"),s=DataView.bind,[4,e.slice(e.size-8).arrayBuffer()];case 2:return(r=new(s.apply(DataView,[void 0,a.sent()]))).getUint32(0,!0)!==function(e){for(var t=function(){if(q)return q;q=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?0xedb88320^t>>>1:t>>>1;q[e]=t>>>0}return q}(),n=0xffffffff,i=0;e.length>i;i++)n=t[255&(n^e[i])]^n>>>8;return(0xffffffff^n)>>>0}(t)&&Y("invalid-crc"),o=t.length>>>0,r.getUint32(4,!0)!==o&&Y("invalid-size"),[2]}})}),function(e,t){return j.apply(this,arguments)});function X(){return(X=M(function(e,t,n){var i,r,s,o,a,u;return(0,p._)(this,function(l){switch(l.label){case 0:void 0===t&&(t=!0),l.label=1;case 1:var c;return l.trys.push([1,4,,5]),i=(new TextEncoder).encode(e),o=(s=(r=new globalThis.CompressionStream("gzip")).writable.getWriter()).write(i).then(function(){return s.close()}).catch((c=M(function(e){return(0,p._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,s.abort(e)];case 1:case 2:return t.sent(),[3,3];case 3:throw e}})}),function(e){return c.apply(this,arguments)})),[4,Promise.all([new Response(r.readable).blob(),o])];case 2:return[4,Q(a=l.sent()[0],i)];case 3:return[2,(l.sent(),a)];case 4:if(u=l.sent(),null!=n&&n.rethrow)throw u;return[2,(t&&console.error("Failed to gzip compress data",u),null)];case 5:return[2]}})})).apply(this,arguments)}var Z=["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"],ee=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var n=e.toLowerCase();return Z.concat(t).some(function(e){var t=e.toLowerCase();return -1!==n.indexOf(t)})};function et(e,t){return -1!==e.indexOf(t)}var en=function(e){return e.trim()},ei=function(e){return e.replace(/^\$/,"")};function er(e){var t,n=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==(void 0===t?"undefined":(0,v._)(t)))return t.toString();if("function"!=typeof t&&"symbol"!=(void 0===t?"undefined":(0,v._)(t))){if((0,f._)(t,Error))return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==(void 0===t?"undefined":(0,v._)(t))){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(t))return"[Circular]";n.push(t)}return t}}))?t:"null"}var es=Object.prototype,eo=es.hasOwnProperty,ea=es.toString,eu=Array.isArray||function(e){return"[object Array]"===ea.call(e)},el=function(e){return"function"==typeof e},ec=function(e){return e===Object(e)&&!eu(e)},eh=function(e){if(ec(e)){for(var t in e)if(eo.call(e,t))return!1;return!0}return!1},ef=function(e){return void 0===e},ed=function(e){return"[object String]"==ea.call(e)},ev=function(e){return ed(e)&&0===e.trim().length},ep=function(e){return null===e},eg=function(e){return ef(e)||ep(e)},e_=function(e){return"[object Number]"==ea.call(e)&&e==e},ey=function(e){return e_(e)&&e>0},em=function(e){return"[object Boolean]"===ea.call(e)},ek=function(e){return et(V,e)};function eb(e){return null===e||"object"!=(void 0===e?"undefined":(0,v._)(e))}function ew(e,t){return({}).toString.call(e)==="[object "+t+"]"}function ex(e){return"u">typeof Event&&eE(e,Event)}function eE(e,t){try{return(0,f._)(e,t)}catch(e){return!1}}var eS=[!0,"true",1,"1","yes"],eP=function(e){return et(eS,e)},eF=[!1,"false",0,"0","no"];function e$(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),e_(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),e$(r||n,t,n,i))}
1var eI=function(){function e(t){(0,u._)(this,e),this.tt={},this.et=t.et,this.it=e$(t.bucketSize,0,100,t.rt),this.nt=e$(t.refillRate,0,this.it,t.rt),this.st=e$(t.refillInterval,0,864e5,t.rt)}return(0,l._)(e,[{key:"ot",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.st);n>0&&(e.tokens=Math.min(e.tokens+n*this.nt,this.it),e.lastAccess=e.lastAccess+n*this.st)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.tt[i];return r?this.ot(r,n):this.tt[i]=r={tokens:this.it,lastAccess:n},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.et)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.tt={}}}]),e}(),eR="Mobile",eM="Android",eC="Tablet",eO=eM+" "+eC,eT="iPad",eN="Apple",eA=eN+" Watch",eL="Safari",eD="BlackBerry",ej="Samsung",eq=ej+"Browser",eH=ej+" Internet",eB="Chrome",ez=eB+" OS",eU=eB+" iOS",eV="Internet Explorer",eW=eV+" "+eR,eG="Opera",eJ=eG+" Mini",eK="Edge",eY="Microsoft "+eK,eQ="Firefox",eX=eQ+" iOS",eZ="Nintendo",e0="PlayStation",e1="Xbox",e2=eM+" "+eR,e3=eR+" "+eL,e5="Windows",e4=e5+" Phone",e8="Nokia",e6="Ouya",e7="Generic",e9=e7+" "+eR.toLowerCase(),te=e7+" "+eC.toLowerCase(),tt="Konqueror",tn="Oculus Browser",ti="Vivaldi",tr="Yandex",ts="Whale",to="DuckDuckGo",ta="Pale Moon",tu="Waterfox",tl="Brave",tc="Google Search App",th="(\\d+(\\.\\d+)?)",tf=RegExp("Version/"+th),td=RegExp(e1,"i"),tv=RegExp(e0+" \\w+","i"),tp=RegExp(eZ+" \\w+","i"),tg=RegExp(eD+"|PlayBook|BB10","i"),t_={"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"},ty=function(e,t,n,i){var r;return t=t||"",(null!=n&&n.brave?tl:null)||(null!=i&&i.detectGoogleSearchApp&&et(e,"GSA/")?tc:et(e," OPR/")&&et(e,"Mini")?eJ:et(e," OPR/")?eG:tg.test(e)?eD:et(e,"IE"+eR)||et(e,"WPDesktop")?eW:et(e,"OculusBrowser")?tn:et(e,eq)?eH:et(e,eK)||et(e,"Edg/")?eY:et(e,ti+"/")?ti:et(e,"YaBrowser/")?tr:et(e,ts+"/")?ts:et(e,to+"/")||et(e,"Ddg/")?to:et(e,"FBIOS")?"Facebook "+eR:et(e,"UCWEB")||et(e,"UCBrowser")?"UC Browser":et(e,"CriOS")?eU:et(e,"CrMo")||et(e,eB)?eB:et(e,eM)&&et(e,eL)?e2:et(e,"FxiOS")?eX:et(e.toLowerCase(),tt.toLowerCase())?tt:et(e,tl+"/")?tl:(r=t)&&et(r,eN)||et(e,eL)&&!et(e,eB)&&!et(e,eM)?et(e,eR)?e3:eL:et(e,"PaleMoon/")?ta:et(e,tu+"/")?tu:et(e,eQ)?eQ:et(e,"MSIE")||et(e,"Trident/")?eV:et(e,"Gecko")?eQ:"")},tm=(iE={},(0,c._)(iE,eW,[RegExp("rv:"+th)]),(0,c._)(iE,eY,[RegExp(eK+"?\\/"+th)]),(0,c._)(iE,eB,[RegExp("("+eB+"|CrMo)\\/"+th)]),(0,c._)(iE,eU,[RegExp("CriOS\\/"+th)]),(0,c._)(iE,"UC Browser",[RegExp("(UCBrowser|UCWEB)\\/"+th)]),(0,c._)(iE,eL,[tf]),(0,c._)(iE,e3,[tf]),(0,c._)(iE,eG,[RegExp("(Opera|OPR)\\/"+th)]),(0,c._)(iE,eQ,[RegExp(eQ+"\\/"+th)]),(0,c._)(iE,eX,[RegExp("FxiOS\\/"+th)]),(0,c._)(iE,tt,[RegExp("Konqueror[:/]?"+th,"i")]),(0,c._)(iE,eD,[RegExp(eD+" "+th),tf]),(0,c._)(iE,e2,[RegExp("android\\s"+th,"i")]),(0,c._)(iE,eH,[RegExp(eq+"\\/"+th)]),(0,c._)(iE,tn,[RegExp("OculusBrowser\\/"+th)]),(0,c._)(iE,ti,[RegExp(ti+"\\/"+th)]),(0,c._)(iE,tr,[RegExp("YaBrowser\\/"+th)]),(0,c._)(iE,ts,[RegExp(ts+"\\/"+th)]),(0,c._)(iE,tl,[RegExp(tl+"\\/"+th)]),(0,c._)(iE,to,[RegExp("(DuckDuckGo|Ddg)\\/"+th)]),(0,c._)(iE,ta,[RegExp("PaleMoon\\/"+th)]),(0,c._)(iE,tu,[RegExp(tu+"\\/"+th)]),(0,c._)(iE,tc,[RegExp("GSA\\/"+th)]),(0,c._)(iE,eV,[RegExp("(rv:|MSIE )"+th)]),(0,c._)(iE,"Mozilla",[RegExp("rv:"+th)]),iE),tk=function(e,t,n,i){var r=tm[ty(e,t,n,i)];if(ef(r))return null;for(var s=0;r.length>s;s++){var o=e.match(r[s]);if(o)return parseFloat(o[o.length-2])}return null},tb=[[RegExp(e1+"; "+e1+" (.*?)[);]","i"),function(e){return[e1,e&&e[1]||""]}],[RegExp(eZ,"i"),[eZ,""]],[RegExp(e0,"i"),[e0,""]],[tg,[eD,""]],[RegExp(e5,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[e4,""];if(new RegExp(eR).test(t)&&!/IEMobile\b/.test(t))return[e5+" "+eR,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=t_[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[e5,i]}return[e5,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=ef(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+eM+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+eM+")","i"),function(e){return e&&e[2]?[eM,[e[2],e[3],e[4]||"0"].join(".")]:[eM,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ez,""]],[/Linux|debian/i,["Linux",""]]],tw=function(e){return tp.test(e)?eZ:tv.test(e)?e0:td.test(e)?e1:RegExp(e6,"i").test(e)?e6:RegExp("("+e4+"|WPDesktop)","i").test(e)?e4:/iPad/.test(e)?eT:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?eA:tg.test(e)?eD:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(e8,"i").test(e)?e8:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(eR).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?eM:eO:RegExp("(pda|"+eR+")","i").test(e)?e9:RegExp(eC,"i").test(e)&&!RegExp(eC+" pc","i").test(e)?te:""},tx=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tE(e,t){return"string"==typeof e&&tx.test(e)?e:t()}function tS(e){return e?e.split("#")[0]:e}function tP(e,t){var n=setTimeout(e,t);return(null==n?void 0:n.unref)&&(null==n||n.unref()),n}function tF(e,t,n){return t$.apply(this,arguments)}function t$(){return(t$=M(function(e,t,n){var i;return(0,p._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,,2,3]),[4,Promise.race([e,new Promise(function(e,r){i=tP(function(){try{null==n||n(),e()}catch(e){r(e)}},t)})])];case 1:return[2,r.sent()];case 2:return clearTimeout(i),[7];case 3:return[2]}})})).apply(this,arguments)}var tI={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}},tR=tI.info;function tM(e){var t=[];for(var n in e){var i=e[n];ep(i)||ef(i)||t.push({key:n,value:function e(t){if(em(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(eu(t))return{arrayValue:{values:t.map(function(t){return e(t)})}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(i)})}return t}
1function tC(e,t,n){return C({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":n})}function tO(e,t,n,i){return{resourceLogs:[{resource:{attributes:tM(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var tT=function(){function e(t,n,i,r,s,o,a){var l;(0,u._)(this,e),void 0===o&&(o=function(){return Promise.resolve()}),this._instance=t,this.Ne=n,this.rt=i,this.ut=r,this.ht=s,this.dt=o,this.vt=a,this.ct=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.kt=n.maxBufferSize,this.xt=Math.max(null!=(l=n.maxQueueSize)?l:n.maxBufferSize,n.maxBufferSize),this.St=n.flushIntervalMs,this.Ct=n.maxBatchRecordsPerPost,this.Mt=n.rateCapWindowMs,this.Tt=n.maxLogsPerInterval}return(0,l._)(e,[{key:"reset",value:function(){this.Et(),this.ct=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ne.maxBatchRecordsPerPost}},{key:"onReconnect",value:function(){this.yt=0,this.It()}},{key:"captureLog",value:function(e){var t=this;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var n=this.Pt(e);if(null!==n)if(n.body){if(this.Rt()){var i,r,s,o,a,u,l,c,h={record:(i=this.ut(),s=(r=tI[n.level||"info"]||tR).text,o=r.number,a=String(Date.now())+"000000",u={},i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),eg(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),eg(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags),l=C({},u,n.attributes||{}),c={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:s,body:{stringValue:n.body},attributes:tM(l)},n.trace_id&&(c.traceId=n.trace_id),n.span_id&&(c.spanId=n.span_id),ef(n.trace_flags)||(c.flags=n.trace_flags),c)};this.ht(function(){return t.At(h)})}}else this.rt.info("Log was rejected in beforeSend function")}}},{key:"Pt",value:function(e){var t=this.Ne.beforeSend;if(!t)return e;var n=eu(t)?t:[t],i=e,r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;try{var c=l(i);if(!c)return this.rt.info("Log was rejected in beforeSend function"),null;i=c}catch(e){return this.rt.error("Error in beforeSend function for log:",e),null}}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}},{key:"Rt",value:function(){if(void 0===this.Tt)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.rt.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}},{key:"flush",value:function(){var e=this;return M(function(){return(0,p._)(this,function(t){return e._instance.isDisabled?[2]:[2,(e.ct||(e.ct=e.Ft().finally(function(){e.ct=null})),e.ct)]})})()}},{key:"Ft",value:function(){var e=this;return M(function(){var t,n,i,r,s,o,a,u,l,c;return(0,p._)(this,function(h){switch(h.label){case 0:if(e.Et(),0===(n=null!=(t=e._instance.getPersistedProperty(B.LogsQueue))?t:[]).length)return[3,6];i=n.length,r=0,h.label=1;case 1:if(!(n.length>0&&i>r))return[3,6];return e.ft=0,a=Math.min(n.length,e.Ct),l=tO((u=n.slice(0,a)).map(function(e){return e.record}),e.Lt(),null!=(s=e.vt)?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),[4,e._instance.Ot(l)];case 2:if(!("too-large"===(c=h.sent()).kind&&u.length>1))return[3,3];return e.Ct=Math.max(1,Math.floor(u.length/2)),e.rt.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e.Ct),[3,5];case 3:if("retry-later"===c.kind)throw c.error;return"too-large"===c.kind?e.rt.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"===c.kind&&e.Ne.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Ne.maxBatchRecordsPerPost,e.Ct+1)),[4,e.Dt(u.length)];case 4:if(h.sent(),n=null!=(o=e._instance.getPersistedProperty(B.LogsQueue))?o:[],r+=u.length,"fatal"===c.kind)throw c.error;h.label=5;case 5:return[3,1];case 6:return[2]}})})()}},{key:"Dt",value:function(e){var t=this;return M(function(){var n,i,r;return(0,p._)(this,function(s){switch(s.label){case 0:return i=Math.max(0,e-t.ft),r=null!=(n=t._instance.getPersistedProperty(B.LogsQueue))?n:[],t._instance.setPersistedProperty(B.LogsQueue,r.slice(i)),[4,t.dt(
1)];case 1:return s.sent(),[2]}})})()}},{key:"Lt",value:function(){return tC(this.Ne,this._instance.getLibraryId(),this._instance.getLibraryVersion())}},{key:"At",value:function(e){var t;if(!this._instance.optedOut){var n=null!=(t=this._instance.getPersistedProperty(B.LogsQueue))?t:[];this.xt>n.length||(n.shift(),this.ft++,this.rt.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(B.LogsQueue,n),this.kt>n.length?this.$t():this.It()}}},{key:"$t",value:function(e){var t=this;void 0===e&&(e=this.St),this.Nt||(this.Nt=tP(function(){t.Nt=void 0,t.It()},e))}},{key:"qt",value:function(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}},{key:"jt",value:function(){var e=this._instance.getPersistedProperty(B.LogsQueue);return!!e&&e.length>0}},{key:"shutdown",value:function(e){var t=this;return M(function(){var n;return(0,p._)(this,function(i){switch(i.label){case 0:if(t.Et(),n=t.flush().catch(function(){}),void 0===e)return[3,2];return[4,tF(n,e)];case 1:return i.sent(),[3,4];case 2:return[4,n];case 3:i.sent(),i.label=4;case 4:return[2]}})})()}},{key:"flushWithTimeout",value:function(e){var t=this;return M(function(){var n;return(0,p._)(this,function(i){switch(i.label){case 0:return[4,tF(n=t.flush(),e,function(){n.catch(function(){})})];case 1:return i.sent(),[2]}})})()}},{key:"It",value:function(){var e=this;this.flush().then(function(){e.yt=0},function(t){e.yt++,e.rt.error("PostHog logs flush failed:",t)}).finally(function(){!e._instance.isDisabled&&e.jt()&&e.$t(e.qt())})}},{key:"Et",value:function(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}}]),e}(),tN=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function tA(e){return String(e)+"000000"}function tL(e,t,n,i){var r="";return i&&(r=Object.keys(i).sort().map(function(e){return JSON.stringify(e)+":"+JSON.stringify(i[e])}).join(",")),e+"\0"+t+"\0"+(null!=n?n:"")+"\0"+r}var tD=function(){function e(t,n,i){(0,u._)(this,e),this._instance=t,this.Ne=n,this.rt=i,this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Wt=0}return(0,l._)(e,[{key:"count",value:function(e,t,n){void 0===t&&(t=1),this.Vt({name:e,type:"count",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"gauge",value:function(e,t,n){this.Vt({name:e,type:"gauge",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"histogram",value:function(e,t,n){this.Vt({name:e,type:"histogram",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"flush",value:function(){var e,t=this,n=this,i=this.ct,r=(e=M(function(){return(0,p._)(this,function(e){switch(e.label){case 0:if(!i)return[3,2];return[4,i.catch(function(){})];case 1:e.sent(),e.label=2;case 2:return[4,n.Zt()];case 3:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().finally(function(){t.ct===r&&(t.ct=null)});return this.ct=r,r}},{key:"drainWindow",value:function(){if(0===this.Bt.size)return null;var e=this.Bt;return this.Bt=new Map,this.Ht=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}},{key:"reset",value:function(){this.Wt++,this.Et(),this.Bt=new Map,this.ct=null,this.Ht=!1,this.Ut=new Map,this.zt=new Set}},{key:"Vt",value:function(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Pt(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this.rt.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{try{n=t.attributes?C({},t.attributes):void 0,i=tL(t.type,t.name,t.unit,n)}catch(e){return void this.rt.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var n,i,r=this.Bt.get(i);if(!r){if(!this.Qt())return;r={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Bt.set(i,r)}var s=this.Ut.get(t.name);void 0===s?this.Ut.set(t.name,t.type):s===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.rt.warn("Metric name '"+t.name+"' is already used as a "+s+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Kt(r,t.value),this.$t()}else this.rt.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.rt.warn("Dropping metric with empty name")}}},{key:"Qt",value:function(){return this.Ne.maxSeriesPerFlush>this.Bt.size||(this.Ht||(this.Ht=!0,this.rt.warn("Metric series cap reached ("+this.Ne.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}},{key:"Kt",value:function(e,t){var n;switch(e.type){case"count":e.total=(null!=(n=e.total)?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(tN.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}
1(t,tN)]+=1}}},{key:"Pt",value:function(e){var t=this.Ne.beforeSend;if(!t)return e;var n=eu(t)?t:[t],i=e,r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;try{var c=l(i);if(!c)return this.rt.info("Metric was rejected in beforeSend function"),null;i=c}catch(e){return this.rt.error("Error in beforeSend function for metric:",e),null}}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}},{key:"$t",value:function(){var e=this;this.Nt||(this.Nt=tP(function(){e.Nt=void 0,e.flush().catch(function(t){e.rt.error("Metrics flush failed:",t)})},this.Ne.flushIntervalMs))}},{key:"Et",value:function(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}},{key:"Zt",value:function(){var e=this;return M(function(){var t,n,i;return(0,p._)(this,function(r){switch(r.label){case 0:if(0===e.Bt.size)return[3,2];return t=e.Bt,e.Bt=new Map,e.Ht=!1,e.Ut=new Map,e.zt=new Set,n=e.Wt,[4,e._instance.Jt(e.Gt(t))];case 1:if(i=r.sent(),n===e.Wt)switch(i.kind){case"ok":return[2];case"retry-later":return[2,(e.Yt(t),void e.$t())];case"too-large":return[2,void e.rt.warn("Metrics batch exceeded the server size limit and was dropped")];case"fatal":return[2,void e.rt.error("Failed to send metrics batch:",i.error)]}r.label=2;case 2:return[2]}})})()}},{key:"Gt",value:function(e){var t,n,i,r,s,o,a;return t=this.Xt(e),s=this.Ne,o=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),n=C({},s.resourceAttributes,{"service.name":s.serviceName||"unknown_service"},s.environment&&{"deployment.environment":s.environment},s.serviceVersion&&{"service.version":s.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a}),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tM(n)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]}}},{key:"Xt",value:function(e){var t=tA(Date.now()),n=new Map,i=!0,r=!1,s=void 0;try{for(var o,a=e.values()[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u,l=o.value,c=tL(l.type,l.name,l.unit,void 0),h=n.get(c);h||(h=C({name:l.name},l.unit&&{unit:l.unit}),"count"===l.type?h.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===l.type?h.gauge={dataPoints:[]}:h.histogram={aggregationTemporality:1,dataPoints:[]},n.set(c,h));var f=tM(null!=(u=l.attributes)?u:{}),d=tA(l.windowStartMs);if("count"===l.type){var v,p={attributes:f,startTimeUnixNano:d,timeUnixNano:t,asDouble:null!=(v=l.total)?v:0};h.sum.dataPoints.push(p)}else if("gauge"===l.type){var g,_={attributes:f,timeUnixNano:t,asDouble:null!=(g=l.last)?g:0};h.gauge.dataPoints.push(_)}else l.hist&&h.histogram.dataPoints.push({attributes:f,startTimeUnixNano:d,timeUnixNano:t,count:l.hist.count,sum:l.hist.sum,min:l.hist.min,max:l.hist.max,bucketCounts:l.hist.bucketCounts,explicitBounds:tN})}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return Array.from(n.values())}},{key:"Yt",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s,o,a=e[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var u=o.value,l=u[0],c=u[1],h=this.Bt.get(l);if(h)switch(h.windowStartMs=Math.min(h.windowStartMs,c.windowStartMs),h.type){case"count":h.total=(null!=(r=h.total)?r:0)+(null!=(s=c.total)?s:0);break;case"gauge":break;case"histogram":if(c.hist)if(h.hist){h.hist.count+=c.hist.count,h.hist.sum+=c.hist.sum,h.hist.min=Math.min(h.hist.min,c.hist.min),h.hist.max=Math.max(h.hist.max,c.hist.max);for(var f=0;h.hist.bucketCounts.length>f;f++)h.hist.bucketCounts[f]+=c.hist.bucketCounts[f]}else h.hist=c.hist}else this.Qt()&&this.Bt.set(l,c)}}catch(e){n=!0,i=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw i}}}}]),e}(),tj=function(){function e(t,n,i){(0,u._)(this,e),void 0===i&&(i=[]),this.coercers=t,this.stackParser=n,this.modifiers=i}return(0,l._)(e,[{key:"buildFromUnknown",value:function(e,t){void 0===t&&(t={});var n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),r=this.buildParsingContext(t),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,n),$exception_level:"error"}}},{key:"modifyFrames",value:function(e){var t=this;return M(function(){var n,i,r,s,o,a,u,l;return(0,p._)(this,function(c){switch(c.label){case 0:n=!0,i=!1,r=void 0,c.label=1;case 1:c.trys.push([1,7,8,9]),s=e[Symbol.iterator](),c.label=2;case 2:if(n=(o=s.next()).done)return[3,6];if(!((a=o.value).stacktrace&&a.stacktrace.frames&&eu(a.stacktrace.frames)))return[3,4];return u=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)];case 3:u.frames=c.sent(),c.label=4;case 4:c.label=5;case 5:return n=!0,[3,2];case 6:return[3,9];case 7:return l=c.sent(),i=!0,r=l,[3,9];case 8:try{n||null==s.return||s.return()}finally{if(i)throw r}
1return[7];case 9:return[2,e]}})})()}},{key:"coerceFallback",value:function(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}},{key:"parseStacktrace",value:function(e,t){var n,i;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),C({},e,{cause:n,stack:i})}},{key:"applyChunkIds",value:function(e,t){return e.map(function(e){return e.filename&&t&&(e.chunk_id=t[e.filename]),e})}},{key:"applyCoercers",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=this.coercers[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(a.match(e))return a.coerce(e,t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return this.coerceFallback(t)}},{key:"applyModifiers",value:function(e){var t=this;return M(function(){var n,i,r,s,o,a,u;return(0,p._)(this,function(l){switch(l.label){case 0:n=e,i=!0,r=!1,s=void 0,l.label=1;case 1:l.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),l.label=2;case 2:if(i=(a=o.next()).done)return[3,5];return[4,(0,a.value)(n)];case 3:n=l.sent(),l.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=l.sent(),r=!0,s=u,[3,8];case 7:try{i||null==o.return||o.return()}finally{if(r)throw s}return[7];case 8:return[2,n]}})})()}},{key:"convertToExceptionList",value:function(e,t){var n,i,r,s={type:e.type,value:e.value,mechanism:{type:null!=(n=t.type)?n:"generic",handled:null==(i=t.handled)||i,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push.apply(o,(0,d._)(this.convertToExceptionList(e.cause,C({},t,{handled:!0})))),o}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return iF&&n.length===iP||(iP=n.length,iF=n.reduce(function(n,i){iS||(iS={});var r=iS[i];if(r)n[r[0]]=r[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],u=null==a?void 0:a.filename,l=t[i];if(u&&l){n[u]=l,iS[i]=[u,l];break}}return n},{})),iF}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}},{key:"buildCoercingContext",value:function(e,t,n){var i=this;void 0===n&&(n=0);var r=function(n,r){if(4>=r){var s=i.buildCoercingContext(e,t,r);return i.applyCoercers(n,s)}};return C({},t,{syntheticException:0==n?t.syntheticException:void 0,mechanism:e,apply:function(e){return r(e,n)},next:function(e){return r(e,n+1)}})}}]),e}();function tq(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?"?":n,in_app:!0};return ef(i)||(s.lineno=i),ef(r)||(s.colno=r),s}var tH=function(e,t){var n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tB=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tz=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tU=/\((\S*)(?::(\d+))(?::(\d+))\)/,tV=function(e,t){var n=tB.exec(e);if(n)return tq(t,n[1],"?",+n[2],+n[3]);var i=tz.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var r=tU.exec(i[2]);r&&(i[2]=r[1],i[3]=r[2],i[4]=r[3])}var s=tH(i[1]||"?",i[2]);return tq(t,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},tW=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tG=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tJ=function(e,t){var n=tW.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=tG.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var r=n[3],s=n[1]||"?",o=tH(s,r);return tq(t,r=o[1],s=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},tK=/\(error: (.*)\)/,tY=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return this.isDOMException(e)||this.isDOMError(e)}},{key:"coerce",value:function(e,t){var n=ed(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return this.isDOMError(e)?"DOMError":"DOMException"}},{key:"getValue",value:function(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}},{key:"isDOMException",value:function(e){return ew(e,"DOMException")}},{key:"isDOMError",value:function(e){return ew(e,"DOMError")}}]),e}(),tQ=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){switch(({}
1).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return eE(e,Error)}}},{key:"coerce",value:function(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return e.name||e.constructor.name}},{key:"getMessage",value:function(e,t){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}},{key:"getStack",value:function(e){return e.stacktrace||e.stack||void 0}}]),e}(),tX=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return!!ew(e,"ErrorEvent")&&(null!=e.error||this.fe(e))}},{key:"coerce",value:function(e,t){if(null!=e.error)return t.apply(e.error);var n,i=t.apply(e.message);return C({},i,{stack:null!=(n=this.pe(e))?n:i.stack,synthetic:!0})}},{key:"fe",value:function(e){return ed(e.message)&&e.message.length>0}},{key:"pe",value:function(e){if(ed(e.filename)&&e.filename.length>0){var t,n,i=null!=(t=e.lineno)?t:0,r=null!=(n=e.colno)?n:0;return"Error\n at "+e.filename+":"+i+":"+r}}}]),e}(),tZ=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,t0=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return"string"==typeof e}},{key:"coerce",value:function(e,t){var n,i=this.getInfos(e),r=i[0],s=i[1];return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}},{key:"getInfos",value:function(e){var t="Error",n=e,i=e.match(tZ);return i&&(t=i[1],n=i[2]),[t,n]}}]),e}(),t1=["fatal","error","warning","log","info","debug"];function t2(e,t){void 0===t&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var r=n.slice(0,i).join(", ");if(t>=r.length)return i===n.length?r:r.length>t?r.slice(0,t)+"...":r}return""}var t3=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return"object"==(void 0===e?"undefined":(0,v._)(e))&&null!==e}},{key:"coerce",value:function(e,t){var n,i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(n=this.getStack(e))?n:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}},{key:"getType",value:function(e){return ex(e)?e.constructor.name:"Error"}},{key:"getValue",value:function(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return(n&&"Object"!==n?"'"+n+"'":"Object")+" captured as exception with keys: "+t2(e)}},{key:"isSeverityLevel",value:function(e){return ed(e)&&!ev(e)&&t1.indexOf(e)>=0}},{key:"getStack",value:function(e){try{return ed(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:ed(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var n=e[t];if((0,f._)(n,Error))return n}}},{key:"getObjectClassName",value:function(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}]),e}(),t5=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return ex(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+t2(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),t4=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return eb(e)}},{key:"coerce",value:function(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),t8=function(){function e(){(0,u._)(this,e)}return(0,l._)(e,[{key:"match",value:function(e){return ew(e,"PromiseRejectionEvent")||this.isCu
1stomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!ex(e))return!1;try{var t=e.detail;return null!=t&&"object"==(void 0===t?"undefined":(0,v._)(t))&&"reason"in t}catch(e){return!1}}},{key:"coerce",value:function(e,t){var n,i=this.getUnhandledRejectionReason(e);return eb(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(i)}},{key:"getUnhandledRejectionReason",value:function(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==(0,v._)(e.detail)&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}]),e}(),t6="$message",t7="$timestamp",t9=new Set([t6,t7]),ne={enabled:!0,max_bytes:32768};function nt(e){var t;return e?{enabled:null!=(t=e.enabled)?t:ne.enabled,max_bytes:function(e,t){if(!e_(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}(e.max_bytes,ne.max_bytes)}:C({},ne)}var nn=function(){function e(t){(0,u._)(this,e),this.Ke=[],this.Je=0,this.Ne=nt(t)}return(0,l._)(e,[{key:"setConfig",value:function(e){this.Ne=nt(e),this.Xe()}},{key:"add",value:function(e){var t=function(e){var t;try{t=er(e)}catch(e){return}try{var n=JSON.parse(t);if(!ec(n))return;var i=n[t6],r=n[t7];if(!ed(i)||0===i.trim().length||!ed(r)&&!e_(r))return;return{step:n,json:t}}catch(e){return}}(e);if(t){var n=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),n=0,i=0;t.length>i;i++)"%"===t[i]?(n+=1,i+=2):n+=1;return n}(t.json);n>this.Ne.max_bytes||(this.Ke.push({step:t.step,bytes:n}),this.Je+=n,this.Xe())}}},{key:"getAttachable",value:function(){return this.Ke.map(function(e){return e.step})}},{key:"clear",value:function(){this.Ke=[],this.Je=0}},{key:"size",value:function(){return this.Ke.length}},{key:"Xe",value:function(){for(;this.Je>this.Ne.max_bytes&&this.Ke.length>0;){var e=this.Ke.shift();e&&(this.Je-=e.bytes)}}}]),e}(),ni=function(e,t){var n=(void 0===t?{}:t).debugEnabled,i={k:function(t){if(g&&(I.DEBUG||g.POSTHOG_DEBUG||n)&&!ef(g.console)&&g.console){for(var i=("__rrweb_original__"in g.console[t])?g.console[t].__rrweb_original__:g.console[t],r=arguments.length,s=Array(r>1?r-1:0),o=1;r>o;o++)s[o-1]=arguments[o];i.apply(void 0,[e].concat((0,d._)(s)))}},debug:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k.apply(i,["debug"].concat((0,d._)(t)))},info:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k.apply(i,["log"].concat((0,d._)(t)))},warn:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k.apply(i,["warn"].concat((0,d._)(t)))},error:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];i.k.apply(i,["error"].concat((0,d._)(t)))},critical:function(){for(var t,n=arguments.length,i=Array(n),r=0;n>r;r++)i[r]=arguments[r];(t=console).error.apply(t,[e].concat((0,d._)(i)))},uninitializedWarning:function(e){i.error("You must initialize PostHog before calling "+e)},createLogger:function(t,n){return ni(e+" "+t,n)}};return i},nr=ni("[PostHog.js]"),ns=nr.createLogger,no=ns("[ExternalScriptsLoader]"),na=function(e,t,n){if(e.config.disable_external_dependency_loading)return no.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=null==m?void 0:m.querySelectorAll("script");if(i){for(var r,s=0;i.length>s;s++)if(r=function(){if(i[s].src===t){var e=i[s];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener("load",function(t){e.__posthog_loading_callback_fired=!0,n(void 0,t)}),e.onerror=function(e){return n(e)},{v:void 0})}}())return r.v}var o=function(){if(!m)return n("document not found");var i=m.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=function(e){i.__posthog_loading_callback_fired=!0,n(void 0,e)},i.onerror=function(e){return n(e)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)m.head.appendChild(i);else{var r,s=m.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):m.body.appendChild(i)}};null!=m&&m.body?o():null==m||m.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"!==t){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5)),i=e.requestRouter.endpointFor("assets",r)}na(e,i,n)}else{var s=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");na(e,s,n)}},$.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);na(e,i,n)},I.DEBUG=!1,I.LIB_VERSION="1.415.7",I.LIB_NAME="web";var nu="$people_distinct_id",nl="$device_id",nc="$device_model",nh="__alias",nf="__timers",nd="$autocapture_disabled_server_side",nv="$heatmaps_enabled_server_side",np="$exception_capture_enabled_server_side",ng="$error_tracking_suppression_rules",n_="$error_tracking_capture_extension_exceptions",ny="$web_vitals_enabled_server_side",nm="$dead_clicks_enabled_server_side",nk="$product_tours_enabled_server_side",nb="$web_vitals_allowed_metrics",nw="$session_recording_remote_config",nx="$replay_sample_rate",nE="$replay_override_sampling",nS="$replay_override_linked_flag",nP="$replay_override_url_trigger",nF="$replay_override_event_trigger",n$="$sesid",nI="$session_is_sampled",nR="$enabled_feature_flags",nM="$active_feature_flags",nC="$early_access_features",nO="$feature_flag_details",nT="$feature_flag_payloads",nN="$feature_flag_request_id",nA="$minimal_flag_called_events",nL="$override_feature_flags",nD="$override_feature_flag_payloads",nj="$stored_person_properties",nq="$stored_group_properties",nH="$surveys",nB="$surveys_loaded_at",nz="$surveys_activated",nU="$surveys_activated_session",nV="$surveys_activated_timestamps",nW="ph_product_tours",nG="$flag_call_reported",nJ="$flag_call_reported_session_id",nK="$feature_flag_errors",nY="$feature_flag_evaluated_at",nQ="$user_state",nX="$client_session_props",nZ="$capture_rate_limit",n0="$initial_campaign_params",n1="$initial_referrer_info",n2="$initial_person_info",
1n3="$epp",n5="$posthog_cookieless",n4="$cookieless_mode",n8="$sdk_debug_extensions_init_method",n6="$sdk_debug_extensions_init_time_ms",n7="$sdk_debug_recording_script_not_loaded",n9="PostHog loadExternalDependency extension not found.",ie="on_reject",it="always",ii="anonymous",ir="identified",is="identified_only",io="visibilitychange",ia="beforeunload",iu="$pageview",il="$pageleave",ic="$identify",ih="$groupidentify";function id(e,t){eu(e)&&e.forEach(t)}function iv(e,t){if(!eg(e))if(eu(e))e.forEach(t);else if((0,f._)(e,FormData))e.forEach(function(e,n){return t(e,n)});else for(var n in e)eo.call(e,n)&&t(e[n],n)}var ip=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];var r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;for(var c in l)void 0!==l[c]&&(e[c]=l[c])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return e};function ig(e){for(var t=Object.keys(e),n=t.length,i=Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var i_=function(e){try{return e()}catch(e){return}},iy=function(e){return function(){try{for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,n)}catch(e){nr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),nr.critical(e)}}},im=function(e){var t={};return iv(e,function(e,n){(ed(e)&&e.length>0||e_(e))&&(t[n]=e)}),t},ik=["herokuapp.com","vercel.app","netlify.app"];function ib(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=r.passive;null==e||e.addEventListener(t,n,{capture:void 0!==s&&s,passive:void 0===o||o})}function iw(e){return"ph_toolbar_internal"===e.name}var ix=function(e){if(m){try{for(var t=e+"=",n=m.cookie.split(";").filter(function(e){return e.length}),i=0;n.length>i;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return e_(e)&&isFinite(e)&&Math.floor(e)===e});var iE,iS,iP,iF,i$,iI=function(){function e(t){if((0,u._)(this,e),this.bytes=t,16!==t.length)throw TypeError("not 128-bit length")}return(0,l._)(e,[{key:"toString",value:function(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,i,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>n||0>i||0>r||t>0xffffffffffff||n>4095||i>0x3fffffff||r>0xffffffff)throw RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/0x10000000000,s[1]=t/0x100000000,s[2]=t/0x1000000,s[3]=t/65536,s[4]=t/256,s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new e(s)}}]),e}(),iR=function(){function e(){(0,u._)(this,e),this.S=0,this.I=0,this.A=new iC}return(0,l._)(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(!ef(e))return e;this.S=0;var t=this.generateOrAbort();if(ef(t))throw Error("Could not generate UUID after timestamp reset");return t}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>0x3ffffffffff&&(this.S++,this.C())}return iI.fromFieldsV7(this.S,Math.trunc(this.I/0x40000000),0x3fffffff&this.I,this.A.nextUint32())}},{key:"C",value:function(){this.I=1024*this.A.nextUint32()+(1023&this.A.nextUint32())}}]),e}(),iM=function(e){if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};g&&!ef(g.crypto)&&crypto.getRandomValues&&(iM=function(e){return crypto.getRandomValues(e)});var iC=function(){function e(){(0,u._)(this,e),this.R=new Uint32Array(8),this.O=1/0}return(0,l._)(e,[{key:"nextUint32",value:function(){return this.R.length>this.O||(iM(this.R),this.O=0),this.R[this.O++]}}]),e}(),iO=function(){return iT().toString()},iT=function(){return(i$||(i$=new iR)).generate()},iN="",iA=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,iL={N:function(){return!!m},j:function(e){nr.error("cookieStore error: "+e)},P:ix,H:function(e){var t;try{t=JSON.parse(iL.P(e))||{}}catch(e){}return t},F:function(e,t,n,i,r){if(!m)return!1;try{var s="",o="",a=function(e,t){if(t){var n=function(e,t){if(void 0===t&&(t=m),iN)return iN;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),r="dmn_chk_"+iO();!iN&&i--;){var s=n.slice(i).join("."),o=r+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",iN=s)}return iN}(e);if(!n){var i,r=(i=e.match(iA))?i[0]:"";r!==n&&nr.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}(m.location.hostname,i);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(o="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&nr.warn("cookieStore warning: large cookie, len="+l.length),m.cookie=l,!0}catch(e){return!1}},q:function(e,t){if(null!=m&&m.cookie)try{iL.F(e,"",-1,t)}catch(e){return}}},iD=null,ij={N:function(){if(!ep(iD))return iD;var e=!0;if(ef(g))e=!1;
1else try{var t="__mplssupport__";ij.F(t,"xyz"),'"xyz"'!==ij.P(t)&&(e=!1),ij.q(t)}catch(t){e=!1}return e||nr.error("localStorage unsupported; falling back to cookie store"),iD=e,e},j:function(e){nr.error("localStorage error: "+e)},P:function(e){try{return null==g?void 0:g.localStorage.getItem(e)}catch(e){ij.j(e)}return null},H:function(e){try{return JSON.parse(ij.P(e))||{}}catch(e){}return null},F:function(e,t){try{return null==g||g.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ij.j(e)}return!1},q:function(e){try{null==g||g.localStorage.removeItem(e)}catch(e){ij.j(e)}}},iq=[nl,"distinct_id",n$,nI,n3,n2,nQ],iH={},iB={N:function(){return!0},j:function(e){nr.error("memoryStorage error: "+e)},P:function(e){return iH[e]||null},H:function(e){return iH[e]||null},F:function(e,t){return iH[e]=t,!0},q:function(e){delete iH[e]}},iz=null,iU={N:function(){if(!ep(iz))return iz;if(iz=!0,ef(g))iz=!1;else try{var e="__support__";iU.F(e,"xyz"),'"xyz"'!==iU.P(e)&&(iz=!1),iU.q(e)}catch(e){iz=!1}return iz},j:function(e){nr.error("sessionStorage error: ",e)},P:function(e){try{return null==g?void 0:g.sessionStorage.getItem(e)}catch(e){iU.j(e)}return null},H:function(e){try{return JSON.parse(iU.P(e))||null}catch(e){}return null},F:function(e,t){try{return null==g||g.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){iU.j(e)}return!1},q:function(e){try{null==g||g.sessionStorage.removeItem(e)}catch(e){iU.j(e)}}},iV=function(){function e(t){(0,u._)(this,e),this._instance=t}return(0,l._)(e,[{key:"Ne",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.ti()?0:this.ei}},{key:"isOptedOut",value:function(){return this.Ne.cookieless_mode===it||this.isRejected()||-1===this.consent&&this.Ne.cookieless_mode===ie}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"isRejected",value:function(){return 0===this.consent||-1===this.consent&&this.Ne.opt_out_capturing_by_default}},{key:"optInOut",value:function(e){this.ii.F(this.ri,+!!e,this.Ne.cookie_expiration,this.Ne.cross_subdomain_cookie,this.Ne.secure_cookie)}},{key:"reset",value:function(){this.ii.q(this.ri,this.Ne.cross_subdomain_cookie)}},{key:"ri",get:function(){var e=this._instance.config,t=e.token,n=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(n?n+t:"__ph_opt_in_out_"+t)}},{key:"ei",get:function(){var e=this.ii.P(this.ri);return eP(e)?1:et(eF,e)?0:-1}},{key:"ii",get:function(){var e=this.Ne.opt_out_capturing_persistence_type,t="localStorage"===e?ij:iL;if(!this.ni||this.ni!==t){this.ni=t;var n="localStorage"===e?iL:ij;n.P(this.ri)&&(this.ni.P(this.ri)||this.optInOut(eP(n.P(this.ri))),n.q(this.ri,this.Ne.cross_subdomain_cookie))}return this.ni}},{key:"ti",value:function(){return!!this.Ne.respect_dnt&&[null==y?void 0:y.doNotTrack,null==y?void 0:y.msDoNotTrack,$.doNotTrack].some(function(e){return eP(e)})}}]),e}();function iW(e,t){var n,i=null==e||null==(n=e.config)?void 0:n.get_current_url;if(!el(i))return t;try{var r=i(t);return ed(r)&&r?r:t}catch(e){return nr.error("Error in get_current_url, falling back to window.location.href",e),t}}var iG="__POSTHOG_TOOLBAR__";function iJ(e){return(0,f._)(e,Element)&&(e.id===iG||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function iK(e){return!!e&&1===e.nodeType}function iY(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function iQ(e){return!!e&&3===e.nodeType}function iX(e){return!!e&&11===e.nodeType&&iK(e.host)}function iZ(e){return e?en(e).split(/\s+/):[]}function i0(e,t){var n,i,r=ef(i=null==g||null==(n=g.location)?void 0:n.href)?void 0:iW(t,i);return!!(r&&e&&e.some(function(e){return r.match(e)}))}function i1(e){var t="";switch((0,v._)(e.className)){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return iZ(t)}function i2(e){return eg(e)?null:en(e).split(/(\s+)/).filter(function(e){return rp(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function i3(e){var t="";return ra(e)&&!ru(e)&&e.childNodes&&e.childNodes.length&&iv(e.childNodes,function(e){var n;iQ(e)&&e.textContent&&(t+=null!=(n=i2(e.textContent))?n:"")}),en(t)}function i5(e){var t;return ef(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var i4=["a","button","form","input","select","textarea","label"];function i8(e,t){if(ef(t))return!0;var n,i=function(e){if(t.some(function(t){var n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch(e){return!1}}
1))return{v:!0}},r=!0,s=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;if(n=i(l))return n.v}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return!1}function i6(e){var t=e.parentNode;return!(!t||!iK(t))&&t}var i7=[".ph-no-autocapture","[data-ph-no-autocapture]"],i9=["next","previous","prev",">","<"],re=(0,d._)(i9).concat(["+","-","â","â"]),rt=function(e,t){return/[a-z0-9]/i.test(t)?e.includes(t):e===t},rn=[".ph-no-rageclick",".ph-no-capture"],ri=["","text","search","email","password","url","tel","number"];function rr(e,t){if(!g||rs(e)||(em(t)?(i=!!t&&rn,r=void 0,s=!1):(i=null!=(o=null==t?void 0:t.css_selector_ignorelist)?o:rn,r=null==t?void 0:t.content_ignorelist,s=null!=(a=null==t?void 0:t.ignore_text_selection)&&a),!1===i)||s&&!(!(n=e)||!iK(n))&&(iY(n,"textarea")||(iY(n,"input")?et(ri,(n.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(n))))return!1;var n,i,r,s,o,a,u=ro(e,!1).targetElementList;return!function(e,t){var n;if(!1===e||ef(e))return!1;if(!0===e)n=i9;else{if(!eu(e))return!1;if(e.length>10)return nr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(function(e){return e.toLowerCase()})}return t.some(function(e){var t=e.safeText,i=e.ariaLabel;return n.some(function(e){return rt(t,e)||rt(i,e)})})}(r,u.map(function(e){var t;return{safeText:i3(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!i8(u,i)}
1var rs=function(e){return!e||iY(e,"html")||!iK(e)},ro=function(e,t){if(!g||rs(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!iY(r,"body");)if(iX(r.parentNode))i.push(r.parentNode.host),r=r.parentNode.host;else{var s=i6(r);if(!s)break;if(t||i4.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var o=g.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}catch(e){}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}};function ra(e){for(var t=new Set,n=0,i=e;i.parentNode&&!iY(i,"body");i=i.parentNode){if(n++>=1e3||t.has(i))return!1;t.add(i);var r=i1(i);if(et(r,"ph-sensitive")||et(r,"ph-no-capture"))return!1}if(et(i1(e),"ph-include"))return!0;var s=e.type||"";if(ed(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!ed(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 ru(e){return!!(iY(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||iY(e,"select")||iY(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rl=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}))$"),rc=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rh=[16,15,14,13],rf=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rd=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rv=/[0-9A-Za-z_]/;function rp(e,t){return void 0===t&&(t=!0),!(eg(e)||ed(e)&&(e=en(e),(t?rl.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(rc.lastIndex=0;t=rc.exec(e);){var n=t[2],i=!0,r=!1,s=void 0;if(n)for(var o=n.replace(/[- ]/g,""),a=0;o.length>a;a++)try{for(var u,l=rh[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var c=u.value,h=a+c;if(o.length>=h){var f=o.slice(a,h);if(rl.test(f)&&function(e){for(var t=0,n=!1,i=e.length-1;i>=0;i--){var r=e.charCodeAt(i)-48;n&&(r*=2)>9&&(r-=9),t+=r,n=!n}return t%10==0}(f))return!0}}}catch(e){r=!0,s=e}finally{try{i||null==l.return||l.return()}finally{if(r)throw s}}}return!1}(e))||(t?rf.test(e):function(e){var t;for(rd.lastIndex=0;t=rd.exec(e);){var n=t[1],i=t[3];if(!(n&&i&&rv.test(n)&&rv.test(i)))return!0}return!1}(e))))&&!0}function rg(e){var t=i3(e);return rp(t=(t+" "+function e(t){var n="";return t&&t.childNodes&&t.childNodes.length&&iv(t.childNodes,function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=i3(t);n=(n+" "+r).trim(),t.childNodes&&t.childNodes.length&&(n=(n+" "+e(t)).trim())}catch(e){nr.error("[AutoCapture]",e)}}),n}(e)).trim())?t:""}function r_(e){return e.replace(/"|\\"/g,'\\"')}var ry=ns("[Dead Clicks]"),rm=function(){return!0},rk=function(e){var t,n=!(null==(t=e.instance.persistence)||!t.get_property(nm)),i=e.instance.config.capture_dead_clicks;return em(i)?i:!!ec(i)||n},rb=function(){function e(t,n,i){(0,u._)(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}return(0,l._)(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this.si}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register((0,c._)({},nm,t.captureDeadClicks)),this.startIfEnabledOrStop())}}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.ai(function(){e.oi()}):this.stop()}},{key:"ai",value:function(e){var t,n;null!=(t=$.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",function(t){t?ry.error("failed to load script",t):e()})}},{key:"oi",value:function(){var e;if(m){if(!this.si&&null!=(e=$.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ec(this.instance.config.capture_dead_clicks)?C({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.si=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.si.start(m),ry.info("starting...")}}else ry.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.si&&(this.si.stop(),this.si=void 0,ry.info("stopping..."))}}]),e}(),rw=ns("[SegmentIntegration]"),rx="posthog-js";function rE(e,t){var n=void 0===t?{}:t,i=n.organization,r=n.projectId,s=n.prefix,o=n.severityAllowList,a=void 0===o?["error"]:o,u=n.sendExceptionsToPostHog,l=void 0===u||u;return function(t){if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var n=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/pers
1on/"+e.get_distinct_id());t.tags["PostHog Person URL"]=n,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var o,u,c,h,f,d,v=(null==(o=t.exception)?void 0:o.values)||[],p=v.map(function(e){return C({},e,{stacktrace:e.stacktrace?C({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return C({},e,{platform:"web:javascript"})})}):void 0})}),g={$exception_message:(null==(u=v[0])?void 0:u.value)||t.message,$exception_type:null==(c=v[0])?void 0:c.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=v[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(f=v[0])?void 0:f.type,$sentry_tags:t.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),l&&(null==(d=e.exceptions)||d.sendExceptionEvent(g)),t}}var rS=function e(t,n,i,r,s,o){(0,u._)(this,e),this.name=rx,this.setupOnce=function(e){e(rE(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},rP=function(){function e(t){var n=this;(0,u._)(this,e),this.li=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(nr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.ui=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.hi()}return(0,l._)(e,[{key:"hi",value:function(){var e;this.di=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.li)}},{key:"destroy",value:function(){var e;null==(e=this.di)||e.call(this),this.di=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.vi(e,t);return this.ui={pathname:null!=(n=null==g?void 0:g.location.pathname)?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.vi(e,null==(t=this.ui)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.ui)?void 0:e.pageViewId}}},{key:"vi",value:function(e,t){var n=this.ui;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var s=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,u=r.maxContentHeight,l=r.lastContentY,c=r.maxContentY;if(!(ef(s)||ef(o)||ef(a)||ef(u)||ef(l)||ef(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c);var h=s>1?e$(o/s,0,1,nr):1,f=s>1?e$(a/s,0,1,nr):1,d=u>1?e$(l/u,0,1,nr):1,v=u>1?e$(c/u,0,1,nr):1;i=ip(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),rF=["flags","surveys"],r$=(r={},(0,c._)(r,nu,{exposure:"hidden"}),(0,c._)(r,nh,{exposure:"hidden"}),(0,c._)(r,"__cmpns",{exposure:"hidden"}),(0,c._)(r,nf,{exposure:"hidden"}),(0,c._)(r,nd,{exposure:"event"}),(0,c._)(r,nv,{exposure:"hidden"}),(0,c._)(r,np,{exposure:"event"}),(0,c._)(r,ng,{exposure:"hidden"}),(0,c._)(r,n_,{exposure:"event"}),(0,c._)(r,ny,{exposure:"event"}),(0,c._)(r,nm,{exposure:"event"}),(0,c._)(r,nk,{exposure:"hidden"}),(0,c._)(r,nb,{exposure:"event"}),(0,c._)(r,nw,{exposure:"hidden"}),(0,c._)(r,"$session_recording_enabled_server_side",{exposure:"hidden"}),(0,c._)(r,n$,{exposure:"hidden"}),(0,c._)(r,nI,{exposure:"event"}),(0,c._)(r,nx,{exposure:"event",shouldSkipFromEventProperties:function(e){return ep(e)}}),(0,c._)(r,"$session_past_minimum_duration",{exposure:"event"}),(0,c._)(r,"$session_recording_url_trigger_activated_session",{exposure:"event"}),(0,c._)(r,"$session_recording_event_trigger_activated_session",{exposure:"event"}),(0,c._)(r,"$debug_first_full_snapshot_timestamp",{exposure:"event"}),(0,c._)(r,"$sess_rec_flush_size",{exposure:"hidden"}),(0,c._)(r,nR,{exposure:"hidden",storageGroup:"flags"}),(0,c._)(r,nM,{exposure:"hidden",storageGroup:"flags"}),(0,c._)(r,nC,{exposure:"hidden"}),(0,c._)(r,nO,{exposure:"hidden",storageGroup:"flags"}),(0,c._)(r,nT,{exposure:"hidden",storageGroup:"flags"}),(0,c._)(r,nN,{exposure:"hidden",storageGroup:"flags",volatile:!0}),(0,c._)(r,nA,{exposure:"hidden",storageGroup:"flags"}),(0,c._)(r,nL,{exposure:"hidden"}),(0,c._)(r,nD,{exposure:"hidden"}),(0,c._)(r,nj,{exposure:"hidden"}),(0,c._)(r,nq,{exposure:"hidden"}),(0,c._)(r,nH,{exposure:"hidden",storageGroup:"surveys"}),(0,c._)(r,nB,{exposure:"hidden",storageGroup:"surveys",volatile:!0}),(0,c._)(r,nz,{exposure:"event"}),(0,c._)(r,nU,{exposure:"hidden"}),(0,c._)(r,nV,{exposure:"hidden"}),(0,c._)(r,nW,{exposure:"hidden"}),(0,c._)(r,"$product_tours_activated",{exposure:"hidden"}),(0,c._)(r,"$product_tours_activated_session",{exposure:"hidden"}),(0,c._)(r,"$conversations_widget_session_id",{exposure:"event"}),(0,c._)(r,"$conversations_ticket_id",{exposure:"event"}),(0,c._)(r,"$conversations_widget_state",{exposure:"event"}),(0,c._)(r,"$conversations_user_traits",{exposure:"event"}),(0,c._)(r,nG,{exposure:"hidden"}),(0,c._)(r,nJ,{exposure:"hidden"}),(0,c._)(r,nK,{exposure:"hidden"}),(0,c._)(r,nY,{exposure:"hidden",storageGroup:"flags",volatile:!0}),(0,c._)(r,nQ,{exposure:"hidden"}),(0,c._)(r,nX,{exposure:"hidden"}),(0,c._)(r,nZ,{exposure:"hidden"}),(0,c._)(r,n0,{exposure:"hidden"}),(0,c._)(r,n1,{exposure:"hidden"}),(0,c._)(r,n2,{exposure:"hidden"}),(0,c._)(r,n3,{exposure:"hidden"}),(0,c._)(r,nE,{exposure:"event"}),(0,c._)(r,nS,{exposure:"event"}),(0,c._)(r,nP,{exposure:"event"}),(0,c._)(r,nF,{exposure:"event"}),(0,c._)(r,n8,{exposure:"event"}),(0,c._)(r,n6,{exposure:"event"}),(0,c._)(r,n7,{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_event_trigger_status",{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_linked_flag_trigger_status",{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_matched_recording_trigger_groups",{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_remote_trigger_matching_config",{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_trigger_groups_count",{exposure:"event"}),(0,c._)(r,"$sdk_debug_replay_url_trigger_status",{exposure:"event"}),(0,c._)(r,"$session_recording_start_reason",{exposure:"event"}),r),rI=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],rR=function(e){var t=r$[e];if(t)return t;var n=!0,i=!1,r=void 0;try{for(var s,o=rI[Symbol.iterator]();!(n=(s=o.next()).done);
1n=!0){var a=s.value,u=a[1];if(0===e.indexOf(a[0]))return u}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}},rM=function(e,t){try{return JSON.stringify(e,function(e,t){return"bigint"==(void 0===t?"undefined":(0,v._)(t))?t.toString():t},t)}catch(t){return er(e)}},rC=function(e){var t=null==m?void 0:m.createElement("a");return ef(t)?null:(t.href=e,t)},rO=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var s=i[r].split("=");if(s[0]===t){n=s;break}}if(!eu(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){nr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rT=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var h=u[c].split("=");eu(h)&&(t.includes(h[0])?l.push(h[0]+"="+n):l.push(u[c]))}var f=a;return null!=o&&(f+="?"+l.join("&")),null!=r&&(f+="#"+r),f},rN=function(e,t){var n=e.match(RegExp(t+"=([^&]*)"));return n?n[1]:null},rA=function(e,t){return e>=t&&P()},rL=function(e,t,n,i){if(0===e){if(P()){var r=t+1;return r===n&&i(),r}return t}return 0},rD="https?://(.*)",rj=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rq=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat((0,d._)(rj)),rH="<masked>",rB=["li_fat_id"];function rz(e,t,n){if(!m)return{};var i,r=t?(0,d._)(rj).concat((0,d._)(n||[])):[],s=rU(rT(m.URL,r,rH),e);return ip((i={},iv(rB,function(e){var t=ix(e);i[e]=t||null}),i),s)}function rU(e,t){var n=rq.concat(t||[]),i={};return iv(n,function(t){var n=rO(e,t);i[t]=n||null}),i}function rV(e){var t=e?0===e.search(rD+"google.([^/?]*)")?"google":0===e.search(rD+"bing.com")?"bing":0===e.search(rD+"yahoo.com")?"yahoo":0===e.search(rD+"duckduckgo.com")?"duckduckgo":null:null,n={};if(!ep(t)){n.$search_engine=t;var i=m?rO(m.referrer,"yahoo"!=t?"q":"p"):"";i.length&&(n.ph_keyword=i)}return n}function rW(){return navigator.language||navigator.userLanguage}var rG="$direct";function rJ(){return(null==m?void 0:m.referrer)||rG}function rK(e,t,n){void 0===n&&(n=!1);var i=e?(0,d._)(rj).concat((0,d._)(t||[])):[],r=n?tS(null==k?void 0:k.href):null==k?void 0:k.href,s=null==r?void 0:r.substring(0,1e3);return{r:rJ().substring(0,1e3),u:s?rT(s,i,rH):void 0}}function rY(e,t){void 0===t&&(t=!1);var n,i=e.r,r=e.u,s=t?tS(r):r,o={$referrer:i,$referring_domain:null==i?void 0:i==rG?rG:null==(n=rC(i))?void 0:n.host};
1if(s){o.$current_url=s;var a=rC(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ip(o,rU(s))}return i&&ip(o,rV(i)),o}function rQ(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var rX={flags:nY,surveys:nB},rZ=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],r0="main",r1=function(){function e(t,n,i){var r,s=this;if((0,u._)(this,e),void 0===i&&(i=!0),this.ci={},this.fi=!1,this.pi=!1,this.Ne=t,this.gi=i,this.props={},this.mi=void 0,this.yi=(r="",t.token&&(r=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+r+"_posthog"),this.ii=this.bi(t),this.pi=this.wi(t),this.load(),t.debug&&nr.info("Persistence loaded",t.persistence,C({},this.props)),this.update_config(t,t,n),this.save(),g){var o=function(){return s.flush()};ib(g,"beforeunload",o,{capture:!1}),ib(g,"pagehide",o,{capture:!1})}}return(0,l._)(e,[{key:"ki",value:function(){var e,t=null==(e=this.Ne)?void 0:e.persistence_save_debounce_ms;return e_(t)&&t>0?t:0}},{key:"isDisabled",value:function(){return!!this.xi}},{key:"bi",value:function(e){-1===rZ.indexOf(e.persistence.toLowerCase())&&(nr.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,n,i,r,s=(t=e.cookie_persisted_properties||[],n=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===n&&(n=!1),i=(0,d._)(iq).concat((0,d._)(t)),C({},ij,{H:function(e){try{var t={};try{t=iL.H(e)||{}}catch(e){}var i,r=JSON.parse(ij.P(e)||"{}");if(n){var s={};for(var o in t){var a=t[o];ep(a)||""===a||(s[o]=a)}i=ip(r,s)}else i=ip(t,r);return ij.F(e,i),i}catch(e){}return null},F:function(e,t,n,r,s,o){var a=ij.F(e,t,void 0,void 0,o);try{var u={};i.forEach(function(e){t[e]&&(u[e]=t[e])}),Object.keys(u).length&&iL.F(e,u,n,r,s,o)}catch(e){ij.j(e)}return a},q:function(e,t){try{null==g||g.localStorage.removeItem(e),iL.q(e,t)}catch(e){ij.j(e)}}})),o=!1,a=e.persistence.toLowerCase();return"localstorage"===a&&ij.N()?(r=ij,o=!0):"localstorage+cookie"===a&&s.N()?(r=s,o=!0):"sessionstorage"===a&&iU.N()?r=iU:"memory"===a?r=iB:"cookie"===a?r=iL:s.N()?(r=s,o=!0):r=iL,this.fi=o,r}},{key:"Si",value:function(e){return this.yi+"__"+e}},{key:"wi",value:function(e){return this.fi&&!!e.split_storage}},{key:"properties",value:function(){var e={};return iv(this.props,function(t,n){var i=rR(n);if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t))return;e[n]=t}}),e}},{key:"load",value:function(){if(!this.xi){var e=this.ii.H(this.yi);e&&(this.props=ip({},e)),this.pi&&this.Ci()}}},{key:"Ci",value:function(){var e=!0,t=!1,n=void 0;try{for(var i,r=rF[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value,o=ij.H(this.Si(s));if(o&&!eh(o)){var a=this.Mi(s);a.persisted=!0,this.Ti(s)||(a.fingerprint=this.Ei(o,s)),this.Ii(s,o)||ip(this.props,o)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}}},{key:"Ti",value:function(e){return Object.keys(this.props).some(function(t){var n;return(null==(n=rR(t))?void 0:n.storageGroup)===e})}},{key:"Ii",value:function(e,t){var n=rX[e];if(!n)return!1;var i=t[n],r=this.props[n];return e_(i)&&e_(r)&&r>i}},{key:"refreshKey",value:function(e){var t;if(!this.xi){var n=this.pi?null==(t=rR(e))?void 0:t.storageGroup:void 0,i=n?ij.H(this.Si(n)):this.ii.H(this.yi);if(i&&e in i)this.Pi(e,i[e]);else{if(n){var r=this.ii.H(this.yi);if(r&&e in r)return void this.Pi(e,r[e])}this.Ri(e)}}}},{key:"save",value:function(){var e=this;if(!this.xi){var t=this.ki();t>0?ef(this.Ai)&&(this.Ai=setTimeout(function(){e.Ai=void 0,e.Fi()},t)):this.Fi()}}},{key:"flush",value:function(){ef(this.Ai)||(clearTimeout(this.Ai),this.Ai=void 0,this.Fi())}},{key:"Fi",value:function(){this.xi||(this.pi?this.Li():this.Oi(this.ii,this.yi,this.props,r0))}},{key:"Li",value:function(){var e=this.Di(),t=e.main,n=e.groups,i=!0,r=!1,s=void 0;try{for(var o,a=(this.Oi(this.ii,this.yi,t,r0),rF)[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u,l=o.value,c=n[l];(!eh(c)||null!=(u=this.ci[l])&&u.persisted)&&this.Oi(ij,this.Si(l),c,l)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}}},{key:"Di",value:function(){var e={},t={flags:{},surveys:{}};return iv(this.props,function(n,i){var r,s=null==(r=rR(i))?void 0:r.storageGroup;s?t[s][i]=n:e[i]=n}
1),{main:e,groups:t}}},{key:"Ei",value:function(e,t){if(t===r0)return JSON.stringify(e)+"|"+this.$i+"|"+this.Ni+"|"+this.qi;var n={};return iv(e,function(e,t){var i;n[t]=null!=(i=rR(t))&&i.volatile?"__volatile__":e}),JSON.stringify(n)}},{key:"Oi",value:function(e,t,n,i){var r,s=this.Mi(i);if(i===r0||s.dirty||ef(s.fingerprint)){try{if((r=this.Ei(n,i))===s.fingerprint)return void(s.dirty=!1)}catch(e){r=void 0}e.F(t,n,this.$i,this.Ni,this.qi,this.Ne.debug)?(s.dirty=!1,i!==r0&&(s.persisted=!0),ef(r)||(s.fingerprint=r)):this.Ne.debug&&nr.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}},{key:"remove",value:function(e){var t=(void 0===e?{}:e).keepGroupEntries,n=void 0!==t&&t,i=!0,r=!1,s=void 0;if(ef(this.Ai)||(clearTimeout(this.Ai),this.Ai=void 0),this.ii.q(this.yi,!1),this.ii.q(this.yi,!0),!n&&this.gi)try{for(var o,a=rF[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value;ij.q(this.Si(u))}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}n?delete this.ci[r0]:this.ci={}}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(ec(e)){ef(t)&&(t="None"),this.$i=ef(n)?this.ji:n;var r=!1;if(iv(e,function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i.Pi(n,e),r=!0)}),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(ec(e)){this.$i=ef(t)?this.ji:t;var i=!1;if(iv(e,function(t,r){e.hasOwnProperty(r)&&(n.props[r]!==t||ec(t)||eu(t))&&(n.Pi(r,t),i=!0)}),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){var t=!1,n=!0,i=!1,r=void 0;try{for(var s,o=("string"==typeof e?[e]:e)[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;a in this.props&&(this.Ri(a),t=!0)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}t&&this.save()}},{key:"update_campaign_params",value:function(){var e=null==m?void 0:m.URL;if(e!==this.mi){var t=rz(this.Ne.custom_campaign_params,this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties);eh(im(t))||this.register(t),this.mi=e}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==m?void 0:m.referrer)?rV(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:rJ(),$referring_domain:null!=m&&m.referrer&&(null==(e=rC(m.referrer))?void 0:e.host)||rG},void 0)}},{key:"set_initial_person_info",value:function(){this.props[n0]||this.props[n1]||this.register_once((0,c._)({},n2,rK(this.Ne.mask_personal_data_properties,this.Ne.custom_personal_data_properties,this.Ne.disable_capture_url_hashes)),void 0)}},{key:"get_initial_props",value:function(){var e,t,n,i=this,r={};iv([n1,n0],function(e){var t=i.props[e];t&&iv(t,function(e,t){r["$initial_"+ei(t)]=e})});var s=this.props[n2];return s&&ip(r,(void 0===(e=this.Ne.disable_capture_url_hashes)&&(e=!1),t=rY(s,e),n={},iv(t,function(e,t){n["$initial_"+ei(t)]=e}),n)),r}},{key:"safe_merge",value:function(e){return iv(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){this.ji=this.$i=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==t.persistence||!function(e,t){if(e.length!==t.length)return!1;var n=(0,d._)(e).sort(),i=(0,d._)(t).sort();return n.every(function(e,t){return e===i[t]})}(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=i?this.bi(e):this.ii,s=this.wi(e);if(i||s!==this.pi){var o=this.props;this.clear(),this.ii=r,this.pi=s,this.props=o,this.save()}}},{key:"set_disabled",value:function(e){this.xi=e,this.xi?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.Ni&&(this.Ni=e,this.remove({keepGroupEntries:!0}),this.save())}},{key:"set_secure",value:function(e){e!==this.qi&&(this.qi=e,this.remove({keepGroupEntries:!0}),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props[nf]||{};n[e]=t,this.Pi(nf,n),this.save()}},{key:"remove_event_timer",value:function(e){var t=this.props[nf]||{},n=t[e];return ef(n)||(delete t[e],this.Pi(nf,t),this.save()),n}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this.Pi(e,t),this.save()}},{key:"Pi",value:function(e,t){var n;this.props[e]=t,null!=(n=rR(e))&&n.volatile||this.Bi(e)}},{key:"Ri",value:function(e){delete this.props[e],this.Bi(e)}},{key:"Bi",value:function(e){var t,n=null==(t=rR(e))?void 0:t.storageGroup;n&&(this.Mi(n).dirty=!0)}},{key:"Mi",value:function(e){return this.ci[e]||(this.ci[e]={})}}]),e}();function r2(e){var t=!0;return{dispose:function(){if(t){t=!1;var n=e();n&&el(n.then)&&n.then(void 0,function(){})}}}}var r3="gzip-js",r5="base64",r4="events",r8="cancelEvents",r6="survey shown",r7="survey dismissed",r9="survey sent",se="popover",st=ns("[RateLimiter]"),sn=function(){function e(t){var n=this;(0,u._)(this,e),this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=function(e){var t=e.text;
1if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(function(e){st.info((e||"events")+" is quota limited."),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void st.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return(0,l._)(e,[{key:"captureEventsPerSecond",get:function(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}},{key:"captureEventsBurstLimit",get:function(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}},{key:"clientRateLimitContext",value:function(e){void 0===e&&(e=!1);var t,n,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!=(t=null==(n=this.instance.persistence)?void 0:n.get_property(nZ))?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>r&&(a.tokens=r);var u=1>a.tokens;if(u||e||(a.tokens=Math.max(0,a.tokens-1)),u&&!e){var l=(e_(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Hi(l)&&(a.dropped=0)}return this.lastEventRateLimited=u,null==(i=this.instance.persistence)||i.set_property(nZ,a),{isRateLimited:u,remainingTokens:a.tokens}}},{key:"Ui",value:function(e){var t=this.instance.config.property_denylist;return!eu(t)||!t.includes(e)}},{key:"zi",value:function(){var e;if(this.Ui("$current_url")&&this.Ui("$pathname")&&null!=k&&k.pathname)return""+(null!=(e=k.origin)?e:"")+k.pathname}},{key:"Hi",value:function(e){var t,n,i=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,s=this.zi(),o=this.Ui("$session_id")?null==(t=(n=this.instance).get_session_id)?void 0:t.call(n):void 0,a=[e+" event(s) dropped since the last warning",s?"triggered on "+s: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 "+r+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),si=ns("[RemoteConfig]"),sr=function(){function e(t){(0,u._)(this,e),this._instance=t}return(0,l._)(e,[{key:"remoteConfig",get:function(){var e;return null==(e=$._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Wi",value:function(e){var t,n,i=this;null!=(t=$.__PosthogExtensions__)&&t.loadExternalDependency?null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"remote-config",function(){return e(i.remoteConfig)}):e()}},{key:"Vi",value:function(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return si.info("Using preloaded remote config",this.remoteConfig),this.Zi(this.remoteConfig),void this.Gi();if(this._instance.Qi())return void si.warn("Remote config is disabled. Falling back to local config.");this.Wi(function(t){t?(e.Zi(t),e.Gi()):(si.info("No config found after loading remote JS config. Falling back to JSON."),e.Vi(function(t){e.Zi(t.json,t),e.Gi()}))})}catch(e){si.error("Error loading remote config",e),this.Zi()}}},{key:"stop",value:function(){this.Ki&&(clearInterval(this.Ki),this.Ki=void 0)}},{key:"refresh",value:function(){!this._instance.Qi()&&m&&"hidden"!==m.visibilityState&&this._instance.reloadFeatureFlags()}},{key:"Gi",value:function(){var e,t=this;if(!this.Ki){var n=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==n&&(this.Ki=setInterval(function(){t.refresh()},n))}}},{key:"Zi",value:function(e,t){!e&&t&&(0===t.statusCode?t.error||si.warn("Failed to fetch remote config from PostHog."):si.error("Failed to fetch remote config from PostHog."));try{this._instance.Zi(e?{ok:!0,config:e}:{ok:!1})}catch(e){si.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;null==(n=this._instance.featureFlags)||n.ensureFlagsLoaded()}catch(e){si.error("Error loading feature flags",e)}}}]),e}(),ss=Uint8Array,so=Uint16Array,sa=Uint32Array,su=new ss([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]),sl=new ss([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]),sc=new ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sh=function(e,t){for(var n=new so(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new sa(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},sf=sh(su,2),sd=sf[1];sf[0][28]=258,sd[258]=28;for(var sv=sh(sl,0)[1],sp=new so(32768),sg=0;32768>sg;++sg){var s_=(43690&sg)>>>1|(21845&sg)<<1;sp[sg]=((65280&(s_=(61680&(s_=(52428&s_)>>>2|(13107&s_)<<2))>>>4|(3855&s_)<<4))>>>8|(255&s_)<<8)>>>1}var sy=function(e,t,n){for(var i=e.length,r=0,s=new so(t);i>r;++r)++s[e[r]-1];var o,a=new so(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new so(1<<t);var u=15-t;for(r=0;i>r;++r)if(e[r])for(var l=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,f=h|(1<<c)-1;f>=h;
vendor: 5,913 bytes, line 1
1++h)o[sp[h]>>>u]=l}else for(o=new so(i),r=0;i>r;++r)o[r]=sp[a[e[r]-1]++]>>>15-e[r];return o},sm=new ss(288);for(sg=0;144>sg;++sg)sm[sg]=8;for(sg=144;256>sg;++sg)sm[sg]=9;for(sg=256;280>sg;++sg)sm[sg]=7;for(sg=280;288>sg;++sg)sm[sg]=8;var sk=new ss(32);for(sg=0;32>sg;++sg)sk[sg]=5;var sb=sy(sm,9,0),sw=sy(sk,5,0),sx=function(e){return(e/8|0)+(7&e&&1)},sE=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new((0,f._)(e,so)?so:(0,f._)(e,sa)?sa:ss)(n-t);return i.set(e.subarray(t,n)),i},sS=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},sP=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},sF=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return[new ss(0),0];if(1==r){var o=new ss(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],l=0,c=1,h=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=r-1;)a=n[n[h].f>n[l].f?l++:h++],u=n[l!=c&&n[h].f>n[l].f?l++:h++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var f=s[0].s;for(i=1;r>i;++i)s[i].s>f&&(f=s[i].s);var d=new so(f+1),v=s$(n[c-1],d,0);if(v>t){i=0;var p=0,g=v-t,_=1<<g;for(s.sort(function(e,t){return d[t.s]-d[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=d[y])break;p+=_-(1<<v-d[y]),d[y]=t}for(p>>>=g;p>0;){var m=s[i].s;t>d[m]?p-=1<<t-d[m]++-1:++i}for(;i>=0&&p;--i){var k=s[i].s;d[k]==t&&(--d[k],++p)}v=t}return[new ss(d),v]},s$=function(e,t,n){return -1==e.s?Math.max(s$(e.l,t,n+1),s$(e.r,t,n+1)):t[e.s]=n},sI=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new so(++t),i=0,r=e[0],s=1,o=function(e){n[i++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=e[a]}return[n.subarray(0,i),t]},sR=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},sM=function(e,t,n){var i=n.length,r=sx(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;i>s;++s)e[r+s+4]=n[s];return 8*(r+4+i)},sC=function(e,t,n,i,r,s,o,a,u,l,c){sS(t,c++,n),++r[256];for(var h=sF(r,15),f=h[0],d=h[1],v=sF(s,15),p=v[0],g=v[1],_=sI(f),y=_[0],m=_[1],k=sI(p),b=k[0],w=k[1],x=new so(19),E=0;y.length>E;++E)x[31&y[E]]++;for(E=0;b.length>E;++E)x[31&b[E]]++;for(var S=sF(x,7),P=S[0],F=S[1],$=19;$>4&&!P[sc[$-1]];--$);var I,R,M,C,O=l+5<<3,T=sR(r,sm)+sR(s,sk)+o,N=sR(r,f)+sR(s,p)+o+14+3*$+sR(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(T>=O&&N>=O)return sM(t,c,e.subarray(u,u+l));if(sS(t,c,1+(T>N)),c+=2,T>N){I=sy(f,d,0),R=f,M=sy(p,g,0),C=p;var A=sy(P,F,0);for(sS(t,c,m-257),sS(t,c+5,w-1),sS(t,c+10,$-4),c+=14,E=0;$>E;++E)sS(t,c+3*E,P[sc[E]]);c+=3*$;for(var L=[y,b],D=0;2>D;++D){var j=L[D];for(E=0;j.length>E;++E)sS(t,c,A[q=31&j[E]]),c+=P[q],q>15&&(sS(t,c,j[E]>>>5&127),c+=j[E]>>>12)}}else I=sb,R=sm,M=sw,C=sk;for(E=0;a>E;++E)if(i[E]>255){sP(t,c,I[257+(q=i[E]>>>18&31)]),c+=R[q+257],q>7&&(sS(t,c,i[E]>>>23&31),c+=su[q]);var q,H=31&i[E];sP(t,c,M[H]),c+=C[H],H>3&&(sP(t,c,i[E]>>>5&8191),c+=sl[H])}else sP(t,c,I[i[E]]),c+=R[i[E]];return sP(t,c,I[256]),c+R[256]},sO=new sa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sT=function(){for(var e=new sa(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&0xedb88320)^n>>>1;e[t]=n}return e}(),sN=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},sA=!!w||!!b,sL="text/plain",sD=!1,sj=function(e,t){var n=e.split("#"),i=n[1],r=n[0].split("?"),s=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(function(e){return e.split("=")[0]!==t}).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},sq=function(e,t,n){void 0===n&&(n=!0);var i,r,s,o,a,u=e.split("?"),l=u[0],c=u[1],h=C({},t),d=null!=(a=null==c?void 0:c.split("&").map(function(e){var t,i=e.split("="),r=i[0],s=n&&null!=(t=h[r])?t:i[1];return delete h[r],r+"="+s}))?a:[],v=(void 0===i&&(i="&"),o=[],iv(h,function(e,t){ef(e)||ef(t)||"undefined"===t||(r=encodeURIComponent((0,f._)(e,File)?e.name:e.toString()),s=encodeURIComponent(t),o[o.length]=s+"="+r)}),o.join(i));return v&&d.push(v),d.length>0?l+"?"+d.join("&"):l},sH=function(e){if(e.Ji)return e.Ji;var t=e.data,n=e.compression;if(t){if(n===r3){var i,r,s,o,a,u,l,c,h=(i=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new ss(e.length+(e.length>>>1)),i=0,r=function(e){n[i++]=e},s=0;t>s;++s){if(i+5>n.length){var o=new ss(i+8+(t-s<<1));o.set(n),n=o}var a=e.charCodeAt(s);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return sE(n,0,i)}(rM(t)),r={mtime:0},s=0xffffffff,o={p:function(e){for(var t=s,n=0;e.length>n;++n)t=sT[255&t^e[n]]^t>>>8;s=t},d:function(){return 0xffffffff^s}},a=i.length,o.p(i),c=(u=10+(r.filename&&r.filename.length+1||0),l=function(e,t,n,i){var r=e.length,s=new ss(i+r+5*(1+Math.floor(r/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>r)for(var u=0;r>=u;u+=65535){var l=u+65535;r>l?a=sM(o,a,e.subarray(u,l)):(o[u]=!0,a=sM(o,a,e.subarray(u,r)))}else{for(var c=sO[t-1],h=c>>>13,f=8191&c,d=(1<<n)-1,v=new so(32768),p=new so(d+1),g=Math.ceil(n/3),_=2*g,y=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<_)&d},m=new sa(25e3),k=new so(288),b=new so(32),w=0,x=0,E=(u=0,0),S=0,P=0;r>u;++u){var F=y(u),$=32767&u,I=p[F];if(v[$]=I,p[F]=$,u>=S){var R=r-u;if((w>7e3||E>24576)&&R>423){a=sC(e,o,0,m,k,b,x,E,P,u-P,a),E=w=x=0,P=u;for(var M=0;286>M;++M)k[M]=0;for(M=0;30>M;++M)b[M]=0}var C=2,O=0,T=f,N=$-I&32767;if(R>2&&F==y(u-N))for(var A=Math.min(h,R)-1,L=Math.min(32767,u),D=Math.min(258,R);L>=N&&--T&&$!=I;){if(e[u+C]==e[u+C-N]){for(var j=0;D>j&&e[u+j]==e[u+j-N];++j);if(j>C){if(C=j,O=N,j>A)break;var q=Math.min(N,j-2),H=0;for(M=0;q>M;++M){var B=u-N+M+32768&32767,z=B-v[B]+32768&32767;z>H&&(H=z,I=B)}}}N+=($=I)-(I=v[$])+32768&32767}if(O){m[E++]=0x10000000|sd[C]<<18|sv[O];var U=31&sd[C],V=31&sv[O];x+=su[U]+sl[V],++k[257+U],++b[V],S=u+C,++w}
1else m[E++]=e[u],++k[e[u]]}}a=sC(e,o,!0,m,k,b,x,E,P,u-P,a)}return sE(s,0,i+sx(a)+8)}(i,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+r.mem,u)).length,function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&sN(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;n.length>=i;++i)e[i+10]=n.charCodeAt(i)}}(l,r),sN(l,c-8,o.d()),sN(l,c-4,a),l);return{contentType:sL,body:h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),estimatedSize:h.byteLength}}if(n===r5){var f,d,v="data="+encodeURIComponent("string"==typeof(d=(f=rM(t))?btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})):f)?d:rM(d));return{contentType:"application/x-www-form-urlencoded",body:v,estimatedSize:new Blob([v]).size}}var p=rM(t);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}}},sB=function(e){var t,n,i=function(){return"sendBeacon"===e.transport?{url:sq(e.url,{compression:r5}),encodedBody:sH(C({},e,{compression:r5,Ji:void 0}))}:{url:sj(e.url,"compression"),encodedBody:sH(C({},e,{compression:void 0,Ji:void 0}))}};try{t=sH(e)}catch(t){if(J(e.compression,rO(e.url,"compression")))return nr.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return!(t&&J(e.compression,rO(e.url,"compression")))||((0,f._)(n=t.body,ArrayBuffer)?G(new Uint8Array(n)):ArrayBuffer.isView(n)&&G(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?{url:e.url,encodedBody:t}:(sD=!0,i())},sz=function(e){try{return sB(e)}catch(t){return nr.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},sU=(t=M(function(e){var t,n;return(0,p._)(this,function(i){switch(i.label){case 0:return[4,function(e,t,n){return X.apply(this,arguments)}(rM(e.data),I.DEBUG,{rethrow:!0})];case 1:if(!(t=i.sent()))return[2,e];return[4,t.arrayBuffer()];case 2:return n=i.sent(),[2,C({},e,{Ji:{contentType:sL,body:n,estimatedSize:n.byteLength}})]}})}),function(e){return t.apply(this,arguments)}),sV=/Failed to fetch|NetworkError|Load failed/i,sW=function(e){return"TypeError"===(null==e?void 0:e.name)&&sV.test((null==e?void 0:e.message)||"")},sG=function(e){var t=sz(e);if(t){var n,i=t.url,r=t.encodedBody,s=null!=r?r:{},o=s.contentType,a=s.body,u=s.estimatedSize,l=new Headers;iv(e.headers,function(e,t){l.append(t,e)}),o&&l.append("Content-Type",o);var c=null,h=!1;if(x){var f=new x;c={signal:f.signal,timeout:setTimeout(function(){var t,n;h=!0,f.abort(((n=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",n))},e.timeout)}}var d=function(t){h&&"AbortError"===(null==t?void 0:t.name)||sW(t)?nr.warn(t):nr.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{b(i,C({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&!e.Yi&&52428.8>(u||0),body:a,signal:null==(n=c)?void 0:n.signal},e.fetchOptions)).then(function(t){return t.text().then(function(n){var i={statusCode:t.status,text:n};if(200===t.status)try{i.json=JSON.parse(n)}catch(e){nr.error(e)}null==e.callback||e.callback(i)})}).catch(d).finally(function(){return c?clearTimeout(c.timeout):null})}catch(e){c&&clearTimeout(c.timeout),d(e)}}},sJ=function(e){try{var t,n=sB(e),i=n.url,r=n.encodedBody,s=null!=r?r:{},o=s.body,a=s.estimatedSize;if(!o)return;var u=(0,f._)(o,Blob)?o:new Blob([o],{type:s.contentType});if(y.sendBeacon(i,u))return;var l=eu(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(eu(l)&&l.length>1&&(null!=a?a:0)>16384){var c=Math.ceil(l.length/2),h=function(t){return eu(e.data)?t:C({},e.data,{batch:t})};return sJ(C({},e,{data:h(l.slice(0,c))})),void sJ(C({},e,{data:h(l.slice(c))}))}nr.warn("Beacon of ~"+(null!=a?a:0)+" bytes was rejected by the browser, falling back to fetch"),sG(C({},e,{Yi:!0}))}catch(e){nr.warn("Beacon send failed",e)}},sK=function(e,t,n,i){var r="query"===i?"POST"===t?"sent_at":"_":void 0;return sq(n===r3?sj(e,"compression"):e,C({},r?(0,c._)({},r,Date.now().toString()):{},n===r3?{}:{compression:n}))},sY=[];b&&sY.push({transport:"fetch",method:sG}),w&&sY.push({transport:"XHR",method:function(e){var t=sz(e);if(t){var n=new w,i=t.encodedBody;n.open(e.method||"GET",t.url,!0);var r=null!=i?i:{},s=r.contentType,o=r.body;iv(e.headers,function(e,t){n.setRequestHeader(t,e)}),s&&n.setRequestHeader("Content-Type",s),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=function(){if(4===n.readyState){var t={statusCode:n.status,text:n.responseText};
1if(200===n.status)try{t.json=JSON.parse(n.responseText)}catch(e){}null==e.callback||e.callback(t)}},n.send(o)}}}),null!=y&&y.sendBeacon&&sY.push({transport:"sendBeacon",method:sJ});var sQ=function(){function e(t,n){(0,u._)(this,e),this.Xi=!0,this.tr=[],this.er=e$((null==n?void 0:n.flush_interval_ms)||3e3,250,5e3,nr.createLogger("flush interval"),3e3),this.ir=t}return(0,l._)(e,[{key:"enqueue",value:function(e){this.tr.push(e),this.rr||this.nr()}},{key:"unload",value:function(){var e=this;this.sr();var t=Object.values(this.tr.length>0?this.ar():{});(0,d._)(t.filter(function(e){return 0===e.url.indexOf("/e")})).concat((0,d._)(t.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(t){e.lr(C({},t,{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.Xi=!1,this.nr()}},{key:"nr",value:function(){var e=this,t=this;this.Xi||(this.rr=setTimeout(function(){if(e.sr(),e.tr.length>0){var n=e.ar();for(var i in n)!function(){var e=n[i],r=(new Date).getTime();e.data&&eu(e.data)&&iv(e.data,function(e){e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),t.lr(e)}()}},this.er))}},{key:"lr",value:function(e){try{this.ir(e)}catch(e){nr.error(e)}}},{key:"sr",value:function(){clearTimeout(this.rr),this.rr=void 0}},{key:"ar",value:function(){var e={};return iv(this.tr,function(t){var n,i=(t?t.batchKey:null)||t.url;ef(e[i])&&(e[i]=C({},t,{data:[]})),null==(n=e[i].data)||n.push(t.data)}),this.tr=[],e}}]),e}(),sX=["retriesPerformedSoFar"],sZ=function(){function e(t){var n=this;(0,u._)(this,e),this.ur=!1,this.hr=3e3,this.tr=[],this._instance=t,this.tr=[],this.dr=!0,!ef(g)&&"onLine"in g.navigator&&(this.dr=g.navigator.onLine,this.vr=function(){n.dr=!0,n.cr()},this.pr=function(){n.dr=!1},ib(g,"online",this.vr),ib(g,"offline",this.pr))}return(0,l._)(e,[{key:"length",get:function(){return this.tr.length}},{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=O(e,sX);ey(n)&&(i.url=sq(i.url,{retry_count:n})),this._instance._send_request(C({},i,{callback:function(e){if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=n?n:0))return void t.At(C({retriesPerformedSoFar:n},i));0===e.statusCode&&nr.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!=n?n:0)+" retries.")}null==i.callback||i.callback(e)}}))}},{key:"At",value:function(e){var t,n,i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var r=Math.ceil((n=Math.min(18e5,t=3e3*Math.pow(2,i)))+(Math.random()-.5)*(n-t/2)),s=Date.now()+r;this.tr.push({retryAt:s,requestOptions:e});var o="Enqueued failed request for retry in "+r;navigator.onLine||(o+=" (Browser is offline)"),nr.warn(o),this.ur||(this.ur=!0,this.gr())}},{key:"gr",value:function(){var e=this;(this.mr&&clearTimeout(this.mr),0===this.tr.length)?(this.ur=!1,this.mr=void 0):this.mr=setTimeout(function(){e.dr&&e.tr.length>0&&e.cr(),e.gr()},this.hr)}},{key:"cr",value:function(){var e=Date.now(),t=[],n=this.tr.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.tr=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value;this.retriableRequest(u.requestOptions)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}}},{key:"unload",value:function(){var e=!0,t=!1,n=void 0;try{for(var i,r=(this.mr&&(clearTimeout(this.mr),this.mr=void 0),this.ur=!1,ef(g)||(this.vr&&(g.removeEventListener("online",this.vr),this.vr=void 0),this.pr&&(g.removeEventListener("offline",this.pr),this.pr=void 0)),this.tr)[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request(C({},s,{transport:"sendBeacon"}))}catch(e){nr.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.tr=[]}}]),e}(),s0=function(){function e(t){var n=this;(0,u._)(this,e),this.yr=function(){n.br||(n.br={});var e,t,i,r,s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,u=o+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;n.br.lastScrollY=Math.ceil(o),n.br.maxScrollY=Math.max(o,null!=(e=n.br.maxScrollY)?e:0),n.br.maxScrollHeight=Math.max(a,null!=(t=n.br.maxScrollHeight)?t:0),n.br.lastContentY=u,n.br.maxContentY=Math.max(u,null!=(i=n.br.maxContentY)?i:0),n.br.maxContentHeight=Math.max(l,null!=(r=n.br.maxContentHeight)?r:0)},this._instance=t}return(0,l._)(e,[{key:"_r",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.br}},{key:"resetContext",value:function(){var e=this.br;return setTimeout(this.yr,0),e}},{key:"startMeasuringScrollPosition",value:function(){ib(g,"scroll",this.yr,{capture:!0}),ib(g,"scrollend",this.yr,{capture:!0}),ib(g,"resize",this.yr)}},{key:"scrollElement",value:function(){if(!this._r)return null==g?void 0:g.document.documentElement;var e=eu(this._r)?this._r:[this._r],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value,a=null==g?void 0:g.document.querySelector(o);if(a)return a}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"wr",value:function(e){if(this._r){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return g?"y"===e?g.scrollY||g.pageYOffset||g.document.documentElement.scrollTop||0:g.scrollX||g.pageXOffset||g.document.documentElement.scrollLeft||0:0}},{key:"scrollY",value:function(){return this.wr("y")}},{key:"scrollX",value:function(){return this.wr("x")}}]),e}(),s1=function(e){return rK(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes
1)},s2=function(){function e(t,n,i,r){var s=this;(0,u._)(this,e),this.kr=function(e){var t=s.Sr();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.Cr(s._instance)};s.Mr.register((0,c._)({},nX,n))}},this._instance=t,this.Tr=n,this.Mr=i,this.Cr=r||s1,this.Tr.onSessionId(this.kr)}return(0,l._)(e,[{key:"Sr",value:function(){return this.Mr.props[nX]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.Sr())?void 0:e.props;return t?"r"in t?rY(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}},{key:"getSessionProps",value:function(){var e={};return iv(im(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_"+ei(n)]=t}),e}}]),e}(),s3=function(){function e(){(0,u._)(this,e),this.Er={}}return(0,l._)(e,[{key:"on",value:function(e,t){var n=this;return this.Er[e]||(this.Er[e]=[]),this.Er[e].push(t),function(){n.Er[e]=n.Er[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=(this.Er[e]||[])[Symbol.iterator]();!(n=(s=o.next()).done);n=!0)(0,s.value)(t)}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var a=!0,u=!1,l=void 0;try{for(var c,h=(this.Er["*"]||[])[Symbol.iterator]();!(a=(c=h.next()).done);a=!0)(0,c.value)(e,t)}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}}}]),e}(),s5=ns("[SessionId]"),s4=function(){function e(t,n,i){var r,s=this;if((0,u._)(this,e),this.Pr=null,this.Rr=[],this.Ar=void 0,this.Fr=!1,this.Ir=new s3,this.Lr=function(e,t){return!(!ey(e)||!ey(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===it)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ne=t.config,this.Mr=t.persistence,this.Or=void 0,this.Dr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.$r=n||iO,this.Nr=i||iO;var o=this.Ne.persistence_name||this.Ne.token;if(this._sessionTimeoutMs=1e3*e$(this.Ne.session_idle_timeout_seconds||1800,60,36e3,s5.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.qr(),this.jr="ph_"+o+"_window_id",this.Br="ph_"+o+"_primary_window_exists",this.Hr()){var a=iU.H(this.jr),l=iU.H(this.Br);a&&!l?this.Or=a:iU.q(this.jr),iU.F(this.Br,!0)}if(null!=(r=this.Ne.bootstrap)&&r.sessionID)try{var c=function(){var e=s.Ne.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw Error("Not a valid UUID");if("7"!==e[12])throw Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)}();this.Ur(this.Ne.bootstrap.sessionID,(new Date).getTime(),c)}catch(e){s5.error("Invalid sessionID in bootstrap",e)}this.zr()}return(0,l._)(e,[{key:"on",value:function(e,t){return this.Ir.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return ef(this.Rr)&&(this.Rr=[]),this.Rr.push(e),this.Dr&&e(this.Dr,this.Or),function(){t.Rr=t.Rr.filter(function(t){return t!==e})}}},{key:"Hr",value:function(){return"memory"!==this.Ne.persistence&&!this.Mr.xi&&iU.N()}},{key:"Wr",value:function(e){e!==this.Or&&(this.Or=e,this.Hr()&&iU.F(this.jr,e))}},{key:"Vr",value:function(){return this.Or?this.Or:this.Hr()?iU.H(this.jr):null}},{key:"Zr",value:function(e){var t=this.Pr;return!ep(t)&&!ep(e)&&5e3>Math.abs(e-t)}},{key:"Ur",value:function(e,t,n){var i=t!==this._sessionActivityTimestamp,r=e===this.Dr&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Dr=e,r&&!i||r&&this.Zr(t)||(this.Pr=t,this.Mr.register((0,c._)({},n$,[t,e,n])))}},{key:"Gr",value:function(){var e,t=null==(e=this.Ne)?void 0:e.persistence_save_debounce_ms;return ey(t)&&t>0}},{key:"Qr",value:function(){this.Gr()?this.Mr.refreshKey(n$):(this.Mr.flush(),this.Mr.load())}},{key:"Kr",value:function(){var e;if(!ep(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Pr){this.Qr();var t=this.Jr();t[1]===this.Dr&&t[2]===this._sessionStartTimestamp&&(this.Pr=this._sessionActivityTimestamp,this.Mr.register((0,c._)({},n$,[this._sessionActivityTimestamp,null!=(e=this.Dr)?e:null,this._sessionStartTimestamp])),this.Mr.flush())}}},{key:"Yr",value:function(){var e=this.Jr()[0];return Math.max(ey(e)?e:0,ey(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}},{key:"Xr",value:function(e){return this.Qr(),this.Lr(e,this.Yr())}},{key:"Jr",value:function(){var e=this.Mr.props[n$];return eu(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.Pr=null,clearTimeout(this.tn),this.tn=void 0,this.Ur(null,null,null)}},{key:"destroy",value:function(){this.Fr=!0,this.Kr(),clearTimeout(this.tn),this.tn=void 0,this.Ar&&g&&(g.removeEventListener(ia,this.Ar,{capture:!1}),this.Ar=void 0),this.Rr=[]}},{key:"zr",value:function(){var e=this;this.Ar=function(){e.Kr(),e.Hr()&&iU.q(e.Br)}
1,ib(g,ia,this.Ar,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Ne.cookieless_mode===it)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var n=t||(new Date).getTime(),i=this.Jr(),r=i[1],s=i[2],o=this.Yr(),a=this.Vr(),u=ey(s)&&Math.abs(n-s)>864e5,l=!1,c=!1,h=!r,f=r,d=!h&&!e&&this.Lr(n,o);if(d){(d=this.Xr(n))||s5.info("cross-tab refresh kept the session alive",{sessionId:r});var v=this.Jr();r=v[1],s=v[2]}h||d||u?(r=this.$r(),a=this.Nr(),s5.info("new session ID generated",{sessionId:r,windowId:a,changeReason:{noSessionId:h,activityTimeout:d,sessionPastMaximumLength:u}}),s=n,l=!0):(a||(a=this.Nr(),l=!0),(c=r!==f)&&(s5.info("adopted cross-tab session id",{sessionId:r,windowId:a}),l=!0));var p=ey(o)&&e&&!u?o:n,g=ey(s)?s:(new Date).getTime();this.Wr(a),this.Ur(r,p,g),e||this.qr();var _={noSessionId:h,activityTimeout:d,sessionPastMaximumLength:u,crossTabAdoption:c};return l&&this.Rr.forEach(function(e){return e(r,a,_)}),{sessionId:r,windowId:a,sessionStartTimestamp:g,changeReason:l?_:void 0,lastActivityTimestamp:o}}},{key:"qr",value:function(){var e=this;this.Fr||(clearTimeout(this.tn),this.tn=setTimeout(function(){if(!e.Fr)if(e.Xr((new Date).getTime())){var t=e.Dr;e.resetSessionId(),e.Ir.emit("forcedIdleReset",{idleSessionId:t})}else e.qr()},1.1*this.sessionTimeoutMs))}}]),e}(),s8=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ee(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(function(e){return ee(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver};function s6(){return(s6=M(function(){var e,t,n,i;return(0,p._)(this,function(r){switch(r.label){case 0:if(!(null!=(e=null==y?void 0:y.userAgentData)&&e.getHighEntropyValues))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.getHighEntropyValues(["model"])];case 2:return[2,ed(n=null==(t=r.sent())?void 0:t.model)&&n.length>0?n:void 0];case 3:return i=r.sent(),[2,void nr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)];case 4:return[2]}})})).apply(this,arguments)}var s7=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function s9(e,t,n){return rM({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var oe={exact:function(e,t){return t.some(function(t){return e.some(function(e){return t===e})})},is_not:function(e,t){return t.every(function(t){return e.every(function(e){return t!==e})})},regex:function(e,t){return t.some(function(t){return e.some(function(e){return s7(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!s7(t,e)})})},icontains:function(e,t){return t.map(ot).some(function(t){return e.map(ot).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(ot).every(function(t){return e.map(ot).every(function(e){return!t.includes(e)})})},gt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n>parseFloat(e)})})},lt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n<parseFloat(e)})})}},ot=function(e){return e.toLowerCase()};function on(e,t){return!e||Object.entries(e).every(function(e){var n=e[1],i=null==t?void 0:t[e[0]];if(ef(i)||ep(i))return!1;var r=[String(i)],s=oe[n.operator];return!!s&&s(n.values,r)})}var oi="custom",or="i.posthog.com",os=/^\/static\//,oo=function(){function e(t){(0,u._)(this,e),this.en={},this.instance=t}return(0,l._)(e,[{key:"apiHost",get:function(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}},{key:"flagsApiHost",get:function(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}},{key:"uiHost",get:function(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+or,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){return this.en[this.apiHost]||(this.en[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":
1oi),this.en[this.apiHost]}},{key:"rn",value:function(e){if(os.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}},{key:"endpointFor",value:function(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var n=this.rn(t);if(n)return""+n+t}if(this.region===oi)return this.apiHost+t;var i=or+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}]),e}();function oa(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}var ou=ns("[Surveys]"),ol="seenSurvey_",oc=function(e){try{var t=""+ol+(e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){ou.error("Failed to persist survey seen state",e)}},oh=["popover","widget","api"],of={ignoreConditions:!1,ignoreDelay:!1,displayType:se},od=ns("[PostHog ExternalIntegrations]"),ov={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},op=function(){function e(t){(0,u._)(this,e),this._instance=t}return(0,l._)(e,[{key:"ai",value:function(e,t){var n;null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,e,function(e){if(e)return od.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=!0,n=!1,i=void 0;try{for(var r,s=Object.entries(null!=(o=this._instance.config.integrations)?o:{})[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o,a=r.value;!function(){var t,n,i,r=a[0],s=a[1];!s||null!=(t=$.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[r]||e.ai(ov[r],function(){var t;null==(t=$.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[r])||t.start(e._instance)}),!s&&null!=(n=$.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[r]&&(null==(i=$.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[r])||i.stop())}()}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}}]),e}(),og=function(){function e(t,n){(0,u._)(this,e),this.rt=t,this.nn=n,this.sn=new Map,this.an=!1}return(0,l._)(e,[{key:"add",value:function(e){var t=this;return M(function(){var n,i,r;return(0,p._)(this,function(s){switch(s.label){case 0:if(t.an)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.sn.has(e.name))throw Error('Browser extension "'+e.name+'" is already registered');t.sn.set(e.name,e),s.label=1;case 1:if(s.trys.push([1,4,,5]),!(n=e.setup(t.nn)))return[3,3];return[4,n];case 2:s.sent(),s.label=3;case 3:return[3,5];case 4:return i=s.sent(),(r=t.sn.get(e.name)===e)&&t.sn.delete(e.name),t.rt.error('Failed to set up browser extension "'+e.name+'"',i),r&&t.ln(e),[3,5];case 5:return[2]}})})()}},{key:"dispose",value:function(){if(!this.an){this.an=!0;var e=Array.from(this.sn.values()).reverse(),t=!0,n=!1,i=void 0;try{for(var r,s=(this.sn.clear(),e)[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.ln(o)}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}}},{key:"ln",value:function(e){var t=this;try{var n=null==e.dispose?void 0:e.dispose();n&&el(n.then)&&n.then(void 0,function(n){t.rt.error('Failed to dispose browser extension "'+e.name+'"',n)})}catch(t){this.rt.error('Failed to dispose browser extension "'+e.name+'"',t)}}}]),e}(),o_=function(){function e(t){(0,u._)(this,e),this._instance=t}return(0,l._)(e,[{key:"initialize",value:function(){}},{key:"get",value:function(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var n={},i=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value,l=null==t?void 0:t.get_property(u);ef(l)||(n[u]=l)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}},{key:"set",value:function(e,t){var n;null==(n=this._instance.persistence)||n.register("string"==typeof e?(0,c._)({},e,t):e)}},{key:"remove",value:function(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}]),e}(),oy="extensionsRemoteConfig",om=function(){function e(t){var n=this;(0,u._)(this,e),this.an=!1,this.instance=t,this.rt=nr,this.un=t.hn,this.kv=new o_(t),this.onEvent=function(e){return r2(n.instance.on("eventCaptured",function(t){try{e({event:t.event,properties:t.properties})}catch(e){n.rt.error("Browser extension event listener failed",e)}}))},this.onRemoteConfig=function(e){if(n.an)return r2(function(){});var t=function(t){try{e(t)}catch(e){n.rt.error("Browser extension remote config listener failed",e)}},i=n.instance.dn.on(oy,t);return n.un&&t(n.un),r2(i)},this.vn=new og(nr.createLogger("[BrowserExtensions]"),this)}return(0,l._)(e,[{key:"logger",get:function(){return this.rt}},{key:"distinctId",get:function(){return this.instance.get_distinct_id()}},{key:"anonymousId",get:function(){var e;return null!=(e=this.instance.get_property(nl))?e:this.distinctId}},{key:"deviceId",get:function(){var e=this.instance.get_property(nl);return"string"==typeof e?e:void 0}},{key:"library",get:function(){return{name:I.LIB_NAME,version:I.LIB_VERSION}}},{key:"initialPersonProperties",get:function(){var e,t;return null!=(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())?e:{}}},{key:"groups",get:function(){return this.instance.getGroups()}},{key:"session",get:function(){try{var e,t,n,i,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(n=null==r?void 0:r.windowId)?n:"",sessionStartTimestamp:null!=(i=null==r?void 0:r.sessionStartTimestamp)?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}},{key:"projectToken",get:function(){return this.instance.config.token}},{key:"add",value:function(e){return this.vn.add(e)}},{key:"capture",value:function(e,t,n){var i=this;return M(function(){return(0,p._)(this,function(r){return n?i.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):i.instance.capture(e,t),[2]})})()}},{key:"registerDynamicEventProperties",value:function(e){return r2(this.instance.cn(e))}},{key:"handleRemoteConfig",value:function(e){this.an||(this.un=e,this.instance.dn.emit
1(oy,e))}},{key:"sendRequest",value:function(e,t){var n=this;return M(function(){var i,r,s;return(0,p._)(this,function(o){return void 0===t&&(t={}),r=n.instance.requestRouter.endpointFor(null!=(i=t.target)?i:"api",e),s={method:t.method,url:t.query?sq(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt},[2,"sendBeacon"===t.transport?(n.instance._send_request(s),{statusCode:202}):new Promise(function(e){s.callback=e,n.instance._send_request(s)})]})})()}},{key:"dispose",value:function(){this.an||(this.an=!0,this.vn.dispose())}}]),e}(),ok={},ob=0,ow=function(){},ox='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',oE="Surveys module not available",oS="sanitize_properties is deprecated. Use before_send instead",oP="Invalid value for property_denylist config: ",oF=["token","distinct_id",n4],o$="posthog",oI=!sA&&-1===(null==S?void 0:S.indexOf("MSIE"))&&-1===(null==S?void 0:S.indexOf("Mozilla")),oR=function(e){var t;return C({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!ed(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=ik[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value;if(n===u)return!1}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return!0}(null==m?void 0:m.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ow,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:k&&ed(null==k?void 0:k.search)&&-1!==k.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:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==g||null==(t=g.location)?void 0:t.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:function(e){nr.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:is,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ow},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:re,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)})},oM=[["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"]],oC=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=oM[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value,u=a[0],l=a[1];ef(e[u])||(t[l]=e[u])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=ip({},t,e),h=e.__preview_external_dependency_versioned_paths;return ef(h)||(ef(e.strict_script_versioning)&&(c.strict_script_versioning=!!h),ed(h)&&ef(e.asset_host)&&(c.asset_host=h)),eu(e.property_blacklist)&&(ef(e.property_denylist)?c.property_denylist=e.property_blacklist:eu(e.property_denylist)?c.property_denylist=(0,d._)(e.property_blacklist).concat((0,d._)(e.property_denylist)):nr.error(oP+e.property_denylist)),c},oO=function(){function e(){(0,u._)(this,e),this.__forceAllowLocalhost=!1}return(0,l._)(e,[{key:"fn",get:function(){return this.__forceAllowLocalhost},set:function(e){nr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),oT=function(){function e(){var t,n=this;(0,u._)(this,e),this.webPerformance=new oO,this.mn=!1,this.version=I.LIB_VERSION,this.yn=new Set,this.bn="",this.dn=new s3,this.sn=[],this._n=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oR(),this.SentryIntegration=rS,this.sentryIntegration=function(e){var t;return t=rE(n,e),{name:rx,processEvent:function(e){return t(e)}}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.wn=!1,this.kn=null,this.xn=null,this.Sn=null,this.scrollManager=new s0(this),this.pageViewManager=new rP(this),this.rateLimiter=new sn(this),this.requestRouter=new oo(this),this.consent=new iV(this),this.externalIntegrations=new op(this);var i=null!=(t=e.__defaultExtensionClasses)?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:function(e,t,i){var r=ed(e)?(0,c._)({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=ed(e)?(0,c._)({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return nr.info('send "'+(null==e?void 0:e.event)+'"',e)})}return(0,l._)(e,[{key:"pn",value:function(e,t){if(e){var n=this.sn.indexOf(e);-1!==n&&this.sn.splice(n,1)}return this.sn.push(t),null==t.initialize||t.initialize(),t}},{key:"gn",value:function(){return this.config.cookieless_mode===it||this.config.cookieless_mode===ie&&this.consent.isRejected()}},{key:"decideEndpointWasHit",get:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}},{key:"flagsEndpointWasHit",get:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}},{key:"init",value:function(t,n,i){if(i&&i!==o$){var r,s=null!=(r=ok[i])?r:new e;return s._init(t,n,i),ok[i]=s,ok[o$][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e,t,n){var i=this;void 0===t&&(t={});var r,s,o,a=ed(e)?e.trim():"";if(!a)return nr.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=oR(t.defaults),t.debug=this.Cn(t.debug),this.Mn=t,this.Tn=[],t.person_profiles?this.xn=t.person_profiles:t.process_person&&(this.xn=t.process_person);var u=oR(t.defaults),l=oC(t),h=ip({},u,l,{name:n,token:a});ec(u.rageclick)&&ec(l.rageclick)&&(h.rageclick=ip({},u.rageclick,l.rageclick)),ec(u.session_recording)&&ec(l.session_recording)&&(h.session_recording=ip({},u.session_recording,l.session_recording)),this.set_config(h),this.config.on_xhr_error&&nr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:r3;var f=this.En();if(this.persistence=new r1(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new r1(C({},this.config,{persistence:"sessionStorage"}),f,!1),this.bn="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&iU.N()){var d=iU.H(this.bn
1);eu(d)&&d.forEach(function(e){ed(e)&&i.yn.add(e)})}else iU.q(this.bn);var v=C({},this.persistence.props),p=C({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.In=new sQ(function(e){return i.Pn(e)},this.config.request_queue_config),this.Rn=new sZ(this),this.__request_queue=[];var _=this.gn();if(_||(this.sessionManager=new s4(this),this.sessionPropsManager=new s2(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(function(e,t,n){(null!=n&&n.activityTimeout||null!=n&&n.sessionPastMaximumLength||null!=n&&n.crossTabAdoption)&&i.An()})),this.Fn(),this.config.__preview_deferred_init_extensions?(nr.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){i.Ln(_)},0)):(nr.info("Initializing extensions synchronously"),this.Ln(_)),I.DEBUG=I.DEBUG||this.config.debug,I.DEBUG&&nr.info("Starting in debug mode",{this:this,config:t,thisC:C({},this.config),p:v,s:p}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=C({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var y=t.bootstrap.distinctID,m=this.get_distinct_id(),k=this.persistence.get_property(nQ);if(t.bootstrap.isIdentifiedID&&null!=m&&m!==y&&k===ii)this.identify(y);else if(t.bootstrap.isIdentifiedID&&null!=m&&m!==y&&k===ir)nr.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 b=this.config.get_device_id(iO()),w=t.bootstrap.isIdentifiedID?b:y;this.persistence.set_property(nQ,t.bootstrap.isIdentifiedID?ir:ii),this.register({distinct_id:y,$device_id:w})}}if(_)this.register_once({distinct_id:n5,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(iO());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(nQ,ii)}return ib(g,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var n=e.config.segment;if(!n)return t();!function(e,t){var n=e.config.segment;if(!n)return t();var i=function(n){var i=function(){return n.anonymousId()||iO()};e.config.get_device_id=i,n.id()&&(e.register({distinct_id:n.id(),$device_id:i()}),e.persistence.set_property(nQ,ir)),t()},r=n.user();"then"in r&&el(r.then)?r.then(i):i(r)}(e,function(){var i;n.register(("u">typeof Promise&&Promise.resolve||rw.warn("This browser does not have Promise support, and can not use the segment integration"),i=function(t,n){if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(rw.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(rw.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return i(e,e.event.event)},page:function(e){return i(e,iu)},identify:function(e){return i(e,ic)},screen:function(e){return i(e,"$screen")}})).then(function(){t()})})}(this,function(){return i.On()}):this.On(),el(this.config._onCapture)&&this.config._onCapture!==ow&&(nr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return i.config._onCapture(e.event,e)})),this.config.ip&&nr.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 s6.apply(this,arguments)})().then(function(e){e&&i.register((0,c._)({},nc,e))}).catch(ow),this}},{key:"Fn",value:function(){var t,n,i,r,s,o,a=this,u=null!=(t=null==(n=this.config.__extensionClasses)?void 0:n.featureFlags)?t:null==(i=e.__defaultExtensionClasses)?void 0:i.featureFlags;u&&(this.featureFlags&&(0,f._)(this.featureFlags,u)||(null==(r=this.Dn)||r.call(this),this.Dn=void 0,this.featureFlags=new u(this)),el(this.featureFlags.onReloading)&&el(this.featureFlags.setup)?this.Dn||(this.Dn=this.featureFlags.onReloading(function(){a.dn.emit("featureFlagsReloading",!0)}),this.$n().add(this.featureFlags)):null==(s=(o=this.featureFlags).initialize)||s.call(o))}},{key:"Ln",value:function(t){var n,i,r,s,o,a,u,l=this,c=performance.now(),h=C({},e.__defaultExtensionClasses,this.config.__extensionClasses),f=[];h.exceptions&&this.sn.push(this.exceptions=null!=(n=this.exceptions)?n:new h.exceptions(this)),h.historyAutocapture&&this.sn.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.sn.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.sn.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.sn.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||f.push(function(){l.
1scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.sn.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.sn.push(this.surveys=null!=(i=this.surveys)?i:new h.surveys(this)),h.logs&&this.sn.push(this.logs=null!=(r=this.logs)?r:new h.logs(this)),h.metrics&&this.sn.push(this.metrics=null!=(s=this.metrics)?s:new h.metrics(this)),h.conversations&&this.sn.push(this.conversations=null!=(o=this.conversations)?o:new h.conversations(this)),h.productTours&&this.sn.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.sn.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.sn.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.sn.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.sn.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,rk)),h.toolbar&&this.sn.push(this.toolbar=null!=(a=this.toolbar)?a:new h.toolbar(this)),h.experiments&&this.sn.push(this.experiments=null!=(u=this.experiments)?u:new h.experiments(this)),this.sn.forEach(function(e){e.initialize&&f.push(function(){null==e.initialize||e.initialize()})}),f.push(function(){if(l.Nn){var e=l.Nn;l.Nn=void 0,l.sn.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}}),this.qn(f,c)}},{key:"qn",value:function(e,t){for(var n,i=this;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(function(){i.qn(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){nr.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session((n={},(0,c._)(n,n8,this.config.__preview_deferred_init_extensions?"deferred":"synchronous"),(0,c._)(n,n6,s),n)),this.config.__preview_deferred_init_extensions&&nr.info("PostHog extensions initialized ("+s+"ms)")}},{key:"Zi",value:function(e){var t=this;if(!m||!m.body)return nr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){t.Zi(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Nn=e),this.hn=e,this.compression=void 0,e.ok){var n,i,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=et(r.supportedCompression,r3)?r3:et(r.supportedCompression,r5)?r5:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.xn?this.xn:is}),null==(n=this.jn)||n.handleRemoteConfig(e),this.sn.forEach(function(t){return null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)})}},{key:"On",value:function(){var e=this;try{this.config.loaded(this)}catch(e){nr.critical("`loaded` function failed",e)}if(this.Bn(),this.config.internal_or_test_user_hostname&&null!=k&&k.hostname){var t=k.hostname,n=this.config.internal_or_test_user_hostname;("string"==typeof n?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(function(){(e.consent.isOptedIn()||e.gn())&&e.Hn()},1),this.Un=new sr(this),this.Un.load()}},{key:"Bn",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.In)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&id(this.__request_queue,function(t){return e.Pn(t)}),this.__request_queue=[],this.Bn()}},{key:"_handle_unload",value:function(){var e,t,n,i,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this.zn()&&this.capture(il),null==(n=this.logs)||n.flushLogs("sendBeacon"),null==(i=this.In)||i.unload(),null==(r=this.Rn)||r.unload()):this.zn()&&this.capture(il,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t=this;this.__loaded?oI?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=C({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(ef(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var t,n,i,r,s,o=C({},e);o.timeout=o.timeout||6e4;var a,u,l,c,h,f=null!=(i=o.transport)?i:"fetch";"sendBeacon"===f&&ef(o.compression)&&o.data&&(o.compression=r5),"POST"===o.method&&o.data&&("capture-body"===o.timestampMode?o.data={api_key:null!=(u=null==(h=(c=eu(a=o.data)?a:[a])[0])||null==(l=h.properties)?void 0:l.token)?u:null==h?void 0:h.token,batch:c,sent_at:(new Date).toISOString()}:"body"===o.timestampMode&&(t=o.data,void 0===n&&(n=(new Date).toISOString()),o.data=eu(t)?t.map(function(e){return C({},e,{sent_at:n})}):C({},t,{sent_at:n}))),o.url=sK(o.url,o.method,o.compression,o.timestampMode);var d=sY.filter(function(e){return!o.disableTransport||!e.transport||!o.disableTransport.includes(e.transport)}
1),p=null!=(r=null==(s=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===f)return e[t]}(d))?void 0:s.method)?r:d[0].method;if(!p)throw Error("No available transport method");var g=function(e){try{p(e)}catch(e){sW(e)?nr.warn(e):nr.error(e),null==o.callback||o.callback({statusCode:0,error:e})}};"sendBeacon"!==f&&o.data&&o.compression===r3&&E&&"u">typeof Promise&&!sD?sU(o).then(function(e){g(e)}).catch(function(t){K(t)?(sD=!0,g(C({},o,{compression:void 0,url:sK(e.url,e.method,void 0,e.timestampMode)}))):(function(e){if(!e||"object"!=(void 0===e?"undefined":(0,v._)(e)))return!1;var t="name"in e?String(e.name):"";return K(e)||t===W}(t)&&(sD=!0),g(o))}):p(o)}(C({},e,{callback:function(n){var i,r;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null==(i=(r=t.config).on_request_error)||i.call(r,n),null==e.callback||e.callback(n)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}},{key:"Pn",value:function(e){this.Rn?this.Rn.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;ob++;try{var n,i=[],r=[],s=[];id(e,function(e){if(e)if(eu(n=e[0]))s.push(e);else if(el(e))try{e.call(t)}catch(t){nr.error("Error executing queued PostHog call",e,t)}else eu(e)&&"alias"===n?i.push(e):eu(e)&&-1!==n.indexOf("capture")&&el(t[n])?s.push(e):r.push(e)});var o=function(e,t){id(e,function(e){try{if(eu(e[0])){var n=t;iv(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){nr.error("Error executing queued PostHog call",e,t)}})};o(i,this),o(r,this),o(s,this)}finally{ob--}}},{key:"push",value:function(t){if(ob>0&&eu(t)&&ed(t[0])){var n=e.prototype[t[0]];el(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}},{key:"capture",value:function(e,t,n){var i,r,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.In){if(this.is_capturing())if(!ef(e)&&ed(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var l=null!=n&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=t&&t.$current_url&&!ed(null==t?void 0:t.$current_url)&&(nr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=n&&n.Wn||nr.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h,f,d,v,p=new Date,g=(null==n?void 0:n.timestamp)||p,_=tE(null==n?void 0:n.uuid,iO),y={uuid:_,event:e,properties:this.calculateEventProperties(e,t||{},g,_)};e===iu&&this.config.__preview_capture_bot_pageviews&&u&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),l&&(y.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var m="$feature_flag_called"===e&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(nA);(null==n?void 0:n.$set)&&!m&&(y.$set=null==n?void 0:n.$set);var k=null==n?void 0:n.$unset;k&&(y.$unset=k);var b,w,x,E=m?void 0:this.Vn(null==n?void 0:n.$set_once,e!==ih,e===ic);if(E&&(y.$set_once=E),null!=n&&n._noTruncate||(r=this.config.properties_string_max_length,s=y,o=function(e){return ed(e)?e.slice(0,r):e},a=new Set,y=function e(t,n){if(t!==Object(t))return o?o(t):t;if(!a.has(t)){var i;if(a.add(t),eu(t))i=[],id(t,function(t){i.push(e(t))});else{var r={};iv(t,function(t,n){a.has(t)||(r[n]=e(t,n))}),i=r}return i}}(s)),y.timestamp=g,ef(null==n?void 0:n.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=p),m&&(y.properties=(h=y.properties,void 0===(f=oF)&&(f=[]),d={},v=function(e){void 0!==h[e]&&(d[e]=h[e])},H.forEach(v),f.forEach(v),d)),e===r7||e===r9){var S=null==t?void 0:t.$survey_id,P=null==t?void 0:t.$survey_iteration;oc({id:S,current_iteration:P}),y.$set=C({},y.$set,(0,c._)({},(b={id:S,current_iteration:P},x="$survey_"+(w=e===r9?"responded":"dismissed")+"/"+b.id,b.current_iteration&&b.current_iteration>0&&(x="$survey_"+w+"/"+b.id+"/"+b.current_iteration),x),!0))}else e===r6&&(y.$set=C({},y.$set,(0,c._)({},"$survey_last_seen_date",(new Date).toISOString())));if("product tour shown"===e){var F=null==t?void 0:t.$product_tour_type;F&&(y.$set=C({},y.$set,(0,c._)({},"$product_tour_last_seen_date/"+F,(new Date).toISOString())))}var $=C({},y.properties.$set,y.$set);if(eh($)||this.setPersonPropertiesForFlags($),!eg(this.config.before_send)){var I=this.Pt(y);if(!I)return;(y=I).uuid=tE(y.uuid,iO)}this.dn.emit("eventCaptured",y);var R=null!=(i=null==n?void 0:n._url)?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M={method:"POST",url:R,data:y,compression:"best-available",timestampMode:"recordings"===(null==n?void 0:n._batchKey)||/\/s\/(?:\?|$)/.test(R)?"body":"capture-body",batchKey:null==n?void 0:n._batchKey,transport:null==n?void 0:n.transport};return!this.config.request_batching||n&&(null==n||!n._batchKey)||null!=n&&n.send_instantly?this.Pn(M):this.In.enqueue(M),y}nr.critical("This capture call is ignored due to client rate limiting.")}}else nr.error("No event name provided to posthog.capture")}else nr.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",function(t){return e(t.event,t)})}},{key:"$n",value:function(){var e;return null!=(e=this.jn)?e:this.jn=new om(this)}},{key:"cn",value:function(e){var t=this;this._n.push(e);var n=!0;return function(){if(n){n=!1;var i=t._n.indexOf(e);-1!==i&&t._n.splice(i,1)}}}},{key:"calculateEventProperties",value:function(e,t,n,i,r){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var s=r?void 0:this.persistence.remove_event_timer(e),o=C({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.gn()&&(o[n4]=!0),"$
1snapshot"===e){var a=C({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!ed(o.distinct_id)&&!e_(o.distinct_id)||ev(o.distinct_id))&&nr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,l=function(e,t,n,i){if(void 0===i&&(i=!1),!S)return{};var r,s,o,a,u,l=e?(0,d._)(rj).concat((0,d._)(t||[])):[],c=function(e){for(var t=0;tb.length>t;t++){var n=tb[t],i=n[1],r=n[0].exec(e),s=r&&(el(i)?i(r,e):i);if(s)return s}return["",""]}(S),h=c[0],f=c[1],v=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};ef(n)||(p.detectGoogleSearchApp=n);var _={},y=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,m=null==(s=navigator)?void 0:s.maxTouchPoints,b=null==g||null==(o=g.screen)?void 0:o.width,w=null==g||null==(a=g.screen)?void 0:a.height,x=null==g?void 0:g.devicePixelRatio;ef(y)||(_.userAgentDataPlatform=y),ef(m)||(_.maxTouchPoints=m),ef(b)||(_.screenWidth=b),ef(w)||(_.screenHeight=w),ef(x)||(_.devicePixelRatio=x);var E,P,F,$,R,M,C=ip(im({$os:h,$os_version:f,$browser:ty(S,navigator.vendor,v,p),$device:tw(S),$device_type:(M=tw(S))===eT||M===eO||"Kobo"===M||"Kindle Fire"===M||M===te?eC:M===eZ||M===e1||M===e0||M===e6?"Console":M===eA?"Wearable":M?eR:"Android"===(null==_?void 0:_.userAgentDataPlatform)&&(null!=(P=null==_?void 0:_.maxTouchPoints)?P:0)>0?600>Math.min(null!=(F=null==_?void 0:_.screenWidth)?F:0,null!=($=null==_?void 0:_.screenHeight)?$:0)/(null!=(R=null==_?void 0:_.devicePixelRatio)?R:1)?eR:eC:"Desktop",$timezone:rQ(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:rT(i?tS(null==k?void 0:k.href):null==k?void 0:k.href,l,rH),$host:null==k?void 0:k.host,$pathname:null==k?void 0:k.pathname,$raw_user_agent:S.length>1e3?S.substring(0,997)+"...":S,$browser_version:tk(S,navigator.vendor,v,p),$browser_language:rW(),$browser_language_prefix:"string"==typeof(E=rW())?E.split("-")[0]:void 0,$screen_height:null==g?void 0:g.screen.height,$screen_width:null==g?void 0:g.screen.width,$viewport_height:null==g?void 0:g.innerHe
1ight,$viewport_width:null==g?void 0:g.innerWidth,$lib:I.LIB_NAME,$lib_version:I.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return I.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=I.SDK_DIST_CHANNEL),C}(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 c=this.sessionManager.checkAndGetSessionAndWindowId(r,n.getTime()),h=c.windowId;o.$session_id=c.sessionId,o.$window_id=h}this.sessionPropsManager&&ip(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&ip(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(x=this.Rn)?void 0:x.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===oi&&(o.$lib_custom_api_host=this.config.api_host),u=e!==iu||r?e!==il||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=ip(o,u),e===iu&&m&&(o.title=m.title),!ef(s)){var f=n.getTime()-s;o.$duration=parseFloat((f/1e3).toFixed(3))}S&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),p=this.sessionPersistence.properties();iv(["$referrer","$referring_domain"],function(e){e in v&&delete p[e]});var _={},y=!0,b=!1,w=void 0;if(this._n.length>0)try{for(var x,E,P=this._n.slice()[Symbol.iterator]();!(y=(E=P.next()).done);y=!0){var F=E.value;try{ip(_,F())}catch(e){nr.error("Failed to produce browser extension event properties",e)}}}catch(e){b=!0,w=e}finally{try{y||null==P.return||P.return()}finally{if(b)throw w}}(o=ip({},l,v,p,C({},_,o))).$is_identified=this._isIdentified(),eu(this.config.property_denylist)?iv(this.config.property_denylist,function(e){delete o[e]}):nr.error(oP+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var $=this.config.sanitize_properties;$&&(nr.error(oS),o=$(o,e));var R=this.Zn();return o.$process_person_profile=R,R&&!r&&this.Gn("_calculate_event_properties"),o}},{key:"Vn",value:function(e,t,n){if(void 0===t&&(t=!0),void 0===n&&(n=!1),!this.persistence||!this.Zn()||this.mn&&!n)return e;var i,r=ip({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),s=this.config.sanitize_properties;return s&&(nr.error(oS),r=s(r,"$set_once")),t&&(this.mn=!0),eh(r)?void 0:r}},{key:"register",value:function(e,t){var n;null==(n=this.persistence)||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var i;null==(i=this.persistence)||i.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t,n=this;null==(t=this.sessionPersistence)||t.register(e),Object.keys(e).forEach(function(e){return n.yn.add(e)}),this.Qn()}},{key:"unregister",value:function(e){var t;null==(t=this.persistence)||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this.yn.delete(e),this.Qn()}},{key:"Kn",value:function(e,t){this.register((0,c._)({},e,t))}},{key:"An",value:function(){var e=this;this.yn.forEach(function(t){var n;null==(n=e.sessionPersistence)||n.unregister(t)}),this.yn.clear(),this.Qn()}},{key:"Qn",value:function(){var e;if(this.bn)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e.xi||!iU.N())iU.q(this.bn);else{var t=[];this.yn.forEach(function(e){return t.push(e)}),t.length>0?iU.F(this.bn,t):iU.q(this.bn)}}},{key:"getFeatureFlag",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}},{key:"getFeatureFlagResult",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlagResult(e,t)}},{key:"getAllFeatureFlags",value:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}},{key:"isFeatureEnabled",value:function(e,t){var n,i;return null!=(n=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))?n:null==t?void 0:t.defaultValue}},{key:"reloadFeatureFlags",value:function(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}},{key:"updateFlags",value:function(e,t,n){var i;
1null==(i=this.featureFlags)||i.updateFlags(e,t,n)}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,n)}},{key:"getEarlyAccessFeatures",value:function(e,t,n){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,n)}},{key:"on",value:function(e,t){return this.dn.on(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),function(){})}},{key:"onSurveysLoaded",value:function(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:oE}),function(){})}},{key:"onSessionId",value:function(e){var t,n;return null!=(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))?t:function(){}}},{key:"getSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:oE})}},{key:"getActiveMatchingSurveys",value:function(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:oE})}},{key:"renderSurvey",value:function(e,t){var n;null==(n=this.surveys)||n.renderSurvey(e,t)}},{key:"displaySurvey",value:function(e,t){var n;void 0===t&&(t=of),null==(n=this.surveys)||n.displaySurvey(e,t)}},{key:"cancelPendingSurvey",value:function(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}},{key:"canRenderSurvey",value:function(e){var t,n;return null!=(t=null==(n=this.surveys)?void 0:n.canRenderSurvey(e))?t:{visible:!1,disabledReason:oE}}},{key:"canRenderSurveyAsync",value:function(e,t){var n,i;return void 0===t&&(t=!1),null!=(n=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))?n:Promise.resolve({visible:!1,disabledReason:oE})}},{key:"Jn",value:function(e){return!e||ev(e)?(nr.critical("Unique user id has not been set in posthog.identify"),!1):e===n5?(nr.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(nr.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}},{key:"identify",value:function(e,t,n){if(!this.__loaded||!this.persistence)return nr.uninitializedWarning("posthog.identify");if(e_(e)&&(e=e.toString(),nr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jn(e)&&this.Gn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(nl)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(nh)&&(this.unregister(nh),this.register({distinct_id:e}));var r,s=(this.persistence.get_property(nQ)||ii)===ii,o=e!==i,a=!o&&s;if(o&&s)this.persistence.set_property(nQ,ir),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.capture(ic,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:n||{}}),this.Sn=s9(e,t,n),null==(r=this.featureFlags)||r.setAnonymousDistinctId(i);else if(a){this.persistence.set_property(nQ,ir);var u=t||{},l=n||{};this.setPersonPropertiesForFlags({$set:u,$set_once:l},!1),this.capture("$set",{$set:u,$set_once:l}),this.Sn=s9(e,t,n)}else(t||n)&&this.setPersonProperties(t,n);o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(nG)):a&&(t||n)&&this.reloadFeatureFlags()}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.Gn("posthog.setPersonProperties")){var n=s9(this.get_distinct_id(),e,t);this.Sn!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Sn=n):nr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}},{key:"unsetPersonProperties",value:function(e){var t,n=(eu(e)?e:[e]).filter(function(e){return ed(e)&&e.length>0});0!==n.length&&this.Gn("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.Sn=null)}},{key:"group",value:function(e,t,n){if(e&&t){var i=this.getGroups(),r=i[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:C({},i,(0,c._)({},e,t))}),r||n){var s={$group_type:e,$group_key:t};n&&(s.$group_set=n),this.capture(ih,s)}n&&this.setGroupPropertiesForFlags((0,c._)({},e,n)),r&&!n&&this.reloadFeatureFlags()}else nr.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e,t){var n;void 0===t&&(t=!0),null==(n=this.featureFlags)||n.setPersonPropertiesForFlags(e,t)}},{key:"resetPersonPropertiesForFlags",value:function(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}},{key:"setGroupPropertiesForFlags",value:function(e,t){var n;void 0===t&&(t=!0),this.Gn("posthog.setGroupPropertiesForFlags")&&(null==(n=this.featureFlags)||n.setGroupPropertiesForFlags(e,t))}},{key:"resetGroupPropertiesForFlags",value:function(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){this.Yn(e)}},{key:"Yn",value:function(e,t){if(void 0===t&&(t=!1),nr.info("reset"),!this.__loaded)return nr.uninitializedWarning("posthog.reset");var n,i,r,s,o,a,u,l,h,f,d,v=this.get_property(nl),p=this.get_property(nc),g=this.get_property(nw),_=this.is_capturing();if(this.consent.reset(),t||!_||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."),null==(n=this.persistence)||n.clear(),null==(i=this.sessionPersistence)||i.clear(),this.yn.clear(),this.Qn(),ef(g)||null==(d=this.persistence)||d.register((0,c._)({},nw,g)),null==(r=this.surveys)||r.reset(),null==(s=this.Un)||s.stop(),null==(o=this.featureFlags)||o.reset(),null==(a=this.conversations)||a.reset(),null==(u=this.logs)||u.reset(),null==(l=this.metrics)||l.reset(),null==(h=this.persistence)||h.set_property(nQ,ii),null==(f=this.sessionManager)||f.resetSessionId(),this.Sn=null,this.config.cookieless_mode===it)this.register_once({distinct_id:n5,$device_id:null},"");else{var y=this.config.get_device_id(iO());this.register_once({distinct_id:y,$device_id:e?y:v},""),e||ef(p)||this.register((0,c._)({},nc,p))}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}},{key:"shutdown",value:function(e){var t=this;return M(function(){var e,n,i,r,s,o,a,u;return(0,p._)(this,function(l){if(t.__loaded){null==(e=t.Un)||e.stop(),null==(n=t.jn)||n.dispose(),null==(i=t.sessionRecording)||i.dispose(),null==(r=t.logs)||r.flushLogs("sendBeacon"),null==(s=t.metrics)||s.flush("sendBeacon"),null==(o=t.In)||o.unload(),null==(a=t.Rn)||a.unload();try{null==(u=t.featureFlags)||u.destroy()}catch(e){nr.error("Error while destroying feature flags",e)}}else nr.uninitializedWarning("posthog.shutdown");return[2]})})()}},{key:"setIdentity",value:function(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(n=this.conversations)||n.Xn()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.ts()}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&n){var r,s=null!=(r=e.timestampLookBack)?r:10;if(!n)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-n)/1e3)-s,0)}return i}},{key:"alias",value:function(e,t){return e===this.get_property(nu)?(nr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gn("posthog.alias")?(ef(t)&&(t=this.get_distinct_id()),e!==t?(this.Kn(nh,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(nr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=C({},this.config);if(ec(e)){ip(this.config,oC(e));var n,i,r,s,o,a,u,l,c,h,f,d,v=this.En();null==(n=this.persistence)||n.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new r1(C({},this.config,{persistence:"sessionStorage"}),v,!1);var p=this.Cn(this.config.debug);em(p)&&(this.config.debug=p),em(this.config.debug)&&(this.config.debug?(I.DEBUG=!0,ij.N()&&ij.F("ph_debug",!0),nr.info("set_config",{config:e,oldConfig:t,newConfig:C({},this.config)})):(I.DEBUG=!1,ij.N()&&ij.q("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this.Qi()),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.es(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}},{key:"_overrideSDKInfo",value:function(e,t){I.LIB_NAME=e,I.LIB_VERSION=t}},{key:"startSessionRecording",value:function(e){var t,n,i,r,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!(null==(e=this.sessionRecording)||!e.started)}},{key:"captureException",value:function(e,t){if(this.exceptions){var n=Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(C({},i,t))}}},{key:"addExceptionStep",value:function(e,t){var n;null==(n=this.exceptions)||n.addExceptionStep(e,t)}},{key:"captureLog",value:function(e){var t;null==(t=this.logs)||t.captureLog(e)}},{key:"logger",get:function(){var t,n;return null!=(t=null==(n=this.logs)?void 0:n.logger)?t:e.rs}},{key:"startExceptionAutocapture",value:function(e){this.set_config({capture_exceptions:null==e||e})}},{key:"stopExceptionAutocapture",value:function(){this.set_config({capture_exceptions:!1})}},{key:"loadToolbar",value:function(e){var t,n;return null!=(t=null==(n=this.toolbar)?void 0:n.loadToolbar(e))&&t}},{key:"get_property",value:function(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!=(e=this.config.name)?e:o$;return t!==o$&&(t=o$+"."+t),t}},{key:"_isIdentified",value:function(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(nQ))===ir||(null==(t=this.sessionPersistence)?void 0:t.get_property(nQ))===ir}},{key:"Zn",value:function(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===is&&!this._isIdentified()&&eh(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[nh])&&(null==(t=this.persistence)||null==(t=t.props)||!t[n3]))}},{key:"zn",value:function(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}},{key:"createPersonProfile",value:function(){this.Zn()||this.Gn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.Gn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"Gn",value:function(e){return"never"===this.config.person_profiles?(nr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Kn(n3,!0),!0)}},{key:"En",value:function(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ie)}},{key:"es",value:function(){var e,t,n,i,r=this.En();return(null==(e=this.persistence)?void 0:e.xi)!==r&&(null==(n=this.persistence)||n.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.xi)!==r&&(null==(i=this.sessionPersistence)||i.set_disabled(r)),r&&(this.yn.clear(),this.Qn()),r}},{key:"opt_in_capturing",value:function(t){var n;if(this.config.cookieless_mode!==it){if(this.gn()){this.Yn(!0,!0),null==(s=this.sessionManager)||s.destroy(),null==(o=this.pageViewM
1anager)||o.destroy(),this.sessionManager=new s4(this),this.pageViewManager=new rP(this),this.persistence&&(this.sessionPropsManager=new s2(this,this.sessionManager,this.persistence));var i,r,s,o,a,u,l,c,h=null!=(a=null==(u=this.config.__extensionClasses)?void 0:u.sessionRecording)?a:null==(l=e.__defaultExtensionClasses)?void 0:l.sessionRecording;h&&(this.sessionRecording=this.pn(this.sessionRecording,new h(this)),this.hn&&(null==(c=this.sessionRecording)||null==c.onRemoteConfig||c.onRemoteConfig(this.hn)))}this.consent.optInOut(!0),this.es(),this.Bn(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),this.config.cookieless_mode==ie&&(null==(i=this.surveys)||i.loadIfEnabled()),(ef(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!=(r=null==t?void 0:t.captureEventName)?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Hn()}else nr.warn(ox)}},{key:"opt_out_capturing",value:function(){var e,t,n;this.config.cookieless_mode!==it?(this.config.cookieless_mode===ie&&this.consent.isOptedIn()&&this.Yn(!0,!0),this.consent.optInOut(!1),this.es(),this.config.cookieless_mode===ie&&(this.register({distinct_id:n5,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Hn(),this.Bn())):nr.warn(ox)}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"get_explicit_consent_status",value:function(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}},{key:"is_capturing",value:function(){return this.config.cookieless_mode===it||(this.config.cookieless_mode===ie?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this.es()}},{key:"_is_bot",value:function(){return y?s8(y,this.config.custom_blocked_useragents):void 0}},{key:"Hn",value:function(){m&&("visible"===m.visibilityState?this.wn||(this.wn=!0,this.capture(iu,{title:m.title},{send_instantly:!0}),this.kn&&(m.removeEventListener(io,this.kn),this.kn=null)):this.kn||(this.kn=this.Hn.bind(this),ib(m,io,this.kn)))}},{key:"debug",value:function(e){!1===e?(null==g||g.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==g||g.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}))}},{key:"Qi",value:function(){var e,t,n,i,r=this.Mn||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(nr.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):(t="advanced_disable_decide",n=(e="advanced_disable_flags")in r&&!eg(r[e]),i=t in r&&!eg(r[t]),n?r[e]:!!i&&(nr&&nr.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}},{key:"Pt",value:function(e){if(eg(this.config.before_send))return e;var t=Object.keys(null!=(a=e.properties)?a:{}).filter(ek),n=eu(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e,r=!0,s=!1,o=void 0;try{for(var a,u,l=n[Symbol.iterator]();!(r=(u=l.next()).done);r=!0){if(i=(0,u.value)(i),eg(i)){var c,h="Event '"+e.event+"' was rejected in beforeSend function";return(c=e.event,et(U,c))?nr.warn(h+". This can cause unexpected behavior."):nr.info(h),null}i.properties&&!eh(i.properties)||nr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}var f=!0,d=!1,v=void 0;try{for(var p,g=t[Symbol.iterator]();!(f=(p=g.next()).done);f=!0){var _=p.value;if(i.properties&&eg(i.properties[_]))return nr.warn("Event '"+e.event+"' had its '"+_+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null}}catch(e){d=!0,v=e}finally{try{f||null==g.return||g.return()}finally{if(d)throw v}}return i}},{key:"getPageViewId",value:function(){var e;
1return null==(e=this.pageViewManager.ui)?void 0:e.pageViewId}},{key:"captureTraceFeedback",value:function(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}},{key:"captureTraceMetric",value:function(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}},{key:"Cn",value:function(e){var t=em(e)&&!e,n=ij.N()&&"true"===ij.P("ph_debug");return!t&&(!!n||e)}}]),e}();oT.__defaultExtensionClasses={},oT.rs={trace:n=function(){},debug:n,info:n,warn:n,error:n,fatal:n},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=iy(e.prototype[t[n]])}(oT,["identify"]);var oN=function(){function e(t){(0,u._)(this,e),this.disabled=!1===t;var n=ec(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}return(0,l._)(e,[{key:"isRageClick",value:function(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),oA="$copy_autocapture",oL=ns("[AutoCapture]");function oD(e,t){return t.length>e?t.slice(0,e)+"...":t}var oj=ns("[ExceptionAutocapture]"),oq=function(){},oH=ns("[TracingHeaders]"),oB=ns("[Web Vitals]"),oz="disabled",oU="lazy_loading",oV="awaiting_config",oW="missing_config";ns("[SessionRecording]"),ns("[SessionRecording]");var oG="[SessionRecording]",oJ=ns(oG),oK=ns("[Heatmaps]");function oY(e){return ec(e)&&"clientX"in e&&"clientY"in e&&e_(e.clientX)&&e_(e.clientY)}var oQ=ns("[Product Tours]"),oX=function(e){var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(nk))},oZ=["$set_once","$set"],o0=ns("[SiteApps]"),o1="Error while initializing PostHog app with config id ";function o2(e,t,n){if(eg(e))return!1;switch(n){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var o3=function(){function e(t){var n=this;(0,u._)(this,e),this.ns=new s3,this.ss=function(e,t){return n.os(e,t)&&n.ls(e,t)&&n.us(e,t)&&n.hs(e,t)},this.os=function(e,t){return null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)},this._instance=t,this.ds=new Set,this.vs=new Set}return(0,l._)(e,[{key:"init",value:function(){var e,t,n=this;ef(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook(function(e,t){n.on(e,t)})}},{key:"register",value:function(e){var t=this;if(!ef(null==(n=this._instance)?void 0:n._addCaptureHook)&&(e.forEach(function(e){var n,i;null==(n=t.vs)||n.add(e),null==(i=e.steps)||i.forEach(function(e){var n;null==(n=t.ds)||n.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var n,i,r,s=new Set;e.forEach(function(e){var t;null==(t=e.steps)||t.forEach(function(e){null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}},{key:"on",value:function(e,t){var n,i=this;null!=t&&0!=e.length&&(this.ds.has(e)||this.ds.has(t.event))&&this.vs&&(null==(n=this.vs)?void 0:n.size)>0&&this.vs.forEach(function(e){i.cs(t,e)&&i.ns.emit("actionCaptured",e.name)})}},{key:"fs",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"cs",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n=!0,i=!1,r=void 0;try{for(var s,o=t.steps[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(this.ss(e,a))return!0}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return!1}},{key:"onAction",value:function(e,t){return this.ns.on(e,t)}},{key:"ls",value:function(e,t){if(null!=t&&t.url){var n,i=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!i||"string"!=typeof i||!o2(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"us",value:function(e,t){return!!this.ps(e,t)&&!!this.gs(e,t)&&!!this.ys(e,t)}},{key:"ps",value:function(e,t){if(null==t||!t.href)return!0;var n=this.bs(e);if(n.length>0)return n.some(function(e){return o2(e.href,t.href,t.href_matching||"exact")});var i,r,s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!s&&o2((r=s.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}},{key:"gs",value:function(e,t){if(null==t||!t.text)return!0;var n=this.bs(e);if(n.length>0)return n.some(function(e){return o2(e.text,t.text,t.text_matching||"exact")||o2(e.$el_text,t.text,t.text_matching||"exact")});var i,r,s,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,n=[],i=/(?::|")text="(.*?)"/g;!eg(t=i.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),s=t.text,o=t.text_matching||"exact",r.some(function(e){return o2(e,s,o)}))}},{key:"ys",value:function(e,t){if(null==t||!t.selector)return!0;var n,i,r=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){}return!1}},{key:"bs",value:function(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}},{key:"hs",value:function(e,t){return null==t||!t.properties||0===t.properties.length||on(t.properties.reduce(function(e,t){var n=eu(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}]),e}(),o5=function(e){function t(e){return(0,u._)(this,t),(0,a._)(this,t,[e])}return(0,h._)(t,e),(0,l._)(t,[{key:"Js",value:function(){return nz}},{key:"Ys",value:function(){return nU}},{key:"Ms",value:function(){return nV}},{key:"Ts",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register((0,c._)({},nV,e))}},{key:"Es",value:function(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(nV)}},{key:"Cs",value:function(e){this.As(function(t){n=t.find(function(t){return t.id===e})});var t,n,i=null==(t=n)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return e_(i)&&i>0}},{key:"ra",value:function(){return r6}},{key:"As",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"Bs",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"Ds",value:function(){return ou}},{key:"Ws",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register((0,c._)({},nz,e))}},{key:"Xs",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register((0,c._)({},nU,e))}},{key:"ta",value:function(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(nU)}},{key:"ea",value:function(){return!1}},{key:"$s",value:function(e,t){var n,i,r;return this.As(function(e){r=e.find(function(e){return e.id===t})}),!r||oa(n=r)&&!(null==(i=n.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===n.schedule?e===r6?"consume":"ignore":e===r6?"persist":e===r7||e===r9?"consume":"ignore"}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItems
1Map()}}]),t}(function(){function e(t){var n,i=this;(0,u._)(this,e),this._s=[],this._instance=t,this.ws=new Map,this.ks=new Map,this.xs=new Map,null==(n=this._instance)||null==n.onSessionId||n.onSessionId(function(e){return i.Ss(e)})}return(0,l._)(e,[{key:"Cs",value:function(e){return!1}},{key:"Ms",value:function(){return null}},{key:"Ts",value:function(e){}},{key:"Es",value:function(){}},{key:"Is",value:function(e,t){return!!e&&on(e.propertyFilters,null==t?void 0:t.properties)}},{key:"Ps",value:function(e,t){var n=new Map;return e.forEach(function(e){var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(function(t){if(null!=t&&t.name){var i=n.get(t.name)||[];i.push(e.id),n.set(t.name,i)}})}),n}},{key:"Rs",value:function(e,t,n){var i=this,r=(n===r4?this.ws:this.ks).get(e),s=[];return this.As(function(e){s=e.filter(function(e){return null==r?void 0:r.includes(e.id)})}),s.filter(function(r){var s,o=null==(s=r.conditions)||null==(s=s[n])||null==(s=s.values)?void 0:s.find(function(t){return t.name===e});return i.Is(o,t)})}},{key:"register",value:function(e){var t;ef(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Fs(e),this.Ls(e))}},{key:"Ls",value:function(e){var t=this,n=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0});0!==n.length&&(null==this.Os&&(this.Os=new o3(this._instance),this.Os.init(),this.Os.fs(function(e){t.onAction(e)})),n.forEach(function(e){var n,i,r,s,o;e.conditions&&null!=(n=e.conditions)&&n.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=t.Os)||s.register(e.conditions.actions.values),null==(o=e.conditions)||null==(o=o.actions)||null==(o=o.values)||o.forEach(function(n){if(n&&n.name){var i=t.xs.get(n.name);i&&i.push(e.id),t.xs.set(n.name,i||[e.id])}}))}))}},{key:"Fs",value:function(e){var t,n=this,i=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),r=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t._addCaptureHook(function(e,t){n.onEvent(e,t)}),this.ws=this.Ps(e,r4),this.ks=this.Ps(e,r8))}},{key:"onEvent",value:function(e,t){var n,i,r=this,s=this.Ds(),o=(null==t||null==(n=t.properties)?void 0:n.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.$s(e,o);if("consume"===a)return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this.Ns([o]);if("persist"===a)return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.qs(o),void this.js([o])}if(this.ks.has(e)){var u=this.Rs(e,t,r8);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map(function(e){return e.id})}),this.Ns(u.map(function(e){return e.id})),u.forEach(function(e){return r.Bs(e.id)}))}if(this.ws.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.ws.get(e)});var l=this.Rs(e,t,r4);this.Hs(l.map(function(e){return e.id}))}}},{key:"onAction",value:function(e){this.xs.has(e)&&this.Hs(this.xs.get(e)||[])}},{key:"Hs",value:function(e){var t;if(0!==e.length){var n=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),i=[],r=!0,s=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;n&&this.Cs(l)?this.qs(l)&&this.Us(l):i.push(l)}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}i.length>0&&(this._s=(0,d._)(new Set((0,d._)(this._s).concat((0,d._)(i))))),this.Ds().info("updating activated items",{activatedItems:this.getActivatedIds()})}}},{key:"qs",value:function(e){this._s=this._s.filter(function(t){return t!==e});var t=this.zs();return!t.includes(e)&&(this.Ws((0,d._)(t).concat([e])),this.Vs(),!0)}},{key:"Ns",value:function(e){var t=new Set(e);this._s=this._s.filter(function(e){return!t.has(e)});var n=this.Zs(),i=n.filter(function(e){return!t.has(e)});i.length!==n.length&&(this.Ws(i),0===i.length&&this.Gs()),this.js(e)}},{key:"Qs",value:function(){var e,t=this.Ms();if(!t)return{};var n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return n&&"object"==(void 0===n?"undefined":(0,v._)(n))?n:{}}},{key:"Us",value:function(e){if(this.Ms()){var t=this.Qs();this.Ts(C({},t,(0,c._)({},e,Date.now())))}}},{key:"js",value:function(e){if(this.Ms()){var t=this.Qs(),n={},i=!1,r=!0,s=!1,o=void 0;try{for(var a,u=Object.entries(t)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value,c=l[0],h=l[1];e.includes(c)?i=!0:n[c]=h}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}i&&(eh(n)?this.Es():this.Ts(n))}}},{key:"Ks",value:function(){this.Ms()&&this.Es()}},{key:"getActivationTimestamp",value:function(e){if(this.zs().includes(e)){var t=this.Qs()[e];return e_(t)?t:void 0}}},{key:"Zs",value:function(){var e,t=this.Js();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"zs",value:function(){var e,t,n=this.Zs();if(0===n.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Ys()],r=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return r&&i===r?n:[]}},{key:"Vs",value:function(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this.Xs(t)}},{key:"Gs",value:function(){this.ta()}},{key:"Ss",value:function(e){var t,n=this,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Ys()];if(i&&i!==e){var r=this.Zs(),s=this.Qs();r.length>0&&(this.Ws([]),r.filter(function(e){return e_(s[e])}
1).forEach(function(e){return n.Bs(e)})),this.Gs(),this.Ks()}}},{key:"getActivatedIds",value:function(){var e=this;return(0,d._)(new Set((0,d._)(this.zs()).concat((0,d._)(this._s)))).filter(function(t){return!e.ea(t)})}},{key:"reset",value:function(){this._s=[],this.Zs().length>0&&this.Ws([]),this.Gs(),this.Ks()}},{key:"getEventToItemsMap",value:function(){return this.ws}},{key:"ia",value:function(){return this.Os}}]),e}()),o4="SDK is not enabled or survey functionality is not yet loaded",o8="Disabled. Not loading surveys.",o6=null!=g&&g.location?rN(g.location.hash,"__posthog")||rN(location.hash,"state"):null,o7="_postHogToolbarParams",o9=ns("[Toolbar]"),ae=ns("[FeatureFlags]"),at=function(){function e(t,n){(0,u._)(this,e),void 0===n&&(n=!1),this.na=!1,this.update(t,n)}return(0,l._)(e,[{key:"update",value:function(e,t){var n,i,r,s;this.sa={bootstrap:{featureFlags:null==(n=e.bootstrap)?void 0:n.featureFlags,featureFlagPayloads:null==(i=e.bootstrap)?void 0:i.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?"none":"base64",evaluationContexts:null!=(r=null!=(s=e.evaluation_contexts)?s:e.evaluation_environments)?r:[],flagKeys:eu(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.na||(ae.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.na=!0),ef(e.flag_keys)||eu(e.flag_keys)||ae.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}},{key:"get",value:function(){return this.sa}}]),e}(),an=ns("[FeatureFlags]"),ai=ns("[FeatureFlags]",{debugEnabled:!0}),ar="\" failed. Feature flags didn't load in time.",as="connection_error",ao=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},aa=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=ig(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value,u=a[1];u&&(t[a[0]]=u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},au=ns("[Error tracking]"),al="Refusing to render web experiment since the viewer is a likely bot",ac={icontains:function(e,t){return t.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return -1===t.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return s7(t,e)},not_regex:function(e,t){return!s7(t,e)},exact:function(e,t){return t===e},is_not:function(e,t){return t!==e}},ah=function(){function e(t){var n=this;(0,u._)(this,e);var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments(function(t){e.aa("retrieved web experiments from the server"),i.oa=new Map,t.forEach(function(t){if(t.feature_flag_key){i.oa&&(e.aa("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.oa)||n.set(t.feature_flag_key,t));var n,r=i._instance.getFeatureFlag(t.feature_flag_key);ed(r)&&t.variants[r]&&i.la(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.ua(o,i._instance)&&i.la(t.name,s,o.transforms)}})},t)},this._instance=t,this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return(0,l._)(e,[{key:"Ne",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.aa(al);else if(!this.Ne.disable_web_experiments){if(eg(this.oa))return this.oa=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.aa("applying feature flags",t),t.forEach(function(e){var t;if(n.oa&&null!=(t=n.oa)&&t.has(e)){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.oa)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&n.la(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null!=n&&n.search){var i=rO(null==n?void 0:n.search,"__experiment_id"),r=rO(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.aa("previewing web experiments "+i+" && "+r),this.getWebExperiments(function(e){t.ha(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.Ne.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.Ne.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ne.token),method:"GET",timestampMode:"query",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"ha",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.aa("Previewing web experiment ["+r[0].name+"] with variant ["+n+"]"),this.la(r[0].name,n,r[0].variants[n].transforms))}},{key:"la",value:function(t,n,i){this._is_bot()?e.aa(al):"control"!==n?i.forEac
1h(function(i){if(i.selector){e.aa("applying transform of variant "+n+" for experiment "+t+" ",i);var r,s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(function(e){i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):e.aa("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return y&&this._instance?s8(y,this.Ne.custom_blocked_useragents):void 0}}],[{key:"ua",value:function(t,n){return!eg(t.conditions)&&e.da(t,n)&&e.va(t)}},{key:"da",value:function(t,n){if(eg(t.conditions)||eg(null==(r=t.conditions)?void 0:r.url))return!0;var i=e.getWindowLocation();if(i){var r,s,o,a,u=iW(n,i.href);return null==(s=t.conditions)||!s.url||ac[null!=(o=null==(a=t.conditions)?void 0:a.urlMatchType)?o:"icontains"](t.conditions.url,u)}return!1}},{key:"getWindowLocation",value:function(){return null==g?void 0:g.location}},{key:"va",value:function(e){if(eg(e.conditions)||eg(null==(n=e.conditions)?void 0:n.utm))return!0;var t=rz();if(t.utm_source){var n,i,r,s,o,a,u,l,c,h=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,f=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,d=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_medium)==t.utm_medium,v=null==(l=e.conditions)||null==(l=l.utm)||!l.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&d&&v&&f}return!1}},{key:"aa",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];nr.info("[WebExperiments] "+e,n)}}]),e}(),af=ns("[Conversations]"),ad="Conversations not available yet.",av="console",ap="__posthogHandledLogsRequestError",ag=function(e,t){var n=(0,f._)(e,Error)?e:Error(t);return n[ap]=!0,n},a_=function(e){return!!e&&"object"==(void 0===e?"undefined":(0,v._)(e))&&!0===e[ap]},ay={featureFlags:function(){function e(t){var n=this;(0,u._)(this,e),this.name="featureFlags",this.ca=!1,this.featureFlagEventHandlers=[],this.rt=an,this.fa={},this.pa={},this.ga=[],this.ma=!1,this.ya=!1,this.ba=0,this._a=!1,this.wa=!1,this.ka=!1,this.xa=!1,this.Sa=0,this.Ca=function(){var e=n.Ma();n.Sa=0,e&&n.reloadFeatureFlags()},"get"in t?this.Ta=t:(this.Ea=new at(t.config,t.Qi()),this.Ta=this.Ea)}return(0,l._)(e,[{key:"updateConfig",value:function(e,t){var n;null==(n=this.Ea)||n.update(e,t)}},{key:"setup",value:function(e){var t,n,i=this;return this.Ia=e,this.rt=e.logger.createLogger("[FeatureFlags]"),n=function(){i.Ia===e&&(i.Ia=void 0,i.nn=e,i.Pa(e))},null!=(t=e.kv.initialize())&&t.then?t.then(n):n()}},{key:"Pa",value:function(e){var t=this;if(this.nn===e)return g&&ib(g,"online",this.Ca),this.Ra=e.registerDynamicEventProperties(function(){return t.Aa()?t.fa:t.pa}),this.Fa(),this.initialize()}},{key:"destroy",value:function(){null==g||g.removeEventListener("online",this.Ca)}},{key:"dispose",value:function(){var e;this.ba++,this.wa=!1,this.Ia=void 0,this.nn&&(this.La(),null==(e=this.Ra)||e.dispose(),this.Ra=void 0,this.ga=[],null==g||g.removeEventListener("online",this.Ca),this.nn=void 0)}},{key:"Ne",get:function(){return this.Ta.get()}},{key:"Oa",value:function(e){var t;return null==(t=this.nn)?void 0:t.kv.get(e)}},{key:"F",value:function(e){var t=this;this.Da(function(){var n;return null==(n=t.nn)?void 0:n.kv.set(e)})}},{key:"q",value:function(e){var t=this;this.Da(function(){var n;return null==(n=t.nn)?void 0:n.kv.remove(e)})}},{key:"Da",value:function(e){try{e()}catch(e){this.rt.error("Failed to update feature flag persistence",e)}}},{key:"Fa",value:function(){for(var e={},t=0,n=[nM,nT,nN,nL];t<n.length;t++){var i=n[t],r=this.Oa(i);ef(r)||(e[i]=r)}this.fa=e;var s=C({},e),o=this.Oa(nR),a=!0,u=!1,l=void 0;if(o)try{for(var c,h=Object.entries(o)[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var f=c.value;s["$feature/"+f[0]]=f[1]}}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}this.pa=s}},{key:"Aa",value:function(){var e=this.Ne.cacheTtlMs;
1if(!e||0>=e)return!1;var t=this.Oa(nY);return"number"!=typeof t||Date.now()-t>e}},{key:"$a",value:function(){return!!this.Aa()&&(this.xa||this.ya||(this.xa=!0,this.rt.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"Na",value:function(){var e=this,t=this.Ne.evaluationContexts;return null!=t&&t.length?t.filter(function(t){var n=t&&"string"==typeof t&&t.trim().length>0;return n||e.rt.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}},{key:"qa",value:function(){var e=this,t=this.Ne.flagKeys;if(!ef(t))return t.filter(function(t){var n=t&&"string"==typeof t&&t.trim().length>0;return n||e.rt.error("Invalid flag key found:",t,"Expected non-empty string"),n})}},{key:"initialize",value:function(){var e,t,n=this.Ne,i=null!=(e=null==(t=n.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(i).length){var r,s,o=null!=(r=null==(s=n.bootstrap)?void 0:s.featureFlagPayloads)?r:{},a=Object.keys(i).filter(function(e){return!!i[e]}).reduce(function(e,t){return e[t]=i[t]||!1,e},{}),u=Object.keys(o).filter(function(e){return a[e]}).reduce(function(e,t){return o[t]&&(e[t]=o[t]),e},{});return this.ja({featureFlags:a,featureFlagPayloads:u})}}},{key:"updateFlags",value:function(e,t,n){var i,r,s=null!=n&&n.merge&&null!=(i=this.Oa(nR))?i:{},o=null!=n&&n.merge&&null!=(r=this.Oa(nT))?r:{},a=C({},s,e),u=C({},o,t),l={},c=!0,h=!1,f=void 0;try{for(var d,v=Object.entries(a)[Symbol.iterator]();!(c=(d=v.next()).done);c=!0){var p=d.value,g=p[0],_=p[1];l[g]={key:g,enabled:N(_),variant:A(_),reason:void 0,metadata:ef(null==u?void 0:u[g])?void 0:{id:0,version:void 0,description:void 0,payload:u[g]}}}}catch(e){h=!0,f=e}finally{try{c||null==v.return||v.return()}finally{if(h)throw f}}this.ja({flags:l})}},{key:"hasLoadedFlags",get:function(){return this.ma}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.Oa(nO),t=this.Oa(nL),n=this.Oa(nD);if(!n&&!t)return e||{};var i=ip({},e||{}),r=(0,d._)(new Set((0,d._)(Object.keys(n||{})).concat((0,d._)(Object.keys(t||{}))))),s=!0,o=!1,a=void 0;try{for(var u,l=r[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c,h,f=u.value,v=i[f],p=null==t?void 0:t[f],g=ef(p)?null!=(c=null==v?void 0:v.enabled)&&c:!!p,_=ef(p)?null==v?void 0:v.variant:"string"==typeof p?p:void 0,y=null==n?void 0:n[f],m=C({},v,{enabled:g,variant:g?null!=_?_:null==v?void 0:v.variant:void 0});g!==(null==v?void 0:v.enabled)&&(m.original_enabled=null==v?void 0:v.enabled),_!==(null==v?void 0:v.variant)&&(m.original_variant=null==v?void 0:v.variant),y&&(m.metadata=C({},null==v?void 0:v.metadata,{payload:y,original_payload:null==v||null==(h=v.metadata)?void 0:h.payload})),i[f]=m}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return this.ca||(this.rt.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.ca=!0),i}},{key:"getAllFeatureFlags",value:function(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(function(n){var i=e[n];return{key:n,enabled:N(i),variant:A(i),payload:T(t[n])}})}},{key:"getFlagVariants",value:function(){var e=this.Oa(nR),t=this.Oa(nL);if(!t)return e||{};for(var n=ip({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.ca||(this.rt.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ca=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.Oa(nT),t=this.Oa(nD);if(!t)return e||{};for(var n=ip({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.ca||(this.rt.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ca=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this._a||this.Ne.featureFlagsDisabled||this.Ma()||this.Ba||(this.ga.slice().forEach(function(t){try{t()}catch(t){e.rt.error("Error while running feature flags reloading callback",t)}}),this.Ba=setTimeout(function(){e.Ha()},5))}},{key:"La",value:function(){clearTimeout(this.Ba),this.Ba=void 0}},{key:"onReloading",value:function(e){var t=this;return this.ga.push(e),function(){t.ga=t.ga.filter(function(t){return t!==e})}}},{key:"ensureFlagsLoaded",value:function(){this.ma||this.ya||this.Ba||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this._a=e}},{key:"resetFlagCallReported",value:function(){this.q(nG)}},{key:"Ha",value:function(e){var t=this;this.La();var n=this.nn;if(n&&!this.Ne.remoteRequestsDisabled&&!this.Ma())if(this.ya)this.wa=!0;else{var i={token:n.projectToken,distinct_id:n.distinctId,groups:n.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:C({},n.initialPersonProperties,this.Oa(nj)||{},{$lib:n.library.name,$lib_version:n.library.version}),group_properties:this.Oa(nq),timezone:rQ()};ef(n.deviceId)||(i.$device_id=n.deviceId),(null!=e&&e.disableFlags||this.Ne.featureFlagsDisabled)&&(i.disable_flags=!0);var r=this.Na();r.length&&(i.evaluation_contexts=r);var s=this.qa();ef(s)||(i.flag_keys=s);var o=this.Ne.onlyEvaluateSurveyFeatureFlags,a=this.ba;this.ya=!0;var u=function(){t.wa&&(t.wa=!1,t.Ha())},l=function(e){t.ya=!1,a===t.ba&&(t.F((0,c._)({},nK,[as])),t.rt.error("Feature flag request failed",e)),u()};try{n.sendRequest("/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),{target:"flags",method:"POST",body:i,compression:"base64"===this.Ne.compression?r5:void 0,sentAt:"body",timeoutMs:this.Ne.requestTimeoutMs}).then(function(e){var n,r,s=null!=(n=e.json)?n:{},l=200!==e.statusCode;if(t.ya=!1,a===t.ba){if(t.Ua(e.statusCode),l||t.wa||(t.$anon_distinct_id=void 0),!i.disable_flags||t.wa){t.ka=!l;var h=[];e.error?h.push((0,f._)(e.error,Error)&&"AbortError"===e.error.name?"timeout":(0,f._)(e.error,Error)?as:"unknown_error"):200!==e.statusCode&&h.push("api_error_"+e.statusCode),s.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var d=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));d&&h.push("quota_limited"),t.F((0,c._)({},nK,h)),d?t.rt.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."):i.disable_flags||t.j
1a(s,l,{partialResponse:o}),u()}}else u()}).catch(l)}catch(e){l(e)}}}},{key:"Ma",value:function(){return rA(this.Sa,3)}},{key:"Ua",value:function(e){var t=this;this.Sa=rL(e,this.Sa,3,function(){return t.rt.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.")})}},{key:"getFeatureFlag",value:function(e,t){var n;if(void 0===t&&(t={}),!t.fresh||this.ka)if(this.ma||this.getFlags()&&this.getFlags().length>0){if(!this.$a()){var i=this.getFeatureFlagResult(e,t);return null!=(n=null==i?void 0:i.variant)?n:null==i?void 0:i.enabled}}else this.rt.warn('getFeatureFlag for key "'+e+ar)}},{key:"getFeatureFlagDetails",value:function(e){return this.getFlagsWithDetails()[e]}},{key:"getFeatureFlagPayload",value:function(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}},{key:"getFeatureFlagResult",value:function(e,t){if(void 0===t&&(t={}),!t.fresh||this.ka)if(this.ma||this.getFlags()&&this.getFlags().length>0){if(!this.$a()){var n,i=this.getFlagVariants(),r=e in i,s=i[e],o=this.getFlagPayloads()[e],a=String(s),u=this.Oa(nN)||void 0,l=this.Oa(nY)||void 0,h=this.Oa(nG)||{};if(this.Ne.deduplicateCallsPerSession){var f,v=null==(f=this.nn)?void 0:f.session.sessionId,p=this.Oa(nJ);v&&v!==p&&(h={},n=v)}if(!t.send_event&&"send_event"in t)n&&this.F((k={},(0,c._)(k,nG,h),(0,c._)(k,nJ,n),k));else if(e in h&&h[e].includes(a))n&&this.F((m={},(0,c._)(m,nG,h),(0,c._)(m,nJ,n),m));else{eu(h[e])?h[e].push(a):h[e]=[a],this.F(C((0,c._)({},nG,h),n?(0,c._)({},nJ,n):{}));var g=this.getFeatureFlagDetails(e),_=(0,d._)(null!=(b=this.Oa(nK))?b:[]);ef(s)&&_.push("flag_missing");var y={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:o||null,$feature_flag_request_id:u,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(w=this.Ne.bootstrap)||null==(w=w.featureFlags)?void 0:w[e])||null,$feature_flag_bootstrapped_payload:(null==(x=this.Ne.bootstrap)||null==(x=x.featureFlagPayloads)?void 0:x[e])||null,$used_bootstrap_value:!this.ka};ef(null==g||null==(E=g.metadata)?void 0:E.has_experiment)||(y.$feature_flag_has_experiment=g.metadata.has_experiment),ef(null==g||null==(S=g.metadata)?void 0:S.version)||(y.$feature_flag_version=g.metadata.version);var m,k,b,w,x,E,S,P,F,$,I,R,M,O=null!=(P=null==g||null==(F=g.reason)?void 0:F.description)?P:null==g||null==($=g.reason)?void 0:$.code;O&&(y.$feature_flag_reason=O),null!=g&&null!=(I=g.metadata)&&I.id&&(y.$feature_flag_id=g.metadata.id),ef(null==g?void 0:g.original_variant)&&ef(null==g?void 0:g.original_enabled)||(y.$feature_flag_original_response=ef(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(R=g.metadata)&&R.original_payload&&(y.$feature_flag_original_payload=null==g||null==(M=g.metadata)?void 0:M.original_payload),_.length&&(y.$feature_flag_error=_.join(",")),this.za(y)}if(r)return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:T(o)}}}else this.rt.warn('getFeatureFlagResult for key "'+e+ar)}},{key:"za",value:function(e){var t,n=this;try{null==(t=this.nn)||t.capture("$feature_flag_called",e).catch(function(e){n.rt.error("Failed to capture feature flag call",e)})}catch(e){this.rt.error("Failed to capture feature flag call",e)}}},{key:"getRemoteConfigPayload",value:function(e,t){this.Wa(e,t)}},{key:"Wa",value:function(e,t){var n=this;return M(function(){var i,r,s,o,a,u,l,c,h;return(0,p._)(this,function(f){switch(f.label){case 0:if(!(i=n.nn))return[3,5];r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},(s=n.Na()).length&&(r.evaluation_contexts=s),ef(a=n.qa())||(r.flag_keys=a),f.label=1;case 1:return f.trys.push([1,3,,4]),c=null,[4,i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:"base64"===n.Ne.compression?r5:void 0,sentAt:"body",timeoutMs:n.Ne.requestTimeoutMs})];case 2:return o=(null==(l=c==(u=f.sent().json)?void 0:u.featureFlagPayloads)?void 0:l[e])||void 0,[3,4];case 3:return h=f.sent(),[2,void n.rt.error("Remote config feature flag request failed",h)];case 4:try{t(o)}catch(e){n.rt.error("Remote config feature flag callback failed",e)}f.label=5;case 5:return[2]}})})()}},{key:"isFeatureEnabled",value:function(e,t){if(void 0===t&&(t={}),t.fresh&&!this.ka)return t.defaultValue;if(!(this.ma||this.getFlags()&&this.getFlags().length>0))return this.rt.warn('isFeatureEnabled for key "'+e+ar),t.defaultValue;var n=this.getFeatureFlag(e,t);return ef(n)?t.defaultValue:!!n}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(t){return t!==e})}},{key:"receivedFeatureFlags",value:function(e,t,n){this.ja(e,t,n)}},{key:"ja",value:function(e,t,n){if(this.nn){this.ma=!0;var i=function(e,t,n,i,r,s){void 0===t&&(t={}),void 0===n&&(n={}),void 0===i&&(i={}),void 0===s&&(s=an);var o=(h=s,(f=e.flags)?C({},e,{featureFlags:Object.fromEntries(Object.keys(f).map(function(e){var t;return[e,null!=(t=f[e].variant)?t:f[e].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(f).filter(function(e){return f[e].enabled}).filter(function(e){var t;return null==(t=f[e].metadata)?void 0:t.payload}).map(function(e){var t;return[e,null==(t=f[e].metadata)?void 0:t.payload]}))}):(e.featureFlags&&h.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)),a=o.flags,u=o.featureFlags,l=o.featureFlagPayloads;if(u){var h,f,d,v=e.requestId,p=e.evaluatedAt;if(eu(u)){s.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var g,_={};if(u)for(var y=0;u.length>y;y++)_[u[y]]=!0;return g={},(0,c._)(g,nM,u),(0,c._)(g,nR,_),(0,c._)(g,nA,!1),g}var m=u,k=l,b=a;if(null!=r&&r.partialResponse)m=C({},t,m),k=C({},n,k),b=C({},i,b);else if(e.errorsWhileComputingFlags)if(a){var w=new Set(Object.keys(a).filter(function(e){var t;return!(null!=(t=a[e])&&t.failed)}));m=C({},t,Object.fromEntries(Object.entries(m).filter(function(e){return w.has(e[0])}))),k=C({},n,Object.fromEntries(Object.entries(k||{}).filter(function(e){return w.has(e[0])}))),b=C({},i,Object.fromEntries(Object.entries(b||{}).filter(function(e){return w.has(e[0])})))}else m=C({},t,m),k=C({},n,k),b=C({},i,b);return C((d={},(0,c._)(d,nM,Object.keys(aa(m))),(0,c._)(d,nR,m||{}),(0,c._)(d,nT,k||{}),(0,c._)(d,nO,b||{}),(0,c._)(d,nA,!0===e.minimalFlagCalledEvents),d),v?(0,c._)({},nN,v):{},p?(0,c._)({},nY,p):{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.rt);i&&this.F(i),t||(this.xa=!1),this.Va(t)}}},{key:"override",value:function(e,t){void 0===t&&(t=!1),this.rt.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){this.Za(e)}},{key:"Za",value:function(e){if(this.nn){if(!1===e)return this.q([nL,nD]),this.Va(),void ai.info("All overrides cleared");if(eu(e))return this.F((0,c._)({},nL,ao(e))),this.Va(),void ai.info("Flag overrides set",{flags:e});if(e&&"object"==(void 0===e?"undefined":(0,v._)(e))&&("flags"in e||"payloads"in e)){this.ca=!!(null!=(t=e.suppressWarning)&&t);var t,n={},i=e.flags,r=e.payloads;return i&&(n[nL]=eu(i)?ao(i):i),r&&(n[nD]=r),Object.keys(n).length&&this.F(n),!1===i&&!1===r?this.q([nL,nD]):!1===i?this.q(nL):!1===r&&this.q(nD),this.Va(),!1===i?ai.info("Flag overrides cleared"):i&&ai.info("Flag overrides set",{flags:i}),void(!1===r?ai.info("Payload overrides cleared"):r&&ai.info("Payload overrides set",{payloads:r}))}if(e&&"object"==(void 0===e?"undefined":(0,v._)(e)))return this.F((0,c._)({},nL,e)),this.Va(),void ai.info("Flag overrides set",{flags:e});this.rt.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.rt.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.ma){var n=this.Ga(),i=n.flags,r=n.flagVariants;try{e(i,r)}catch(e){this.rt.error("Error while running feature flags callback",e)}}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i,r,s=this,o=(this.Oa(nC)||[]).find(function(t){return t.flagKey===e}),a=(0,c._)({},"$feature_enrollment/"+e,t),u={$feature_flag:e,$feature_enrollment:t,$set:a};o&&(u.$early_access_feature_name=o.name),n&&(u.$feature_enrollment_stage=n);var l=C({},this.getFlagVariants(),(0,c._)({},e,t));this.F((i={},(0,c._)(i,nM,Object.keys(aa(l))),(0,c._)(i,nR,l),(0,c._)(i,nj,C({},this.Oa(nj)||{}
1,a)),i)),this.Va();try{null==(r=this.nn)||r.capture("$feature_enrollment_update",u).catch(function(e){s.rt.error("Failed to capture early access feature enrollment",e)})}catch(e){this.rt.error("Failed to capture early access feature enrollment",e)}}},{key:"getEarlyAccessFeatures",value:function(e,t,n){void 0===t&&(t=!1);var i=this.Oa(nC);!i||t?this.Qa(e,n):e(i)}},{key:"Qa",value:function(e,t){var n=this;return M(function(){var i,r,s,o,a;return(0,p._)(this,function(u){switch(u.label){case 0:if(!(i=n.nn))return[3,5];s=t?"&"+t.map(function(e){return"stage="+e}).join("&"):"",u.label=1;case 1:return u.trys.push([1,3,,4]),[4,i.sendRequest("/api/early_access_features/?token="+i.projectToken+s,{target:"api",method:"GET",sentAt:"query"})];case 2:if(!(o=u.sent()).json)return[2];return n.F((0,c._)({},nC,r=o.json.earlyAccessFeatures)),[3,4];case 3:return a=u.sent(),[2,void n.rt.error("Early access feature request failed",a)];case 4:try{e(r)}catch(e){n.rt.error("Early access feature callback failed",e)}u.label=5;case 5:return[2]}})})()}},{key:"Ga",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(function(e){return t[e]}),flagVariants:Object.keys(t).filter(function(e){return t[e]}).reduce(function(e,n){return e[n]=t[n],e},{})}}},{key:"Va",value:function(e){var t=this;this.Fa();var n=this.Ga(),i=n.flags,r=n.flagVariants;this.featureFlagEventHandlers.forEach(function(n){try{n(i,r,{errorsLoading:e})}catch(e){t.rt.error("Error while running feature flags callback",e)}})}},{key:"setPersonPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0),this.Ka(e,t)}},{key:"Ka",value:function(e,t){void 0===t&&(t=!0);var n=this.Oa(nj)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,s={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in n||(s[o]=r[o]));this.F((0,c._)({},nj,C({},n,s,i))),t&&this.reloadFeatureFlags()}},{key:"unsetPersonPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=C({},this.Oa(nj)||{});e.forEach(function(e){delete n[e]}),this.F((0,c._)({},nj,n)),t&&this.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(e){void 0===e&&(e=!0),this.q(nj),e&&this.reloadFeatureFlags()}},{key:"setGroupPropertiesForFlags",value:function(e,t){void 0===t&&(t=!0);var n=this.Oa(nq)||{},i=C({},n),r=!0,s=!1,o=void 0;try{for(var a,u=Object.keys(e)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;i[l]=C({},n[l],e[l])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}this.F((0,c._)({},nq,i)),t&&this.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.Oa(nq)||{};this.F((0,c._)({},nq,C({},t,(0,c._)({},e,{}))))}else this.q(nq)}},{key:"reset",value:function(){this.ba++,this.wa=!1,this.Fa(),this.ma=!1,this._a=!1,this.ka=!1,this.$anon_distinct_id=void 0,this.La(),this.ca=!1,this.Sa=0}}]),e}()},am={sessionRecording:function(){function e(t){var n=this;if((0,u._)(this,e),this._forceAllowLocalhostNetworkCapture=!1,this.Ya=oz,this.Xa=void 0,this.eo=!1,this.io=function(){if(null==m||!m.visibilityState||"visible"===m.visibilityState)return!0;var e,t=null==g||null==(e=g.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=t&&t.length)||t.some(function(e){return"visible"===e.name})}(),this.Ie=function(){var e;"visible"===(null==m?void 0:m.visibilityState)&&(n.io=!0,null==(e=n.Ja)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw oJ.error("started without valid sessionManager"),Error(oG+" started without valid sessionManager. This is a bug.");if(this.Ne.cookieless_mode===it)throw Error(oG+' cannot be used with cookieless_mode="always"');null!=m&&m.addEventListener&&ib(m,"visibilitychange",this.Ie)}return(0,l._)(e,[{key:"Ne",get:function(){return this._instance.config}},{key:"Mr",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!(null==(e=this.Ja)||!e.isStarted)}},{key:"status",get:function(){var e,t;return this.Ya===oV||this.Ya===oW?this.Ya:null!=(e=null==(t=this.Ja)?void 0:t.status)?e:this.Ya}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"dispose",value:function(){this.eo=!0,null==m||null==m.removeEventListener||m.removeEventListener("visibilitychange",this.Ie),this.stopRecording()}},{key:"ro",get:function(){var e,t=!(null==(e=this._instance.get_property(nw))||!e.enabled),n=!this.Ne.disable_session_recording,i=this.Ne.disable_session_recording||this._instance.consent.isOptedOut();return g&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){var t;if(!(this.eo||this.ro&&null!=(t=this.Ja)&&t.isStarted)){var n=!ef(Object.assign)&&!ef(Array.from);this.ro&&n?(this.no(e),oJ.info("starting")):(this.Ya=oz,this.stopRecording())}}},{key:"no",value:function(e){var t,n,i,r=this;this.ro&&(this.Ya!==oV&&this.Ya!==oW&&(this.Ya=oU),null!=$&&null!=(t=$.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(n=$.__PosthogExtensions__)&&n.initSessionRecording?this.so(e):null==(i=$.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.ao,function(t){if(t)return oJ.error("could not load recorder",t);r.so(e)}))}},{key:"stopRecording",value:function(){var e,t;null==(e=this.Xa)||e.call(this),this.Xa=void 0,null==(t=this.Ja)||t.stop()}},{key:"oo",value:function(){var e,t;null==(e=this.Xa)||e.call(this),this.Xa=void 0,null==(t=this.Ja)||t.discard()}},{key:"lo",value:function(){var e,t;null==(e=this.Mr)||e.unregister(nI),null==(t=this.Mr)||t.unregister(nx)}},{key:"uo",value:function(e,t){if(eg(e))return null;var n=e_(e)?e:parseFloat(e);return"number"!=typeof n||!Number.isFinite(n)||0>n||n>1?(oJ.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):n}},{key:"ho",value:function(e){var t=this;if(this.Mr){var n,i,r=this.Mr,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.uo(null==(n=t.Ne.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.uo(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;eg(a)&&t.lo();var u=null==i?void 0:i.minimumDurationMilliseconds;r.register((0,c._)({},nw,C({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:C({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ef(u)?null:u,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})))};s(),null==(n=this.Xa)||n.call(this),this.Xa=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.ho(t),void this.oo()):(this.ho(t),void this.startIfEnabledOrStop()):(this.Ya===oV&&(this.Ya=oW,oJ.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}},{key:"log",value:function(e,t){var n;void 0===t&&(t="log"),null!=(n=this.Ja)&&n.log?this.Ja.log(e,t):oJ.warn("log called before recorder was ready")}},{key:"ao",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(nw);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"do",value:function(){var e,t=this._instance.get_property(nw);if(!t)return!1;try{e="object"==(void 0===t?"undefined":(0,v._)(t))?t:JSON.parse(t)}
1catch(e){return oJ.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!eg(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}},{key:"so",value:function(e){var t,n,i,r;if(!this.eo){if(null==(t=$.__PosthogExtensions__)||!t.initSessionRecording)return oJ.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session((0,c._)({},n7,!0));if(this.Ja||(this.Ja=null==(r=$.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance,this.io),this.Ja._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.do()){if(this.Ya===oW||this.Ya===oV)return;return this.Ya=oV,oJ.info("persisted remote config is stale, requesting fresh config before starting"),void new sr(this._instance).load()}this.Ya=oU,null==(n=(i=this.Ja).setDocumentWasEverVisible)||n.call(i,this.io),this.Ja.start(e)}}},{key:"onRRwebEmit",value:function(e){var t;null==(t=this.Ja)||null==t.onRRwebEmit||t.onRRwebEmit(e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.Ja||null==(t=this.Mr)||t.register((0,c._)({},nS,!0)),null==(e=this.Ja)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.Ja||null==(t=this.Mr)||t.register((0,c._)({},nE,!0)),null==(e=this.Ja)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.Ja||null==(n=this.Mr)||n.register((0,c._)({},"url"===e?nP:nF,!0)),null==(t=this.Ja)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.Ja)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!(null==(n=this.Ja)||!n.tryAddCustomEvent(e,t))}}]),e}()},ak={autocapture:function(){function e(t){(0,u._)(this,e),this.vo=!1,this.co=null,this.fo=!1,this.po=!1,this.instance=t,this.rageclicks=new oN(t.config.rageclick),this.mo=null}return(0,l._)(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"Ne",get:function(){var e,t,n=ec(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=null==(e=n.url_allowlist)?void 0:e.map(function(e){return new RegExp(e)}),n.url_ignorelist=null==(t=n.url_ignorelist)?void 0:t.map(function(e){return new RegExp(e)}),n}},{key:"yo",value:function(){var e=this;if(this.isBrowserSupported()){if(g&&m){var t=function(t){t=t||(null==g?void 0:g.event);try{e.bo(t)}catch(e){oL.error("Failed to capture event",e)}};if(ib(m,"submit",t,{capture:!0}),ib(m,"change",t,{capture:!0}),ib(m,"click",t,{capture:!0}),this.Ne.capture_copied_text){var n=function(t){t=t||(null==g?void 0:g.event);try{e.bo(t,oA)}catch(e){oL.error("Failed to capture copy/cut event",e)}};ib(m,"copy",n,{capture:!0}),ib(m,"cut",n,{capture:!0})}}}else oL.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.vo&&(this.yo(),this.vo=!0)}},{key:"onRemoteConfig",value:function(e){if(this.fo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.po=t.elementsChainAsString);var n=t.autocapture_opt_out;em(n)&&(this.instance.persistence&&this.instance.persistence.register((0,c._)({},nd,n)),this.co=n),this.startIfEnabled()}else this.startIfEnabled()}},{key:"setElementSelectors",value:function(e){this.mo=e}},{key:"getElementSelectors",value:function(e){var t,n=[];return null==(t=this.mo)||t.forEach(function(t){var i=null==m?void 0:m.querySelectorAll(t);null==i||i.forEach(function(i){e===i&&n.push(t)})}),n}},{key:"isEnabled",get:function(){var e,t,n=null==(e=this.instance.persistence)?void 0:e.props[nd],i=this.co,r=this.instance.Qi()&&!this.fo;if(ep(i)&&!em(n)&&!r)return!1;var s=null!=(t=this.co)?t:!!n;return!!this.instance.config.autocapture&&!s}},{key:"bo",value:function(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var n,i=i5(e);iQ(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&(0,f._)(e,MouseEvent)&&this.instance.config.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&rr(i,this.instance.config.rageclick)&&this.bo(e,"$rageclick");var r=t===oA;if(i&&function(e,t,n,i,r,s){if(!g||rs(e)||null!=n&&n.url_allowlist&&!i0(n.url_allowlist,s)||null!=n&&n.url_ignorelist&&i0(n.url_ignorelist,s))return!1;if(null!=n&&n.dom_event_allowlist){var o,a=n.dom_event_allowlist;if(a&&!a.some(function(e){return t.type===e}))return!1}var u=ro(e,i),l=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(ef(n))return!0;var i,r=function(e){if(n.some(function(t){return e.tagName.toLowerCase()===t}))return{v:!0}},s=!0,o=!1,a=void 0;try{for(var u,l=e[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c=u.value;if(i=r(c))return i.v}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return!1}(c,n)||!i8(c,null==n?void 0:n.css_selector_allowlist)||i8(c,null!=(o=null==n?void 0:n.css_selector_ignorelist)?o:i7))return!1;try{var h=g.getComputedStyle(e);
1if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var f=e.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return l?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(i4.indexOf(f)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.Ne,r,r?["copy","cut"]:void 0,this.instance)){var s=function(e,t){var n,i,r=t.e,s=t.maskAllElementAttributes,o=t.maskAllText,a=t.elementAttributeIgnoreList,u=t.elementsChainAsString,l=t.disableCaptureUrlHashes;if(!iK(e))return{props:{}};for(var c=[e],h=new Set([e]),f=e;f.parentNode&&!iY(f,"body")&&1e3>c.length;)if(iX(f.parentNode)){var d=f.parentNode.host;if(h.has(d))break;h.add(d),c.push(d),f=d}else{if(!iK(f.parentNode)||h.has(f.parentNode))break;h.add(f.parentNode),c.push(f.parentNode),f=f.parentNode}var v,p=[],_={},y=!1,m=!1;if(iv(c,function(e){var t=ra(e);if(iY(e,"a")){var n=e.getAttribute("href");y=!!(t&&n&&rp(n))&&(l?tS(n):n)}et(i1(e),"ph-no-capture")&&(m=!0),p.push(function(e,t,n,i,r){void 0===r&&(r=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};i4.indexOf(s)>-1&&!n&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?oD(1024,rg(e)):oD(1024,i3(e)));var a=i1(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),iv(e.attributes,function(n){var s;if((!ru(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&(null==i||!i.includes(n.name))&&!t&&rp(n.value)&&(!ed(s=n.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=n.value;"class"===n.name&&(a=iZ(a).join(" ")),o["attr__"+n.name]=oD(1024,"href"===n.name&&r?tS(a):a)}});for(var u=1,l=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!iK(t))return t}(c);)u++,c.tagName===e.tagName&&l++;return o.nth_child=u,o.nth_of_type=l,o}(e,s,o,a,l)),ip(_,function(e){if(!ra(e))return{};var t={};return iv(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&rp(i)&&(t[n]=i)}}),t}(e))}),m)return{props:{},explicitNoCapture:m};if(o||(p[0].$el_text=iY(e,"a")||iY(e,"button")?rg(e):i3(e)),y){p[0].attr__href=y;var k,b,w=null==(k=rC(y))?void 0:k.host,x=null==g||null==(b=g.location)?void 0:b.host;w&&x&&w!==x&&(v=y)}return{props:ip({$event_type:r.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(function(e){var t,n,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:function(e){var t=e.attr__class;if(t)return eu(t)?t:iZ(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ig(e).filter(function(e){return 0===e[0].indexOf("attr__")}).forEach(function(e){return i.attributes[e[0]]=e[1]}),i}).map(function(e){var t,n,i="",r=!0,s=!1,o=void 0;if(e.tag_name&&(i+=e.tag_name),e.attr_class)try{for(var a,u=(e.attr_class.sort(),e.attr_class)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;i+="."+l.replace(/"/g,"")}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}var c=C({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(n=e.nth_of_type)?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),h={};return ig(c).sort(function(e,t){return e[0].localeCompare(t[0])}).forEach(function(e){var t=e[1];return h[r_(e[0].toString())]=r_(t.toString())}),(i+=":")+ig(h).map(function(e){return e[0]+'="'+e[1]+'"'}).join("")}).join(";")},null!=(n=p[0])&&n.$el_text?{$el_text:null==(i=p[0])?void 0:i.$el_text}:{},v&&"click"===r.type?{$external_click_url:v}:{},_)}}(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ne.element_attribute_ignorelist,elementsChainAsString:this.po,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=s.props;if(s.explicitNoCapture)return!1;var a=this.getElementSelectors(i);if(a&&a.length>0&&(o.$element_selectors=a),t===oA){var u,l=i2(null==g||null==(u=g.getSelection())?void 0:u.toString()),c=e.type||"clipboard";if(!l)return!1;o.$selected_content=l,o.$copy_type=c}return this.instance.capture(t,o),!0}}}},{key:"isBrowserSupported",value:function(){return el(null==m?void 0:m.querySelectorAll)}}]),e}(),historyAutocapture:function(){function e(t){var n;(0,u._)(this,e),this._instance=t,this._o=(null==g||null==(n=g.location)?void 0:n.pathname)||""}return(0,l._)(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"isEnabled",get:function(){return"history_change"===this._instance.config.capture_pageview}},{key:"startIfEnabled",value:function(){this.isEnabled&&(nr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"stop",value:function(){this.wo&&this.wo(),this.wo=void 0,nr.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){g&&g.history&&(this.ko("pushState"),this.ko("replaceState"),this.xo())}},{key:"ko",value:function(e){var t;if(g&&(null==(t=g.history[e])||!t.__posthog_wrapped__)){var n=this;!function(e,t,n){try{if(!(t in e))return oq;var i={next:e[t]},r=n(function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return i.next.apply(this,t)});el(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}}
1)),e[t]=r}catch(e){return oq}}(g.history,e,function(t){return function(i,r,s){t.call(this,i,r,s),n.So(e)}})}}},{key:"So",value:function(e){try{var t,n=null==g||null==(t=g.location)?void 0:t.pathname;if(!n)return;n!==this._o&&this.isEnabled&&this._instance.capture(iu,{navigation_type:e}),this._o=n}catch(t){nr.error("Error capturing "+e+" pageview",t)}}},{key:"xo",value:function(){var e=this;if(!this.wo){var t=function(){e.So("popstate")};ib(g,"popstate",t),this.wo=function(){g&&g.removeEventListener("popstate",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;(0,u._)(this,e),this.Co=!1,this.vo=!1,this.Mo=null,this.instance=t,this.Co=!(null==(n=this.instance.persistence)||!n.props[nv]),this.rageclicks=new oN(t.config.rageclick)}return(0,l._)(e,[{key:"Ne",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return ec(this.Ne.capture_heatmaps)&&this.Ne.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ne.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return eg(this.Ne.capture_heatmaps)?eg(this.Ne.enable_heatmaps)?this.Co:this.Ne.enable_heatmaps:!1!==this.Ne.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled)this.vo||(oK.info("starting..."),this.To(),this.Ie());else{var e;clearInterval(null!=(e=this.Mo)?e:void 0),this.Eo(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register((0,c._)({},nv,n)),this.Co=n,this.startIfEnabled()}}}},{key:"getAndClearBuffer",value:function(){var e=this.R;return this.R=void 0,e}},{key:"Io",value:function(e){oY(e.originalEvent)&&this.ke(e.originalEvent,"deadclick")}},{key:"Ie",value:function(){this.Mo&&clearInterval(this.Mo),this.Mo="visible"===(null==m?void 0:m.visibilityState)?setInterval(this.cr.bind(this),this.flushIntervalMilliseconds):null}},{key:"To",value:function(){var e=this;g&&m&&(this.Po=this.cr.bind(this),ib(g,ia,this.Po),this.Ro=function(t){return e.ke(t||(null==g?void 0:g.event))},ib(m,"click",this.Ro,{capture:!0}),this.Ao=function(t){return e.Fo(t||(null==g?void 0:g.event))},ib(m,"mousemove",this.Ao,{capture:!0}),this.Lo=new rb(this.instance,rm,this.Io.bind(this)),this.Lo.startIfEnabledOrStop(),this.Oo=this.Ie.bind(this),ib(m,io,this.Oo),this.vo=!0)}},{key:"Eo",value:function(){var e;g&&m&&(this.Po&&g.removeEventListener(ia,this.Po),this.Ro&&m.removeEventListener("click",this.Ro,{capture:!0}),this.Ao&&m.removeEventListener("mousemove",this.Ao,{capture:!0}),this.Oo&&m.removeEventListener(io,this.Oo),clearTimeout(this.Do),null==(e=this.Lo)||e.stop(),this.vo=!1)}},{key:"$o",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=function(e,t,n){for(var i=e;i&&iK(i)&&!iY(i,"body")&&i!==n;){var r,s,o,a=void 0;try{a=null==(r=null!=(s=null==(o=i.ownerDocument)?void 0:o.defaultView)?s:g)?void 0:r.getComputedStyle(i).position}catch(e){break}if(et(t,a))return!0;i=i6(i)}return!1}(i5(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"ke",value:function(e,t){var n;if(void 0===t&&(t="click"),!iJ(e.target)&&oY(e)){var i=this.$o(e,t);null!=(n=this.rageclicks)&&n.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&rr(i5(e),this.instance.config.rageclick)&&this.Vt(C({},i,{type:"rageclick"})),this.Vt(i)}}},{key:"Fo",value:function(e){var t=this;!iJ(e.target)&&oY(e)&&(clearTimeout(this.Do),this.Do=setTimeout(function(){t.Vt(t.$o(e,"mousemove"))},500))}},{key:"Vt",value:function(e){if(g){var t=this.Ne.disable_capture_url_hashes?tS(g.location.href):g.location.href,n=this.Ne.custom_personal_data_properties,i=rT(t,this.Ne.mask_personal_data_properties?(0,d._)(rj).concat((0,d._)(n||[])):[],rH);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(e)}}},{key:"cr",value:function(){this.R&&!eh(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:rb,webVitalsAutocapture:function(){function e(t){var n,i=this;(0,u._)(this,e),this.Co=!1,this.vo=!1,this.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.No=function(){clearTimeout(i.qo),i.qo=void 0,0!==i.R.metrics.length&&(i._instance.capture("$web_vitals",C({$current_url:i.R.url},i.R.metrics.reduce(function(e,t){var n;return C({},e,(n={},(0,c._)(n,"$web_vitals_"+t.name+"_event",C({},t)),(0,c._)(n,"$web_vitals_"+t.name+"_value",t.value),n))},{}))),i.R={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.jo=function(e){var t;if(i.R=i.R||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},eg(null==e?void 0:e.name)||eg(null==e?void 0:e.value))oB.error("Invalid metric received",e);else{var n="string"==typeof e.navigationURL?e.navigationURL:void 0,r=i.Bo(n);if(!ef(r)){var s=e_(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+r;if(!i.Ho||i.Ho>e.value){i.R.navigationKey!==s&&(i.No(),i.qo=setTimeout(i.No,i.flushToCaptureTimeoutMs)),ef(i.R.navigationKey)&&(i.R.navigationKey=s,i.R.url=r),i.R.firstMetricTimestamp=ef(i.R.firstMetricTimestamp)?Date.now():i.R.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var o=null==(t=i._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),a=C({},e,n?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});ef(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),i.R.metrics.push(a),i.R.metrics.length===i.allowedMetrics.length&&i.No()}else oB.error("Ignoring metric with value >= "+i.Ho,e)}}},this.Uo=function(){if(!i.vo){var e,t,n,r,s=$.__PosthogExtensions__,o=null==s?void 0:s.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[i.zo])||("web-vitals"===i.zo&&ef(o)?null==s?void 0:s.postHogWebVitalsCallbacks:void 0);if(ef(a)||(e=a.onLCP,t=a.onCLS,n=a.onFCP,r=a.onINP),e&&t&&n&&r){var u={reportSoftNavs:i.useSoftNavs};i.allowedMetrics.indexOf("LCP")>-1&&e(i.jo.bind(i),u),i.allowedMetrics.indexOf("CLS")>-1&&t(i.jo.bind(i),u),i.allowedMetrics.indexOf("FCP")>-1&&n(i.jo.bind(i),u),i.allowedMetrics.indexOf("INP")>-1&&r(i.jo.bind(i),u),i.vo=!0}else oB.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Co=!(null==(n=this._instance.persistence)||!n.props[ny]),this.startIfEnabled()}return(0,l._)(e,[{key:"Wo",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=ec(this.Wo)?null==(e=this.Wo)?void 0:e.web_vitals_allowed_metrics:void 0;return eg(n)?(null==(t=this._instance.persistence)?void 0:t.props[nb])||["CLS","FCP","INP","LCP"]:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(ec(this.Wo)?this.Wo.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"useAttribution",get:function(){var e=ec(this.Wo)?this.Wo.web_vitals_attribution:void 0;return null!=e&&e}}
1,{key:"useSoftNavs",get:function(){var e=ec(this.Wo)?this.Wo.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}},{key:"Ho",get:function(){var e=ec(this.Wo)&&e_(this.Wo.__web_vitals_max_value)?this.Wo.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}},{key:"isEnabled",get:function(){var e=null==k?void 0:k.protocol;if("http:"!==e&&"https:"!==e)return oB.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ec(this.Wo)?this.Wo.web_vitals:em(this.Wo)?this.Wo:void 0;return em(t)?t:this.Co}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.vo&&(oB.info("enabled, starting..."),this.ai(this.Uo))}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=ec(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=ec(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register((0,c._)({},ny,n)),this._instance.persistence.register((0,c._)({},nb,i))),this.Co=n,this.startIfEnabled()}}}},{key:"zo",get:function(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}},{key:"ai",value:function(e){var t=$.__PosthogExtensions__,n=this.zo,i=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=i&&i[n]||"web-vitals"===n&&ef(i)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,n,function(t){t?oB.error("failed to load script",t):e()})}},{key:"Bo",value:function(e){var t=e||(null==g?void 0:g.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?tS(t):t,i=this._instance.config.custom_personal_data_properties;return rT(n,this._instance.config.mask_personal_data_properties?(0,d._)(rj).concat((0,d._)(i||[])):[],rH)}oB.error("Could not determine current URL")}}]),e}()},ab={exceptionObserver:function(){function e(t){var n,i,r,s,o,a,l=this;(0,u._)(this,e),this.Uo=function(){var e;if(g&&l.isEnabled&&null!=(e=$.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!l.Vo&&l.Ne.capture_unhandled_errors&&(l.Vo=t(l.captureException.bind(l))),!l.Zo&&l.Ne.capture_unhandled_rejections&&(l.Zo=n(l.captureException.bind(l))),!l.Go&&l.Ne.capture_console_errors&&(l.Go=i(l.captureException.bind(l)))}catch(e){oj.error("failed to start",e),l.Qo()}}},this._instance=t,this.Ko=!(null==(a=this._instance.persistence)||!a.props[np]),this.Jo=new eI(C({},(void 0===(n=this._instance.config.error_tracking)&&(n={}),{refillRate:null!=(i=null!=(r=n.exceptionRateLimiterRefillRate)?r:n.__exceptionRateLimiterRefillRate)?i:1,bucketSize:null!=(s=null!=(o=n.exceptionRateLimiterBucketSize)?o:n.__exceptionRateLimiterBucketSize)?s:10}),{refillInterval:1e4,rt:oj})),this.Ne=this.Yo(),this.startIfEnabledOrStop()}return(0,l._)(e,[{key:"Yo",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ec(e)?t=C({},t,e):(ef(e)?this.Ko:e)&&(t=C({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.Ne.capture_console_errors||this.Ne.capture_unhandled_errors||this.Ne.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(oj.info("enabled"),this.Qo(),this.ai(this.Uo)):this.Qo()}},{key:"ai",value:function(e){var t,n;null!=(t=$.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"exception-autocapture",function(t){if(t)return oj.error("failed to load script",t);e()})}},{key:"Qo",value:function(){var e,t,n;null==(e=this.Vo)||e.call(this),this.Vo=void 0,null==(t=this.Zo)||t.call(this),this.Zo=void 0,null==(n=this.Go)||n.call(this),this.Go=void 0}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Ko=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register((0,c._)({},np,this.Ko)),this.Ne=this.Yo(),this.startIfEnabledOrStop())}}},{key:"onConfigChange",value:function(){this.Ne=this.Yo()}},{key:"captureException",value:function(e){var t,n,i,r=null!=(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)?t:"Exception";this.Jo.consumeRateLimit(r)?oj.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}}]),e}(),exceptions:function(){function e(t){var n,i;(0,u._)(this,e),this.Xo=[],this.tl=new tj([new tY,new t8,new tX,new tQ,new t5,new t3,new t0,new t4],function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;t>i;i++)n[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var r=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var u=tK.test(a)?a.replace(tK,"$1"):a;if(!u.match(/\S*Error: /)){var l=!0,c=!1,h=void 0;try{for(var f,d=n[Symbol.iterator]();!(l=(f=d.next()).done);l=!0){var v=(0,f.value)(u,e);
1if(v){r.push(v);break}}}catch(e){c=!0,h=e}finally{try{l||null==d.return||d.return()}finally{if(c)throw h}}if(r.length>=50)break}}}if(!r.length)return[];var p=Array.from(r);return p.reverse(),p.slice(0,50).map(function(e){return C({},e,{filename:e.filename||(p[p.length-1]||{}).filename,function:e.function||"?"})})}}("web:javascript",tV,tJ)),this._instance=t,this.Xo=null!=(n=null==(i=this._instance.persistence)?void 0:i.get_property(ng))?n:[],this.el=nt(this.il()),this.rl=new nn(this.el)}return(0,l._)(e,[{key:"onConfigChange",value:function(){this.el=nt(this.il()),this.rl.setConfig(this.el)}},{key:"onRemoteConfig",value:function(e){var t,n,i;if(e.ok){var r=e.config;if("errorTracking"in r){var s,o=null!=(t=null==(n=r.errorTracking)?void 0:n.suppressionRules)?t:[],a=null==(i=r.errorTracking)?void 0:i.captureExtensionExceptions;this.Xo=o,this._instance.persistence&&this._instance.persistence.register((s={},(0,c._)(s,ng,this.Xo),(0,c._)(s,n_,a),s))}}}},{key:"nl",get:function(){var e,t=!!this._instance.get_property(n_),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=n?n:t)&&e}},{key:"buildProperties",value:function(e,t){return this.tl.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"addExceptionStep",value:function(e,t){if(this.el.enabled)try{if(!ed(e)||0===e.trim().length)return void au.warn("Ignoring exception step because message must be a non-empty string");var n,i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(function(n,i){return t9.has(i)?t.push(i):n[i]=e[i],n},{}),droppedKeys:t}}(this.sl(t)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&au.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.rl.add(C((n={},(0,c._)(n,t6,e),(0,c._)(n,t7,(new Date).toISOString()),n),r))}catch(e){au.error("Failed to add exception step. Ignoring breadcrumb.",e)}}},{key:"sendExceptionEvent",value:function(e){var t;try{var n=e.$exception_list;if(this.al(n)){if(this.ol(n))return this.ll("Exception dropped: matched a suppression rule"),void au.info("Skipping exception capture because a suppression rule matched");if(!this.nl&&this.ul(n))return this.ll("Exception dropped: thrown by a browser extension"),void au.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hl(n))return this.ll("Exception dropped: thrown by the PostHog SDK"),void au.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.el.enabled&&eg(e.$exception_steps)?this.dl(e):e,r="string"==typeof(t=globalThis._posthogReleaseId)&&t.length>0?t:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Wn:!0});return s&&this.rl.clear(),s}catch(e){return au.error("Failed to capture exception event. Dropping this exception.",e),void this.rl.clear()}}catch(e){return void au.error("Failed to process exception event. Ignoring this exception.",e)}}},{key:"dl",value:function(e){try{var t=this.rl.getAttachable();return 0===t.length?e:C({},e,{$exception_steps:t})}catch(t){return au.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}},{key:"ll",value:function(e){var t;this.el.enabled&&this.rl.add((t={},(0,c._)(t,t6,e),(0,c._)(t,t7,(new Date).toISOString()),t))}},{key:"sl",value:function(e){return ec(e)?C({},e):{}}},{key:"il",value:function(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}},{key:"ol",value:function(e){if(0===e.length)return!1;try{var t=e.reduce(function(e,t){var n=t.type,i=t.value;return ed(n)&&n.length>0&&e.$exception_types.push(n),ed(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.Xo.some(function(e){var n=e.values.map(function(e){var n=oe[e.operator],i=t[e.key];if(!n||!i)return!1;var r=eu(e.value)?e.value:[e.value];return r.length>0&&n(r,i)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}catch(e){return au.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}},{key:"ul",value:function(e){return e.flatMap(function(e){var t,n;return null!=(t=null==(n=e.stacktrace)?void 0:n.frames)?t:[]}).some(function(e){return e.filename&&e.filename.startsWith("chrome-extension://")})}},{key:"hl",value:function(e){if(e.length>0){var t,n,i,r,s=null!=(t=null==(n=e[0].stacktrace)?void 0:n.frames)?t:[],o=s[s.length-1];return null!=(i=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&i}return!1}},{key:"al",value:function(e){return!eg(e)&&eu(e)}}]),e}()},aw=C({productTours:function(){function e(t){(0,u._)(this,e),this.vl=null,this.cl=null,this._instance=t}return(0,l._)(e,[{key:"Mr",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t,n,i=e.config;if("productTours"in i){if(this.Mr&&this.Mr.register((0,c._)({},nk,!!i.productTours)),!oX(this._instance))return!this.vl&&eg(null==(t=this.Mr)?void 0:t.props[nW])||oQ.info("product tours disabled; stopping and clearing cached tours"),null==(n=this.vl)||n.stop(),this.vl=null,void this.clearCache();this.loadIfEnabled()}}}},{key:"loadIfEnabled",value:function(){var e=this;!this.vl&&oX(this._instance)&&this.ai(function(){return e.fl()})}},{key:"ai",value:function(e){var t,n;null!=(t=$.__PosthogExtensions__)&&t.generateProductTours?e():null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"product-tours",function(t){t?oQ.error("Could not load product tours script",t):e()})}},{key:"fl",value:function(){var e;!this.vl&&null!=(e=$.__PosthogExtensions__)&&e.generateProductTours&&(this.vl=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e,t){var n=this;if(void 0===t&&(t=!1),!eu(this.cl)||t){var i=this.Mr;if(i){var r=i.props[nW];if(eu(r)&&!t)return this.cl=r,void e(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:function(t){if(oX(n._instance)){var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?t.error||oQ.warn(s):oQ.error(s),void e([],{isLoaded:!1,error:s})}var o=eu(t.json.product_tours)?t.json.product_tours:[];n.cl=o,i&&i.register((0,c._)({},nW,o)),e(o,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.cl,{isLoaded:!0})}},{key:"getActiveProductTours",value:function(e){eg(this.vl)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.vl.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.vl)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.vl?this.vl.previewTour(e):this.ai(function(){var n;t.fl(),null==(n=t.vl)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.vl)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.vl)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.vl)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.cl=null,null==(e=this.Mr)||e.unregister(nW)}},{key:"resetTour",value:function(e){var t;null==(t=this.vl)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.vl)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.vl)||t.cancelPendingTour(e)}}]),e}()},ay),ax={siteApps:function(){function e(t){(0,u._)(this,e),this.pl=0,this._instance=t,this.gl=[],this.apps={}}return(0,l._)(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"ml",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.gl.push(n),this.gl.length>1e3&&(this.gl=this.gl.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=$._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}},{key:"initialize",value:function(){var e=this;if(this.isEnabled){var t=this._instance._addCaptureHook(this.ml.bind(this));this.yl=function(){t(),e.gl=[],e.yl=void 0}}}},{key:"globalsForEvent",value:function(e){if(!e)throw Error("Event payload is required");var t={},n=this._instance.get_property("$groups")||[],i=this._instance.get_property("$stored_group_properties")||{},r=!0,s=!1,o=void 0;try{for(var a,u,l,c,h,f,d,v,p=Object.entries(i)[Symbol.iterator]();!(r=(v=p.next()).done);r=!0){var g=v.value,_=g[0];t[_]={id:n[_],type:_,properties:g[1]}}}catch(e){s=!0,o=e}finally{try{r||null==p.return||p.return()}finally{if(s)throw o}}var y=e.$set_once,m=e.$set;return{event:C({},O(e,oZ),{properties:C({},e.properties,m?{$set:C({},null!=(a=null==(u=e.properties)?void 0:u.$set)?a:{},m)}:{},y?{$set_once:C({},null!=(l=null==(c=e.properties)?void 0:c.$set_once)?l:{},y)}:{}),elements_chain:null!=(h=null==(f=e.properties)?void 0:f.$elements_chain)?h:"",distinct_id:null==(d=e.properties)?void 0:d.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:t}}},{key:"bl",value:function(e){var t,n=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===n&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(o0.error("prepare_external_dependency_stylesheet returned null"),null):"script"===n&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(o0.error("prepare_external_dependency_script returned null"),null):e}},{key:"_l",value:function(){var e,t,n,i,r,s,o,a,u=this;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return function(){};var l=null==m?void 0:m.defaultView,c=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!c)return function(){};if(this.pl++,this.wl)return this.kl();var h=[],f=this,d=new WeakSet,v=function(e,t,n){if(null!=e&&e[t]){var i=e[t];e[t]=n(i),h.push(function(){e[t]=i})}},p=function(e){if(d.has(e))return e;var t=f.bl(e);return t&&d.add(t),t},g=function(e){return e.map(function(e){return"string"==typeof e?e:p(e)}).filter(function(e){return!ep(e)})};return v(c,"appendChild",function(e){return function(t){var n=p(t);return n?e.call(this,n):t}}
1),v(c,"insertBefore",function(e){return function(t,n){var i=p(t);return i?e.call(this,i,n):t}}),v(c,"replaceChild",function(e){return function(t,n){var i=p(t);return i?e.call(this,i,n):n}}),[null==(t=l.Element)?void 0:t.prototype,null==(n=l.Document)?void 0:n.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach(function(e){v(e,"append",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"prepend",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,g(n))}})}),[null==(r=l.Element)?void 0:r.prototype,null==(s=l.CharacterData)?void 0:s.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(function(e){v(e,"before",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"after",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"replaceWith",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];var r=g(n);return n.length&&!r.length?void 0:e.apply(this,r)}})}),v(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",function(e){return function(t,n){var i=p(n);return i?e.call(this,t,i):null}}),this.wl=function(){h.forEach(function(e){return e()}),u.wl=void 0},this.kl()}},{key:"kl",value:function(){var e=this,t=!1;return function(){var n;t||(t=!0,e.pl--,0===e.pl&&(null==(n=e.wl)||n.call(e)))}}},{key:"xl",value:function(e,t){void 0===t&&(t=!0);var n=this._l();try{var i=e(n);return t&&n(),i}catch(e){throw n(),e}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.gl.length&&(o0.info("Processing "+t.gl.length+" events for site app with id "+e.id),t.gl.forEach(function(e){return t.xl(function(){return null==n.processEvent?void 0:n.processEvent(e)})}),n.processedBuffer=!0),Object.values(t.apps).every(function(e){return e.processedBuffer||e.errored})&&(null==(i=t.yl)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,o0.info("Site app with id "+e.id+" "+(t?"loaded":"errored")),r&&i()};try{var o=this.xl(function(n){return e.init({posthog:t._instance,callback:function(e){n(),s(e)}})},!1).processEvent;o&&(n.processEvent=o),r=!0}catch(t){o0.error(o1+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){o0.error("Error while processing buffered events PostHog app with config id "+e.id,t),n.errored=!0}}},{key:"Sl",value:function(){var e=this.siteAppLoaders||[],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.apps[o.id]={id:o.id,loaded:!1,errored:!1,processedBuffer:!1}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}var a=!0,u=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var f=c.value;this.setupSiteApp(f)}}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}}},{key:"Cl",value:function(e){var t=this;if(0!==Object.keys(this.apps).length){var n=this.globalsForEvent(e),i=function(i){try{t.xl(function(){return null==i.processEvent?void 0:i.processEvent(n)})}catch(t){o0.error("Error while processing event "+e.event+" for site app "+i.id,t)}},r=!0,s=!1,o=void 0;try{for(var a,u=Object.values(this.apps)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;i(l)}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}}}},{key:"onRemoteConfig",value:function(e){var t,n,i,r=this,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Sl(),void this._instance.on("eventCaptured",function(e){return r.Cl(e)})):void o0.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(n=this.yl)||n.call(this),e.ok){var o=e.config;if(null!=(i=o.siteApps)&&i.length)if(this.isEnabled){var a=!0,u=!1,l=void 0;try{for(var c,h=o.siteApps[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var f=c.value;!function(){var e,t=f.id,n=f.url;$["__$$ph_site_app_"+t]=s._instance,null==(e=$.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,n,function(e){if(e)return o0.error(o1+t,e)})}()}}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}}else o0.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),e}()},aE={tracingHeaders:function(){function e(t){var n=this;(0,u._)(this,e),this.Ml=void 0,this.Tl=void 0,this.El=void 0,this.Uo=function(){var e,t,i=n.Il();i?(ef(n.Ml)&&(n.Ml=null==(e=$.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,function(){return n._instance.get_distinct_id()},n._instance.sessionManager)),ef(n.Tl)&&(n.Tl=null==(t=$.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,function(){return n._instance.get_distinct_id()},n._instance.sessionManager))):n.Qo()},this._instance=t}return(0,l._)(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"ai",value:function(e){var t,n;null!=(t=$.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(n=$.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,"tracing-headers",function(t){if(t)return oH.error("failed to load script",t);e()})}},{key:"Pl",value:function(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}},{key:"Il",value:function(){var e,t=this.Pl();return eu(t)?(eu(this.El)?(e=this.El).splice.apply(e,[0,this.El.length].concat((0,d._)(t))):this.El=(0,d._)(t),t.length>0?this.El:void 0):(eu(this.El)&&this.El.splice(0),this.El=t||void 0,this.El)}},{key:"Qo",value:function(){var e,t;null==(e=this.Ml)||e.call(this),null==(t=this.Tl)||t.call(this),this.Ml=void 0,this.Tl=void 0}},{key:"startIfEnabledOrStop",value:function(){this.Il()?this.ai(this.Uo):this.Qo()}}]),e}()},aS=C({surveys:function(){function e(t){(0,u._)(this,e),this.Rl=void 0,this._surveyManager=null,this.Al=!1,this.Fl=[],this.Ll=null,this.Ol=null,this._instance=t,this._surveyEventReceiver=null}return(0,l._)(e,[{key:"Ne",get:function(){return this._instance.config}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this.Ne.disable_surveys){if(!e.ok)return ou.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(eg(t))return ou.warn("Flags not loaded yet. Not loading surveys.");var n=eu(t);this.Rl=n?t.length>0:t,ou.info("flags response received, isSurveysEnabled: "+this.Rl),this.loadIfEnabled()}}},{key:"reset",value:function(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);(null!=i&&i.startsWith(ol)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(function(e){return localStorage.removeItem(e)})}catch(e){}}},{key:"loadIfEnabled",value:function(){var e=this;if(!this._surveyManager)if(this.Al)ou.info("Already initializing surveys, skipping...");else if(this.Ne.disable_surveys)ou.info(o8);else if(this.Ne.cookieless_mode&&this._instance.consent.isOptedOut())ou.info("Not loading surveys in cookieless mode without consent.");else{var t=null==$?void 0:$.__PosthogExtensions__;if(t){if(!ef(this.Rl)||this.Ne.advanced_enable_surveys){var n=this.Rl||this.Ne.advanced_enable_surveys;this.Al=!0;try{var i=t.generateSurveys;if(i)return void this.Dl(i,n);var r=t.loadExternalDependency;if(!r)return void this.$l(n9);r(this._instance,"surveys",function(i){i||!t.generateSurveys?e.$l("Could not load surveys script",i):e.Dl(t.generateSurveys,n)})}catch(e){throw this.$l("Error initializing surveys",e),e}finally{this.Al=!1}}}else ou.error("PostHog Extensions not found.")}}},{key:"Dl",value:function(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new o5(this._instance),ou.info("Surveys loaded successfully"),this.Nl({isLoaded:!0})}},{key:"$l",value:function(e,t){ou.error(e,t),this.Nl({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.Fl.push(e),this._surveyManager&&this.Nl({isLoaded:!0}),function(){t.Fl=t.Fl.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e,t){var n=this;if(void 0===t&&(t=!1),this.Ne.disable_surveys)return ou.info(o8),e([]);var i,r=this._instance.get_property(nH);r&&!t?(e(r,{isLoaded:!0}
1),this.ql()&&this.getSurveys(function(){},!0)):"u">typeof Promise&&this.Ll?this.Ll.then(function(t){return e(t.surveys,t.context)}):("u">typeof Promise&&(this.Ll=new Promise(function(e){i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ne.token),method:"GET",timestampMode:"query",timeout:this.Ne.surveys_request_timeout_ms,callback:function(t){n.Ll=null;var r,s=t.statusCode;if(200!==s||!t.json){var o="Surveys API could not be loaded, status: "+s;0!==s?ou.error(o):t.error||ou.warn(o),n.Ol=Date.now();var a={isLoaded:!1,error:o};return e([],a),void(null==i||i({surveys:[],context:a}))}n.Ol=null;var u,l,h=t.json.surveys||[],f=h.filter(function(e){var t;return!(!e.start_date||e.end_date)&&(oa(e)||!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length))});f.length>0&&(null==(l=n._surveyEventReceiver)||l.register(f)),null==(u=n._instance.persistence)||u.register((r={},(0,c._)(r,nH,h),(0,c._)(r,nB,Date.now()),r));var d={isLoaded:!0};e(h,d),null==i||i({surveys:h,context:d})}}))}},{key:"ql",value:function(){return this.jl()&&!this.Ll&&!this.Bl()}},{key:"jl",value:function(){var e=this._instance.get_property(nB);return e_(e)&&Date.now()-e>3e5}},{key:"Bl",value:function(){return e_(this.Ol)&&3e5>Date.now()-this.Ol}},{key:"markSurveyAsSeen",value:function(e,t){var n;oc({id:e,current_iteration:null!=(n=null==t?void 0:t.iteration)?n:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}},{key:"Nl",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.Fl[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;try{if(!e.isLoaded)return o([],e);this.getSurveys(o)}catch(e){ou.error("Error in survey callback",e)}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"getActiveMatchingSurveys",value:function(e,t){if(void 0===t&&(t=!1),!eg(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);ou.warn("init was not called")}},{key:"Hl",value:function(e){var t=null;return this.getSurveys(function(n){var i;t=null!=(i=n.find(function(t){return t.id===e}))?i:null}),t}},{key:"Ul",value:function(e){if(eg(this._surveyManager))return{eligible:!1,reason:o4};var t="string"==typeof e?this.Hl(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"zl",value:function(e){if(eg(this._surveyManager))return{eligible:!1,reason:o4};var t="string"==typeof e?this.Hl(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(eg(this._surveyManager))return ou.warn("init was not called"),{visible:!1,disabledReason:o4};var t=this.zl(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;return eg(this._surveyManager)?(ou.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:o4})):new Promise(function(i){n.getSurveys(function(t){var r,s=null!=(r=t.find(function(t){return t.id===e}))?r:null;if(s){var o=n.zl(s);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}},{key:"renderSurvey",value:function(e,t,n){var i,r=this;if(eg(this._surveyManager))ou.warn("init was not called");else{var s="string"==typeof e?this.Hl(e):e;if(null!=s&&s.id)if(oh.includes(s.type)){var o=null==m?void 0:m.querySelector(t);if(o)return null!=(i=s.appearance)&&i.surveyPopupDelaySeconds?(ou.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(function(){var e,t;ou.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=r._surveyManager)||t.renderSurvey(s,o,n),ou.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,o,n);ou.warn("Survey element not found")}else ou.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ou.warn("Survey not found")}}},{key:"displaySurvey",value:function(e,t){var n;if(eg(this._surveyManager))ou.warn("init was not called");else{var i=this.Hl(e);if(i){var r=i;if(null!=(n=i.appearance)&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=C({},i,{appearance:C({},i.appearance,{surveyPopupDelaySeconds:0})}
1)),t.displayType!==se&&t.initialResponses&&ou.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.Ul(i);if(!s.eligible)return void ou.warn("Survey is not eligible to be displayed: ",s.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else ou.warn("Survey not found")}}},{key:"cancelPendingSurvey",value:function(e){eg(this._surveyManager)?ou.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}]),e}()},ay),aP={toolbar:function(){function e(t){(0,u._)(this,e),this.instance=t}return(0,l._)(e,[{key:"Wl",value:function(e){$.ph_toolbar_state=e}},{key:"Vl",value:function(){var e;return null!=(e=$.ph_toolbar_state)?e:0}},{key:"initialize",value:function(){return this.maybeLoadToolbar()}},{key:"maybeLoadToolbar",value:function(e,t,n){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),iw(this.instance.config)||!g||!m)return!1;e=null!=e?e:g.location,n=null!=n?n:g.history;try{if(!t){try{g.localStorage.setItem("test","test"),g.localStorage.removeItem("test")}catch(e){return!1}t=null==g?void 0:g.localStorage}var i,r=o6||rN(e.hash,"__posthog")||rN(e.hash,"state"),s=r?i_(function(){return JSON.parse(atob(decodeURIComponent(r)))})||i_(function(){return JSON.parse(decodeURIComponent(r))}):null;return s&&"ph_authorize"===s.action?((i=s).source="url",i&&Object.keys(i).length>0&&(s.desiredHash?e.hash=s.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(o7)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}},{key:"Zl",value:function(e){var t=$.ph_load_toolbar||$.ph_load_editor;!eg(t)&&el(t)?t(e,this.instance):o9.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t,n=this,i=!(null==m||!m.getElementById(iG));if(!g||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=C({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(g.localStorage.setItem(o7,JSON.stringify(C({},s,{source:void 0}))),2===this.Vl())?this.Zl(s):0===this.Vl()&&(this.Wl(1),null==(t=$.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",function(e){e?(o9.error("[Toolbar] Failed to load",e),n.Wl(0)):(n.Wl(2),n.Zl(s))}),ib(g,"turbolinks:load",function(){n.Wl(0),n.loadToolbar(s)})),!0}},{key:"Gl",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(e,t,n){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===n&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}]),e}()},aF=C({experiments:ah},ay),a$={conversations:function(){function e(t){(0,u._)(this,e),this.Ql=void 0,this._conversationsManager=null,this.Kl=!1,this.Jl=null,this.Yl=!1,this._instance=t}return(0,l._)(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this._instance.config.disable_conversations&&(this.Xl=e.ok,e.ok)){var t=e.config.conversations;eg(t)||(em(t)?this.Ql=t:(this.Ql=t.enabled,this.Jl=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Ql=void 0,this.Jl=null,this.Xl=void 0,this.Yl=!1}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.Kl||this._instance.config.disable_conversations||iw(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==$?void 0:$.__PosthogExtensions__;if(t&&!ef(this.Ql)&&this.Ql)if(this.Jl&&this.Jl.token){this.Kl=!0;try{var n=t.initConversations;if(n)return this.tu(n),void(this.Kl=!1);var i=t.loadExternalDependency;if(!i)return void this.eu(n9);i(this._instance,"conversations",function(n){n||!t.initConversations?e.eu("Could not load conversations script",n):e.tu(t.initConversations),e.Kl=!1})}catch(e){this.eu("Error initializing conversations",e),this.Kl=!1}}else af.error("Conversations enabled but missing token in remote config.")}}},{key:"tu",value:function(e){if(this.Jl)try{this._conversationsManager=e(this.Jl,this._instance),this.Yl=!1,af.info("Conversations loaded successfully")}catch(e){this.eu("Error completing conversations initialization",e)}else af.error("Cannot complete initialization: remote config is null")}},{key:"eu",value:function(e,t){af.error(e,t),this._conversationsManager=null,this.Kl=!1,this.Yl=!0}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():af.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Ql&&!ep(this._conversationsManager)}},{key:"getUnavailableReason",value:function(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":iw(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Xl?"remote_config_failed":ef(this.Ql)?this.Xl?"disabled_in_project":"remote_config_pending":this.Ql?eg(this.Jl)||!this.Jl.token?"missing_token":null!=$&&$.__PosthogExtensions__?this.Kl?"initializing":this.Yl?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}},{key:"isVisible",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}},{key:"sendMessage",value:function(e,t,n){var i=this;return M(function(){return(0,p._)(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(af.warn(ad),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return M(function(){return(0,p._)(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(af.warn(ad),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return M(function(){return(0,p._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(af.warn(ad),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return M(function(){return(0,p._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(af.warn(ad),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return M(function(){return(0,p._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(af.warn(ad),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return M(function(){return(0,p._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(af.warn(ad),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return M(function(){return(0,p._)(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(af.warn(ad),null)]})})()}},{key:"getCurrentTicketId",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}},{key:"getWidgetSessionId",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}},{key:"Xn",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"ts",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},aI={logs:function(){function e(t){var n=this;(0,u._)(this,e);var i,r=this;this.iu=!1,this.ru=!1,this.rt=ns("[logs]"),this.nu=C({},this.rt,{error:function(){for(var e,t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];n.some(a_)||(e=r.rt).error.apply(e,(0,d._)(n))}}),this.tr=[],this.su=[],this.Sa=0,this.au=function(){var e,t;n.Sa=0,null==(e=n.ou)||e.onReconnect(),null==(t=n.lu)||t.onReconnect()},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.iu=!0),g&&ib(g,"online",this.au)}return(0,l._)(e,[{key:"uu",value:function(e,t,n,i){var r,s,o,a,u,l,c,h,f,d,v,p,g,_,y=this,m=(r=null==(_=this._instance)||null==(_=_.config)?void 0:_.logs,f=null!=(s=null==r?void 0:r.flushIntervalMs)?s:3e3,d=null!=(o=null==r?void 0:r.maxBufferSize)?o:100,p=ef(v=null!=n&&n.consoleCapture?void 0:null!=(a=null==r?void 0:r.maxLogsPerInterval)?a:1e3)?Math.max(d,2048):Math.max(d,v),{serviceName:null!=(u=null!=(l=null==(g=null==r?void 0:r.resourceAttributes)?void 0:g["service.name"])?l:null==r?void 0:r.serviceName)?u:null==n?void 0:n.serviceNameDefault,serviceVersion:null!=(c=null==g?void 0:g["service.version"])?c:null==r?void 0:r.serviceVersion,environment:null!=(h=null==g?void 0:g["deployment.environment"])?h:null==r?void 0:r.environment,resourceAttributes:g,beforeSend:null==r?void 0:r.beforeSend,flushIntervalMs:f,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:f,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new tT(this.hu(e,t),m,this.nu,function(){return y.du()},function(e){return e()},void 0,i),m]}},{key:"vu",value:function(){var e,t=this,n=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.ou||this.cu!==n){null==(i=this.ou)||i.reset(),this.cu=n;var i,r=this.uu(function(){return t.tr},function(e){t.tr=e});this.ou=r[0],this.fu=r[1]}return this.ou}},{key:"pu",value:function(){var e,t=this,n=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.lu||this.gu!==n){null==(i=this.lu)||i.reset(),this.gu=n;var i,r=this.uu(function(){return t.su},function(e){t.su=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},av);this.lu=r[0],this.mu=r[1]}return this.lu}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){var t;if(e.ok){var n=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!eg(n)&&n&&(this.iu=!0,this.loadIfEnabled())}}},{key:"reset",value:function(){var e,t;this.tr=[],null==(e=this.ou)||e.reset(),this.su=[],null==(t=this.lu)||t.reset(),this.Sa=0}},{key:"captureLog",value:function(e){this.vu().captureLog(e)}},{key:"he",value:function(e){this.pu().captureLog(e)}},{key:"logger",get:function(){var e=this;return this.yu||(this.yu={trace:function(t,n){return e.captureLog({body:t,level:"trace",attributes:n}
1)},debug:function(t,n){return e.captureLog({body:t,level:"debug",attributes:n})},info:function(t,n){return e.captureLog({body:t,level:"info",attributes:n})},warn:function(t,n){return e.captureLog({body:t,level:"warn",attributes:n})},error:function(t,n){return e.captureLog({body:t,level:"error",attributes:n})},fatal:function(t,n){return e.captureLog({body:t,level:"fatal",attributes:n})}}),this.yu}},{key:"flushLogs",value:function(e){var t=this;e?this.bu(e):(this.ou&&this.ou.flush().catch(function(e){return t._u(e)}),this.lu&&this.lu.flush().catch(function(e){return t._u(e)}))}},{key:"_u",value:function(e){a_(e)||this.rt.error("PostHog logs flush failed:",e)}},{key:"loadIfEnabled",value:function(){var e=this;if(this.iu&&!this.ru){var t=null==$?void 0:$.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,"logs",function(n){var i;n||null==(i=t.logs)||!i.initializeLogs?e.rt.error("Could not load logs script",n):(t.logs.initializeLogs(e._instance),e.ru=!0)}):this.rt.error(n9)}else this.rt.error("PostHog Extensions not found.")}}},{key:"hu",value:function(e,t){var n=this,i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:function(t){return t===B.LogsQueue?e():void 0},setPersistedProperty:function(e,n){e===B.LogsQueue&&t(null!=n?n:[])},Ot:function(e){return n.Ot(e)},getLibraryId:function(){return I.LIB_NAME},getLibraryVersion:function(){return I.LIB_VERSION}}}},{key:"Ot",value:function(e){var t=this;return new Promise(function(n){if(rA(t.Sa,3))n({kind:"fatal",error:ag(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=function(e){i||(i=!0,clearTimeout(s),n(e))},s=setTimeout(function(){t.rt.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:ag(void 0,"logs request timed out")})},9e4);t._instance._send_request({method:"POST",url:t.wu(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:function(e){var n,i=e.statusCode;(t.ku(i),i>=200&&300>i)?r({kind:"ok"}):413===i?r({kind:"too-large"}):0!==i&&429!==i&&500>i?r({kind:"fatal",error:Error("logs request failed with status "+i)}):0===i?(e.error||t.rt.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:ag(e.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!=(n=e.error)?n:Error("logs request failed with status "+i)})}})}})}},{key:"ku",value:function(e){var t=this;(0!==e||this._instance.__loaded)&&(this.Sa=rL(e,this.Sa,3,function(){return t.rt.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.")}))}},{key:"bu",value:function(e){var t=this;this.tr.length>0&&this.xu(e,this.tr,this.fu,I.LIB_NAME,function(e){t.tr=e}),this.su.length>0&&this.xu(e,this.su,this.mu,av,function(e){t.su=e})}},{key:"xu",value:function(e,t,n,i,r){if(0!==t.length){var s=t.map(function(e){return e.record});r([]);var o=tO(s,tC(n,I.LIB_NAME,I.LIB_VERSION),i,I.LIB_VERSION);this._instance._send_request({method:"POST",url:this.wu(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}},{key:"wu",value:function(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}},{key:"du",value:function(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.windowId,r=n.sessionStartTimestamp,s=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=i,eg(r)||(t.sessionStartTimestamp=r),eg(s)||(t.lastActivityTimestamp=s)}if(null!=$&&null!=(e=$.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tS($.location.href):$.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}]),e}()},aR={metrics:function(){function e(t){(0,u._)(this,e),this.rt=ns("[metrics]"),this._instance=t}return(0,l._)(e,[{key:"initialize",value:function(){}},{key:"vu",value:function(){var e,t,n,i,r,s,o,a,u=null==(o=this._instance)||null==(o=o.config)?void 0:o.metrics;return this.ou&&this.cu===u||(null==(a=this.ou)||a.reset(),this.cu=u,this.ou=new tD(this.hu(),{serviceName:null!=(e=null==(s=null==u?void 0:u.resourceAttributes)?void 0:s["service.name"])?e:null==u?void 0:u.serviceName,serviceVersion:null!=(t=null==s?void 0:s["service.version"])?t:null==u?void 0:u.serviceVersion,environment:null!=(n=null==s?void 0:s["deployment.environment"])?n:null==u?void 0:u.environment,resourceAttributes:s,beforeSend:null==u?void 0:u.beforeSend,flushIntervalMs:null!=(i=null==u?void 0:u.flushIntervalMs)?i:1e4,maxSeriesPerFlush:null!=(r=null==u?void 0:u.maxSeriesPerFlush)?r:1e3},this.rt)),this.ou}},{key:"count",value:function(e,t,n){void 0===t&&(t=1),this.vu().count(e,t,n)}},{key:"gauge",value:function(e,t,n){this.vu().gauge(e,t,n)}},{key:"histogram",value:function(e,t,n){this.vu().histogram(e,t,n)}},{key:"flush",value:function(e){var t=this;if(!this.ou)return Promise.resolve();if(e){var n=this.ou.drainWindow();return n&&this.Jt(n,e),Promise.resolve()}return this.ou.flush().catch(function(e){return t.rt.error("PostHog metrics flush failed:",e)})}},{key:"reset",value:function(){var e;null==(e=this.ou)||e.reset()}},{key:"hu",value:function(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Jt:function(e){return t.Jt(e)},getLibraryId:function(){return I.LIB_NAME},getLibraryVersion:function(){return I.LIB_VERSION}}}},{key:"Jt",value:function(e,t){var n=this;return new Promise(function(i){var r=!1,s=function(e){r||(r=!0,clearTimeout(o),i(e))},o=setTimeout(function(){return s({kind:"retry-later",error:Error("metrics request timed out")})},9e4);n._instance._send_request(C({method:"POST",url:n.Su(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback:function(e){var t,n=e.statusCode;n>=200&&300>n?s({kind:"ok"}):413===n?s({kind:"too-large"}):0!==n&&429!==n&&500>n?s({kind:"fatal",error:Error("metrics request failed with status "+n)}):s({kind:"retry-later",error:null!=(t=e.error)?t:Error("metrics request failed with status "+n)})}}))})}},{key:"Su",value:function(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}]),e}()},aM=C({},ay,am,ak,ab,aw,ax,aS,aE,aP,aF,a$,aI,aR);oT.__defaultExtensionClasses=C({},aM);var aC=(I.SDK_DIST_CHANNEL="npm",i=ok[o$]=new oT,function(){function e(){e.done||(e.done=!0,oI=!1,iv(ok,function(e){e._dom_loaded()}))}null!=m&&m.addEventListener?"complete"===m.readyState?e():ib(m,"DOMContentLoaded",e,{capture:!1}):g&&nr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),i);e.s(["default",0,aC],4570);var aO="phc_xF5VrcKuNgYUhkQ9jLy7UpNQpZYkijzXm8ZiP7KXgxZN",aT=!1;function aN(e,t){!aT&&aO&&(aT=!0,aC.init(aO,{api_host:"https://eu.i.posthog.com",defaults:"2025-05-24",persistence:e?"localStorage+cookie":"memory",bootstrap:t,autocapture:!1,disable_session_recording:!0,disable_surveys:!0,capture_exceptions:!1}))}function aA(e){aT&&aC.set_config({persistence:e?"localStorage+cookie":"memory"})}function aL(e){aT&&aC.getFeatureFlag(e)}e.s(["capturePostHog",0,function(e,t){aT&&aC.capture(e,t)},"initPostHog",0,aN,"reportFeatureFlag",0,aL,"updatePostHogConsent",0,aA],91098),e.s(["default",0,function(e){var t=e.bootstrap,n=(0,o.useConsent)();return(0,s.useEffect)(function(){var e;aN(n.marketing,t),aA(n.marketing),Object.keys(null!=(e=null==t?void 0:t.featureFlags)?e:{}
1).forEach(aL)},[n.marketing,t]),null}],44738)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.