1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[t]=`b2be95e1-0792-436c-85f4-7a4454b8e04c`)}catch{}})();import{c as e,n as t,o as n,s as r}from"./schemas-BccRhYrg.js";import{n as i}from"./public-pages-PsS9uijZ.js";var a=typeof window<`u`?window:void 0,o=typeof globalThis<`u`?globalThis:a,s=o?.navigator,c=o?.document,l=o?.location,u=o?.fetch,d=o!=null&&o.XMLHttpRequest&&`withCredentials`in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,f=o?.AbortController,p=o?.CompressionStream,m=s?.userAgent;function h(){return!(!a||!1===a.navigator.onLine)}var g=typeof globalThis<`u`?globalThis:a;g&&typeof self>`u`&&(g.self=g),g&&typeof File>`u`&&(g.File=function(){});var _=a??{},v={DEBUG:!1,LIB_VERSION:`0.7.0`,LIB_NAME:`browser-common`};function y(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){y(a,r,i,o,s,`next`,e)}function s(e){y(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x.apply(null,arguments)}function S(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var C=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function w(e){return typeof e==`string`||e}function T(e){return typeof e==`string`?e:void 0}var E=`$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`.split(`.`),D=function(e){return e.AnonymousId=`anonymous_id`,e.DistinctId=`distinct_id`,e.Props=`props`,e.EnablePersonProcessing=`enable_person_processing`,e.PersonMode=`person_mode`,e.FeatureFlagDetails=`feature_flag_details`,e.FeatureFlags=`feature_flags`,e.FeatureFlagPayloads=`feature_flag_payloads`,e.BootstrapFeatureFlagDetails=`bootstrap_feature_flag_details`,e.BootstrapFeatureFlags=`bootstrap_feature_flags`,e.BootstrapFeatureFlagPayloads=`bootstrap_feature_flag_payloads`,e.OverrideFeatureFlags=`override_feature_flags`,e.Queue=`queue`,e.AiQueue=`ai_queue`,e.AiCaptureQueue=`ai_capture_queue`,e.LogsQueue=`logs_queue`,e.OptedOut=`opted_out`,e.SessionId=`session_id`,e.SessionStartTimestamp=`session_start_timestamp`,e.SessionLastTimestamp=`session_timestamp`,e.PersonProperties=`person_properties`,e.GroupProperties=`group_properties`,e.InstalledAppBuild=`installed_app_build`,e.InstalledAppVersion=`installed_app_version`,e.SessionReplay=`session_replay`,e.PushRegistered=`push_registered`,e.SessionReplayEventTriggerActivatedSession=`session_replay_event_trigger_activated_session`,e.SurveyLastSeenDate=`survey_last_seen_date`,e.SurveysSeen=`surveys_seen`,e.Surveys=`surveys`,e.RemoteConfig=`remote_config`,e.FlagsEndpointWasHit=`flags_endpoint_was_hit`,e.DeviceId=`device_id`,e}({}),O=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),ee=[`$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`],te=[`token`],ne=20,re=1e3,ie=1e4,ae=`[Circular]`,oe=`[Truncated]`,se=`[Unserializable]`,ce=`[Function]`;function le(e){for(var t=``,n=0;e.length>n;n++){var r=e.charCodeAt(n);if(55296>r||r>56319)t+=56320>r||r>57343?e[n]:`�`;else{var i=e.charCodeAt(n+1);56320>i||i>57343?t+=`�`:(t+=e[n]+e[n+1],n++)}}return t}var ue=`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,pinterestbot,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`.split(`,`),de=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return ue.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))};function k(e,t){return e.indexOf(t)!==-1}var fe=function(e){return e.trim()},pe=function(e){return e.replace(/^\$/,``)};function me(e){var t=[];return JSON.stringify(e,(function(e,n){if(typeof n==`bigint`)return n.toString();if(typeof n!=`function`&&typeof n!=`symbol`){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n==`object`){for(;t.length>0&&t[t.length-1]!==this;)t.pop();if(t.includes(n))return`[Circular]`;
1t.push(n)}return n}}))??`null`}var he=Object.prototype,ge=he.hasOwnProperty,_e=he.toString,A=Array.isArray||function(e){return _e.call(e)===`[object Array]`},j=e=>typeof e==`function`,M=e=>e===Object(e)&&!A(e),ve=e=>{if(M(e)){for(var t in e)if(ge.call(e,t))return!1;return!0}return!1},N=e=>e===void 0,P=e=>_e.call(e)==`[object String]`,ye=e=>P(e)&&e.trim().length===0,F=e=>e===null,I=e=>N(e)||F(e),L=e=>_e.call(e)==`[object Number]`&&e==e,be=e=>L(e)&&e>0,R=e=>_e.call(e)===`[object Boolean]`,xe=e=>e instanceof FormData,Se=e=>k(ee,e),Ce=e=>k(te,e);function we(e){return typeof e!=`object`||!e}function Te(e,t){return{}.toString.call(e)===`[object `+t+`]`}function Ee(e){switch({}.toString.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object DOMError]`:case`[object WebAssembly.Exception]`:return!0;default:return Oe(e,Error)}}function De(e){return typeof Event<`u`&&Oe(e,Event)}function Oe(e,t){try{return e instanceof t}catch{return!1}}var ke=[!0,`true`,1,`1`,`yes`],Ae=e=>k(ke,e),je=[!1,`false`,0,`0`,`no`];function Me(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),L(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):t>e?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),Me(i||n,t,n,r))}var Ne=class{constructor(e){this.k={},this.S=e.S,this.C=Me(e.bucketSize,0,100,e.I),this.R=Me(e.refillRate,0,this.C,e.I),this.A=Me(e.refillInterval,0,864e5,e.I)}O(e,t){var n=Math.floor((t-e.lastAccess)/this.A);n>0&&(e.tokens=Math.min(e.tokens+n*this.R,this.C),e.lastAccess+=n*this.A)}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.k[r];return i?this.O(i,n):this.k[r]=i={tokens:this.C,lastAccess:n},i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.S)==null||t.call(this,e)),i.tokens===0)}stop(){this.k={}}},Pe=`Mobile`,Fe=`iOS`,Ie=`Android`,Le=`Tablet`,Re=Ie+` `+Le,ze=`iPad`,Be=`Apple`,Ve=Be+` Watch`,He=`Safari`,Ue=`BlackBerry`,We=`Samsung`,Ge=We+`Browser`,Ke=We+` Internet`,qe=`Chrome`,Je=qe+` OS`,Ye=qe+` `+Fe,Xe=`Internet Explorer`,Ze=Xe+` `+Pe,Qe=`Opera`,$e=Qe+` Mini`,et=`Edge`,tt=`Microsoft `+et,nt=`Firefox`,rt=nt+` `+Fe,it=`Nintendo`,at=`PlayStation`,ot=`Xbox`,st=Ie+` `+Pe,ct=Pe+` `+He,lt=`Windows`,ut=lt+` Phone`,dt=`Nokia`,ft=`Ouya`,pt=`Generic`,mt=pt+` `+Pe.toLowerCase(),ht=pt+` `+Le.toLowerCase(),gt=`Konqueror`,_t=`Oculus Browser`,vt=`Vivaldi`,yt=`Yandex`,bt=`Whale`,xt=`DuckDuckGo`,St=`Pale Moon`,Ct=`Waterfox`,wt=`Brave`,Tt=`Google Search App`,z=`(\\d+(\\.\\d+)?)`,Et=RegExp(`Version/`+z),Dt=new RegExp(ot,`i`),Ot=RegExp(at+` \\w+`,`i`),kt=RegExp(it+` \\w+`,`i`),At=RegExp(Ue+`|PlayBook|BB10`,`i`),jt={"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`},Mt=function(e,t,n,r){return t||=``,function(e){return e!=null&&e.brave?wt:null}(n)||(r!=null&&r.detectGoogleSearchApp&&k(e,`GSA/`)?Tt:k(e,` OPR/`)&&k(e,`Mini`)?$e:k(e,` OPR/`)?Qe:At.test(e)?Ue:k(e,`IE`+Pe)||k(e,`WPDesktop`)?Ze:k(e,`OculusBrowser`)?_t:k(e,Ge)?Ke:k(e,et)||k(e,`Edg/`)?tt:k(e,vt+`/`)?vt:k(e,`YaBrowser/`)?yt:k(e,bt+`/`)?bt:k(e,xt+`/`)||k(e,`Ddg/`)?xt:k(e,`FBIOS`)?`Facebook `+Pe:k(e,`UCWEB`)||k(e,`UCBrowser`)?`UC Browser`:k(e,`CriOS`)?Ye:k(e,`CrMo`)||k(e,qe)?qe:k(e,Ie)&&k(e,He)?st:k(e,`FxiOS`)?rt:k(e.toLowerCase(),gt.toLowerCase())?gt:k(e,wt+`/`)?wt:((e,t)=>t&&k(t,Be)||function(e){return k(e,He)&&!k(e,qe)&&!k(e,Ie)}(e))(e,t)?k(e,Pe)?ct:He:k(e,`PaleMoon/`)?St:k(e,Ct+`/`)?Ct:k(e,nt)?nt:k(e,`MSIE`)||k(e,`Trident/`)?Xe:k(e,`Gecko`)?nt:``)},Nt={[Ze]:[RegExp(`rv:`+z)],[tt]:[RegExp(et+`?\\/`+z)],[qe]:[RegExp(`(`+qe+`|CrMo)\\/`+z)],[Ye]:[RegExp(`CriOS\\/`+z)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+z)],[He]:[Et],[ct]:[Et],[Qe]:[RegExp(`(Opera|OPR)\\/`+z)],[nt]:[RegExp(nt+`\\/`+z)],[rt]:[RegExp(`FxiOS\\/`+z)],[gt]:[RegExp(`Konqueror[:/]?`+z,`i`)],[Ue]:[RegExp(Ue+` `+z),Et],[st]:[RegExp(`android\\s`+z,`i`)],[Ke]:[RegExp(Ge+`\\/`+z)],[_t]:[RegExp(`OculusBrowser\\/`+z)],[vt]:[RegExp(vt+`\\/`+z)],[yt]:[RegExp(`YaBrowser\\/`+z)],[bt]:[RegExp(bt+`\\/`+z)],[wt]:[RegExp(wt+`\\/`+z)],[xt]:[RegExp(`(DuckDuckGo|Ddg)\\/`+z)],[St]:[RegExp(`PaleMoon\\/`+z)],[Ct]:[RegExp(Ct+`\\/`+z)],[Tt]:[RegExp(`GSA\\/`+z)],[Xe]:[RegExp(`(rv:|MSIE )`+z)],Mozilla:[RegExp(`rv:`+z)]},Pt=function(e,t,n,r){var i=Nt[Mt(e,t,n,r)];if(N(i))return null;for(var a=0;i.length>a;a++){var o=e.match(i[a]);if(o)return parseFloat(o[o.length-2])}return null},Ft=[[RegExp(ot+`; `+ot+` (.*?)[);]`,`i`),e=>[ot,e&&e[1]||``]],[new RegExp(it,`i`),[it,``]],[new RegExp(at,`i`),[at,``]],[At,[Ue,``]],[new RegExp(lt,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ut,``];if(new RegExp(Pe).test(t)&&!/IEMobile\b/.test(t))return[lt+` `+Pe,``];var n=/Windows NT ([0-9.]+)/i.exec(t);
1if(n&&n[1]){var r=jt[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[lt,r]}return[lt,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Fe,[e[3],e[4],e[5]||`0`].join(`.`)]:[Fe,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=N(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+Ie+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+Ie+`)`,`i`),e=>e&&e[2]?[Ie,[e[2],e[3],e[4]||`0`].join(`.`)]:[Ie,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,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/,[Je,``]],[/Linux|debian/i,[`Linux`,``]]],It=function(e){return kt.test(e)?it:Ot.test(e)?at:Dt.test(e)?ot:new RegExp(ft,`i`).test(e)?ft:RegExp(`(`+ut+`|WPDesktop)`,`i`).test(e)?ut:/iPad/.test(e)?ze:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ve:At.test(e)?Ue:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(dt,`i`).test(e)?dt:/(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(Pe).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)?Ie:Re:RegExp(`(pda|`+Pe+`)`,`i`).test(e)?mt:new RegExp(Le,`i`).test(e)&&!RegExp(Le+` pc`,`i`).test(e)?ht:``},Lt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Rt(e,t){return typeof(n=e)==`string`&&Lt.test(n)?e:t();var n}function zt(e,t){var n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Bt(e){return e&&e.split(`#`)[0]}function Vt(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&n?.unref(),n}function Ht(e,t,n){return Ut.apply(this,arguments)}function Ut(){return(Ut=b((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((e,i)=>{r=Vt((()=>{try{n?.(),e()}catch(e){i(e)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Wt,Gt=`NativeGzipValidationError`,Kt=e=>e.length>=2&&e[0]===31&&e[1]===139,qt=(e,t)=>e===O.GZipJS||t===O.GZipJS||t===`gzip`,Jt=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,Yt=e=>{throw zt(Gt,`Native gzip produced invalid output: `+e)},Xt=function(){var e=b((function*(e,t){18>e.size&&Yt(`too-short`);var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());Kt(n)&&n[2]===8||Yt(`invalid-header`);var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Wt)return Wt;Wt=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;Wt[e]=t>>>0}return Wt})(),n=4294967295,r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&Yt(`invalid-crc`);var i=t.length>>>0;r.getUint32(4,!0)!==i&&Yt(`invalid-size`)}));return function(t,n){return e.apply(this,arguments)}}();function Zt(){return Zt=b((function*(e,t,n){t===void 0&&(t=!0);try{var r=new TextEncoder().encode(e),i=new globalThis.CompressionStream(`gzip`),a=i.writable.getWriter(),o=a.write(r).then((()=>a.close())).catch(function(){var e=b((function*(e){try{yield a.abort(e)}catch{}throw e}));return function(t){return e.apply(this,arguments)}}()),s=new Response(i.readable).blob(),c=(yield Promise.all([s,o]))[0];return yield Xt(c,r),c}catch(e){if(n!=null&&n.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}})),Zt.apply(this,arguments)}var Qt={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}},$t=Qt.info,en=0x8000000000000000,tn={}.propertyIsEnumerable;function nn(e,t){try{return on(e,t,{ancestors:new WeakSet,remainingNodes:ie},0)}catch{return[]}}function rn(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:oe};if(n.remainingNodes--,R(e))return{boolValue:e};if(typeof e==`number`){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>`u`)return{stringValue:String(e)};var i=BigInt(e).toString();return e>=en||-en>e?(t?.debug(`Attribute `+i+` is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if(typeof e==`string`)return{stringValue:le(e)};if(typeof e==`function`)return{stringValue:ce};if(typeof e==`symbol`)return{stringValue:String(e)};if(typeof e==`object`&&e){if(n.ancestors.has(e))return{stringValue:ae};if(r>=ne)return{stringValue:oe};if(e instanceof Date){var a=e.getTime(),o=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof o==`string`?le(o):String(o)}}n.ancestors.add(e);try{try{var s=e.toJSON;if(typeof s==`function`)return rn(s.call(e),t,n,r+1)}catch{}return A(e)?{arrayValue:{values:an(e,t,n,r+1)}}:{kvlistValue:{values:on(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:le(String(e))}}function an(e,t,n,r){for(var i=[],a=Math.min(e.length,re),o=0;a>o&&n.remainingNodes>0;o++)try{var s=o in e?e[o]:void 0;if(I(s))continue;i.push(rn(s,t,n,r))}catch{i.push({stringValue:se})}return e.length>
1o&&i.push({stringValue:oe}),i}function on(e,t,n,r){var i=[];for(var a in e)if(tn.call(e,a)){if(i.length>=re||0>=n.remainingNodes){t?.debug(`Attributes truncated: the value exceeds the OTLP encoder budget`);break}try{var o=e[a];if(F(o)||N(o))continue;i.push({key:le(a),value:rn(o,t,n,r)})}catch{i.push({key:le(a),value:{stringValue:se}})}}return i}function sn(e){try{return le(String(e))}catch{return se}}function cn(e,t,n,r){var i,a=Qt[e.level||`info`]||$t,o=a.text,s=a.number,c=((i=L(r)?r:void 0)===void 0&&(i=Date.now()),String(i)+`000000`),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l[`window.id`]=t.windowId),I(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),I(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l[`url.full`]=t.currentUrl),t.screenName&&(l[`screen.name`]=t.screenName),t.appState&&(l[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);var u=x({},l),d=e.attributes;if(d){var f=[];try{f=Object.keys(d)}catch{f=[]}for(var p of f){var m=void 0;try{m=d[p]}catch{m=se}Object.defineProperty(u,p,{value:m,enumerable:!0,writable:!0,configurable:!0})}}var h={timeUnixNano:c,observedTimeUnixNano:c,severityNumber:s,severityText:o,body:{stringValue:sn(e.body)},attributes:nn(u,n)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),N(e.trace_flags)||(h.flags=e.trace_flags),h}
1function ln(e,t,n){return x({},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 un(e,t,n,r){return{resourceLogs:[{resource:{attributes:nn(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var dn=class{constructor(e,t,n,r,i,a,o){a===void 0&&(a=()=>Promise.resolve()),this._instance=e,this.vn=t,this.I=n,this.Pn=r,this.An=i,this.Fn=a,this.On=o,this.Ln=null,this.Dn=0,this.$n=0,this.Nn=0,this.qn=0,this.jn=0,this.Bn=!1,this.Hn=t.maxBufferSize,this.zn=Math.max(t.maxQueueSize??t.maxBufferSize,t.maxBufferSize),this.Un=t.flushIntervalMs,this.Wn=t.maxBatchRecordsPerPost,this.Vn=t.rateCapWindowMs,this.Gn=t.maxLogsPerInterval}clearQueue(){this.$n++,this._instance.setPersistedProperty(D.LogsQueue,[])}reset(){this.Zn(),this.qn=0,this.jn=0,this.Bn=!1,this.Nn=0,this.Wn=this.vn.maxBatchRecordsPerPost}onReconnect(){this.Nn=0,this.Qn()}captureLog(e,t){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var n=this.Jn(e);if(n!==null){if(n.body){if(this.Kn()){var r={record:cn(n,t?.context??this.Pn(),this.I,t?.occurredAtMs)};this.An((()=>this.Yn(r)))}}else this.I.info(`Log was rejected in beforeSend function`)}}}Jn(e){var t=this.vn.beforeSend;if(!t)return e;var n=A(t)?t:[t],r=e;for(var i of n)try{var a=i(r);if(!a)return this.I.info(`Log was rejected in beforeSend function`),null;r=a}catch(e){return this.I.error(`Error in beforeSend function for log:`,e),null}return r}Kn(){if(this.Gn===void 0)return!0;var e=Date.now(),t=e-this.qn;return this.Vn>t&&t>=0||(this.qn=e,this.jn=0,this.Bn=!1),this.Gn>this.jn?(this.jn++,!0):(this.Bn||=(this.I.warn(`captureLog dropping logs: exceeded `+this.Gn+` logs per `+this.Vn+`ms`),!0),!1)}flush(){var e=this;return b((function*(){if(!e._instance.isDisabled)return e.Ln||=e.Xn().finally((()=>{e.Ln=null})),e.Ln}))()}Xn(){var e=this;return b((function*(){e.Zn();var t=e._instance.getPersistedProperty(D.LogsQueue)??[];if(t.length!==0)for(var n=t.length,r=0;t.length>0&&n>r;){var i=e.$n;e.Dn=0;var a=Math.min(t.length,e.Wn),o=t.slice(0,a),s=un(o.map((e=>e.record)),e.ts(),e.On??e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.es(s);if(e.$n!==i)return;if(c.kind===`too-large`&&o.length>1)e.Wn=Math.max(1,Math.floor(o.length/2)),e.I.warn(`Received 413 when sending logs batch of size `+o.length+`, reducing batch size to `+e.Wn);else if(c.kind===`retry-later`||(c.kind===`too-large`?e.I.warn(`Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further.`):c.kind===`ok`&&e.vn.maxBatchRecordsPerPost>e.Wn&&(e.Wn=Math.min(e.vn.maxBatchRecordsPerPost,e.Wn+1)),yield e.rs(o.length),t=e._instance.getPersistedProperty(D.LogsQueue)??[],r+=o.length,c.kind===`fatal`))throw c.error}}))()}rs(e){var t=this;return b((function*(){var n=Math.max(0,e-t.Dn),r=t._instance.getPersistedProperty(D.LogsQueue)??[];t._instance.setPersistedProperty(D.LogsQueue,r.slice(n)),yield t.Fn()}))()}ts(){return ln(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Yn(e){if(!this._instance.optedOut){var t=this._instance.getPersistedProperty(D.LogsQueue)??[];this.zn>t.length||(t.shift(),this.Dn++,this.I.info(`Logs queue is full, dropping oldest record.`)),t.push(e),this._instance.setPersistedProperty(D.LogsQueue,t),this.Hn>t.length?this.ns():this.Qn()}}ns(e){e===void 0&&(e=this.Un),this.ss||=Vt((()=>{this.ss=void 0,this.Qn()}),e)}os(){var e=Math.min(Math.max(0,this.Nn-1),6);return this.Un*2**e}ls(){var e=this._instance.getPersistedProperty(D.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return b((function*(){t.Zn();var n=t.flush().catch((()=>{}));e===void 0?yield n:yield Ht(n,e)}))()}flushWithTimeout(e){var t=this;return b((function*(){var n=t.flush();yield Ht(n,e,(()=>{n.catch((()=>{}))}))}))()}Qn(){this.flush().then((()=>{this.Nn=0}),(e=>{this.Nn++,this.I.error(`PostHog logs flush failed:`,e)})).finally((()=>{!this._instance.isDisabled&&this.ls()&&this.ns(this.os())}))}Zn(){this.ss&&=(clearTimeout(this.ss),void 0)}},fn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pn(e){return String(e)+`000000`}function mn(e,t,n,r){var i=``;return r&&(i=Object.keys(r).sort().map((e=>JSON.stringify(e)+`:`+JSON.stringify(r[e]))).join(`,`)),e+`\0`+t+`\0`+(n??``)+`\0`+i}var hn=class{constructor(e,t,n){this._instance=e,this.vn=t,this.I=n,this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set,this.cs=0}count(e,t,n){t===void 0&&(t=1),this.fs({name:e,type:`count`,value:t,unit:n?.unit,attributes:n?.attributes})}
1gauge(e,t,n){this.fs({name:e,type:`gauge`,value:t,unit:n?.unit,attributes:n?.attributes})}histogram(e,t,n){this.fs({name:e,type:`histogram`,value:t,unit:n?.unit,attributes:n?.attributes})}flush(){var e=this,t=this.Ln,n=function(){var n=b((function*(){t&&(yield t.catch((()=>{}))),yield e.ps()}));return function(){return n.apply(this,arguments)}}()().finally((()=>{this.Ln===n&&(this.Ln=null)}));return this.Ln=n,n}drainWindow(){if(this.us.size===0)return null;var e=this.us;return this.us=new Map,this.hs=!1,this.ds=new Map,this.vs=new Set,this.gs(e)}reset(){this.cs++,this.Zn(),this.us=new Map,this.Ln=null,this.hs=!1,this.ds=new Map,this.vs=new Set}fs(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Jn(e);if(t!==null){if(t.name&&typeof t.name==`string`){if(typeof t.value==`number`&&Number.isFinite(t.value)){if(t.type===`count`&&0>t.value)this.I.warn(`Dropping count '`+t.name+`': counters are monotonic, value must be >= 0`);else{var n,r;try{n=t.attributes?x({},t.attributes):void 0,r=mn(t.type,t.name,t.unit,n)}catch(e){this.I.warn(`Dropping metric '`+t.name+`': attributes could not be serialized`,e);return}var i=this.us.get(r);if(!i){if(!this.ys())return;i={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.us.set(r,i)}var a=this.ds.get(t.name);a===void 0?this.ds.set(t.name,t.type):a===t.type||this.vs.has(t.name)||(this.vs.add(t.name),this.I.warn(`Metric name '`+t.name+`' is already used as a `+a+`; recording it as a `+t.type+` too will blend both series in charts. Use a distinct name.`)),this.bs(i,t.value),this.ns()}}else this.I.warn(`Dropping metric '`+t.name+`': value must be a finite number`)}else this.I.warn(`Dropping metric with empty name`)}}}ys(){return this.vn.maxSeriesPerFlush>this.us.size||(this.hs||(this.hs=!0,this.I.warn(`Metric series cap reached (`+this.vn.maxSeriesPerFlush+` per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}bs(e,t){switch(e.type){case`count`:e.total=(e.total??0)+t;break;case`gauge`:e.last=t;break;case`histogram`:e.hist||={count:0,sum:0,min:t,max:t,bucketCounts:Array(fn.length+1).fill(0)};var n=e.hist;n.count+=1,n.sum+=t,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.bucketCounts[function(e,t){for(var n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}(t,fn)]+=1}}Jn(e){var t=this.vn.beforeSend;if(!t)return e;var n=A(t)?t:[t],r=e;for(var i of n)try{var a=i(r);if(!a)return this.I.info(`Metric was rejected in beforeSend function`),null;r=a}catch(e){return this.I.error(`Error in beforeSend function for metric:`,e),null}return r}ns(){this.ss||=Vt((()=>{this.ss=void 0,this.flush().catch((e=>{this.I.error(`Metrics flush failed:`,e)}))}),this.vn.flushIntervalMs)}Zn(){this.ss&&=(clearTimeout(this.ss),void 0)}ps(){var e=this;return b((function*(){if(e.us.size!==0){var t=e.us;e.us=new Map,e.hs=!1,e.ds=new Map,e.vs=new Set;var n=e.cs,r=yield e._instance._s(e.gs(t));if(n===e.cs)switch(r.kind){case`ok`:return;case`retry-later`:e.ws(t),e.ns();return;case`too-large`:e.I.warn(`Metrics batch exceeded the server size limit and was dropped`);return;case`fatal`:e.I.error(`Failed to send metrics batch:`,r.error);return}}}))()}gs(e){return t=this.ks(e),n=function(e,t,n){return x({},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})}(this.vn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:nn(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}ks(e){var t=pn(Date.now()),n=new Map;for(var r of e.values()){var i=mn(r.type,r.name,r.unit,void 0),a=n.get(i);a||(a=x({name:r.name},r.unit&&{unit:r.unit}),r.type===`count`?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type===`gauge`?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},n.set(i,a));var o=nn(r.attributes??{},this.I),s=pn(r.windowStartMs);if(r.type===`count`){var c={attributes:o,startTimeUnixNano:s,timeUnixNano:t,asDouble:r.total??0};a.sum.dataPoints.push(c)}else if(r.type===`gauge`){var l={attributes:o,timeUnixNano:t,asDouble:r.last??0};a.gauge.dataPoints.push(l)}else r.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:s,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:fn})}return Array.from(n.values())}ws(e){for(var t of e){var n=t[0],r=t[1],i=this.us.get(n);if(i)switch(i.windowStartMs=Math.min(i.windowStartMs,r.windowStartMs),i.type){case`count`:i.total=(i.total??0)+(r.total??0);break;case`gauge`:break;case`histogram`:if(r.hist){if(i.hist){i.hist.count+=r.hist.count,i.hist.sum+=r.hist.sum,i.hist.min=Math.min(i.hist.min,r.hist.min),i.hist.max=Math.max(i.hist.max,r.hist.max);for(var a=0;i.hist.bucketCounts.length>a;a++)i.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else i.hist=r.hist}}else this.ys()&&this.us.set(n,r)}}},gn,_n,vn;function yn(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return vn&&n.length===_n||(_n=n.length,vn=n.reduce(((n,r)=>{gn||={};var i=gn[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o]?.filename,c=t[r];
1if(s&&c){n[s]=c,gn[r]=[s,c];break}}return n}),{})),vn}}var bn=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return b((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&A(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),x({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return b((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i={type:e.type,value:e.value,mechanism:{type:t.type??`generic`,handled:(n=t.handled)==null||n,synthetic:(r=e.synthetic)!=null&&r}};e.stack&&(i.stacktrace={type:`raw`,frames:e.stack});var a=[i];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,x({},t,{handled:!0}))),a}buildParsingContext(e){return{chunkIdMap:yn(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(4>=r){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return x({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},xn=`?`;function Sn(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?xn:n,in_app:!(t!=null&&t.startsWith(`webkit-masked-url://`))&&t!==`<anonymous>`};return N(r)||(a.lineno=r),N(i)||(a.colno=i),a}var Cn=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?xn:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},wn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Tn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,En=/\((\S*)(?::(\d+))(?::(\d+))\)/,Dn=(e,t)=>{var n=wn.exec(e);if(n)return Sn(t,n[1],xn,+n[2],+n[3]);var r=Tn.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){var i=En.exec(r[2]);i&&(r[2]=i[1],r[3]=i[2],r[4]=i[3])}var a=Cn(r[1]||xn,r[2]);return Sn(t,a[1],a[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},On=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,An=(e,t)=>{var n=On.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=kn.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||xn,o=Cn(a,i);return Sn(t,i=o[1],a=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},jn=/\(error: (.*)\)/,Mn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=P(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}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return Te(e,`DOMException`)}isDOMError(e){return Te(e,`DOMError`)}},Nn=class{match(e){return Ee(e)}coerce(e,t){var n=this.getStack(e),r=n===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:n??t.syntheticException?.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return String(n.error&&typeof n.error.message==`string`?n.error.message:n)}getStack(e){return e.stacktrace||e.stack||void 0}},Pn=class{constructor(){}match(e){return!!Te(e,`ErrorEvent`)&&(e.error!=null||this.$i(e))}coerce(e,t){if(e.error!=null)return t.apply(e.error);var n=t.apply(e.message);return x({},n,{stack:this.Ui(e)??n.stack,synthetic:!0})}$i(e){return P(e.message)&&e.message.length>0}Ui(e){var t=e,n=t.lineno??0,r=t.colno??0;if(P(t.filename)&&t.filename.length!==0&&n!==0)return`Error 2 at `+t.filename+`:`+n+`:`+r}},Fn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,In=class{match(e){return typeof e==`string`}coerce(e,t){var n=this.getInfos(e),r=n[0],i=n[1];return{type:r??`Error`,value:i??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Fn);return r&&(t=r[1],n=r[2]),[t,n]}},Ln=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function Rn(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(t>=i.length)return r===n.length?i:i.length>t?i.slice(0,t)+`...`:i}return``}var zn=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:this.getStack(e)??t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){if(De(e))return e.constructor.name;var t=`name`in e?e.name:void 0;return P(t)&&!ye(t)?t:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+Rn(e)}isSeverityLevel(e){return P(e)&&!ye(e)&&Ln.indexOf(e)>=0}getStack(e){try{return P(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:P(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var n=e[t];if(Ee(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Bn=class{match(e){return De(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+Rn(e),stack:t.syntheticException?.stack,synthetic:!0}}},Vn=class{match(e){return we(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},Hn=class{match(e){return Te(e,`PromiseRejectionEvent`)||this.isCu
2stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!De(e))return!1;try{var t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return we(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if(`reason`in e)return e.reason;if(`detail`in e&&e.detail!=null&&typeof e.detail==`object`&&`reason`in e.detail)return e.detail.reason}catch{}return e}},Un=`$message`,Wn=`$timestamp`,Gn=new Set([Un,Wn]),Kn={enabled:!0,max_bytes:32768};function qn(e){return e?{enabled:e.enabled??Kn.enabled,max_bytes:Yn(e.max_bytes,Kn.max_bytes)}:x({},Kn)}var Jn=class{constructor(e){this.Ss=[],this.xs=0,this.vn=qn(e)}setConfig(e){this.vn=qn(e),this.Cs()}add(e){var t=function(e){var t;try{t=me(e)}catch{return}try{var n=JSON.parse(t);if(!M(n))return;var r=n,i=r[Un],a=r[Wn];return!P(i)||i.trim().length===0||!P(a)&&!L(a)?void 0:{step:r,json:t}}catch{return}}(e);if(t){var n=function(e){if(typeof TextEncoder<`u`)return new TextEncoder().encode(e).length;for(var t=encodeURIComponent(e),n=0,r=0;t.length>r;r++)t[r]===`%`?(n+=1,r+=2):n+=1;return n}(t.json);n>this.vn.max_bytes||(this.Ss.push({step:t.step,bytes:n}),this.xs+=n,this.Cs())}}getAttachable(){return this.Ss.map((e=>e.step))}clear(){this.Ss=[],this.xs=0}size(){return this.Ss.length}Cs(){for(;this.xs>this.vn.max_bytes&&this.Ss.length>0;){var e=this.Ss.shift();e&&(this.xs-=e.bytes)}}};function Yn(e,t){if(!L(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var Xn=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={P(t){if(a&&(v.DEBUG||a.POSTHOG_DEBUG||n)&&!N(a.console)&&a.console){for(var r=(`__rrweb_original__`in a.console[t])?a.console[t].__rrweb_original__:a.console[t],i=arguments.length,o=Array(i>1?i-1:0),s=1;i>s;s++)o[s-1]=arguments[s];r(e,...o)}},debug(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.P(`debug`,...t)},info(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.P(`log`,...t)},warn(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.P(`warn`,...t)},error(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.P(`error`,...t)},critical(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];console.error(e,...n)},uninitializedWarning(e){r.error(`You must initialize PostHog before calling `+e)},createLogger:(t,n)=>Xn(e+` `+t,n)};return r},B=Xn(`[PostHog.js]`),V=B.createLogger,Zn=V(`[ExternalScriptsLoader]`),Qn=e=>{var t=c?.querySelectorAll(`script`);if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute(`src`)===e)return t[n]}},$n=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Zn.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=Qn(t);if(r){if(r.__posthog_loading_callback_fired)return n();var i=r.__posthog_loading_error;return i?n(i):(r.addEventListener(`load`,(e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)})),void r.addEventListener(`error`,(e=>{r.__posthog_loading_error=e,n(e)})))}var a=()=>{if(!c)return n(`document not found`);if(Qn(t))return $n(e,t,n);var r=c.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>{r.__posthog_loading_error=e,n(e)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)c.head.appendChild(r);else{var i,a=c.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):c.body.appendChild(r)}};c!=null&&c.body?a():c?.addEventListener(`DOMContentLoaded`,a)},er={},tr=(e,t)=>{var n=`/static/`+t+`.js?v=`+e.version;if(t===`toolbar`){var r=3e5;n=n+`&t=`+Math.floor(Date.now()/r)*r}return e.requestRouter.endpointFor(`assets`,n)};_.__PosthogExtensions__=_.__PosthogExtensions__||{},_.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{if(t!==`remote-config`){var r=e.config.strict_script_versioning;if(r){var i=e.requestRouter.endpointFor(`assets`,`/static/`+e.version+`/`+t+`.js`),a=er[i];if(r===`fallback`&&a){if(Qn(a))return void $n(e,a,n);delete er[i]}$n(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o,s=tr(e,t);er[i]=s;var c=Qn(i);c==null||(o=c.parentNode)==null||o.removeChild(c),$n(e,s,n)}}else n(void 0,a)}:n)}else $n(e,tr(e,t),n)}else $n(e,e.requestRouter.endpointFor(`assets`,`/array/`+e.config.token+`/config.js`),n)},_.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{$n(e,e.requestRouter.endpointFor(`api`,t),n)},v.DEBUG=!1,v.LIB_VERSION=`1.422.5`,v.LIB_NAME=`web`;var nr=`$people_distinct_id`,H=`distinct_id`,rr=`$device_id`,ir=`$device_model`,ar=`__alias`,or=`__timers`,sr=`$autocapture_disabled_server_side`,cr=`$heatmaps_enabled_server_side`,lr=`$exception_capture_enabled_server_side`,ur=`$error_tracking_suppression_rules`,dr=`$error_tracking_capture_extension_exceptions`,fr=`$web_vitals_enabled_server_side`,pr=`$dead_clicks_enabled_server_side`,mr=`$product_tours_enabled_server_side`,hr=`$logs_capture_enabled_server_side`,gr=`$web_vitals_allowed_metrics`,_r=`$session_recording_remote_config`,vr=`$replay_sample_rate`,yr=`$replay_override_sampling`,br=`$replay_override_linked_flag`,xr=`$replay_override_url_trigger`,Sr=`$replay_override_event_trigger`,Cr=`$sesid`,wr=`$session_is_sampled`,Tr=`$enabled_feature_flags`,Er=`$active_feature_flags`,Dr=`$early_access_features`,Or=`$feature_flag_details`,kr=`$feature_flag_payloads`,Ar=`$feature_flag_request_id`,jr=`$minimal_flag_called_events`,Mr=`$override_feature_flags`,Nr=`$override_feature_flag_payloads`,Pr=`$stored_person_properties`,Fr=`$stored_group_properties`,Ir=`$groups`,Lr=`$surveys`,Rr=`$surveys_loaded_at`,zr=`$surveys_activated`,Br=`$surveys_activated_session`,Vr=`$surveys_activated_timestamps`,Hr=`ph_product_tours`,Ur=`$flag_call_reported`,Wr=`$flag_call_reported_session_id`,Gr=`$feature_flag_errors`,Kr=`$feature_flag_evaluated_at`,U=`$user_state`,qr=`$client_session_props`,Jr=`$capture_rate_limit`,Yr=`$initial_campaign_params`,Xr=`$initial_referrer_info`,Zr=`$initial_person_info`,Qr=`$epp`,$r=`$posthog_cookieless`,ei=`$cookieless_mode`,ti=`$sdk_debug_extensions_init_method`,ni=`$sdk_debug_extensions_init_time_ms`,ri=`$sdk_debug_recording_script_not_loaded`,ii=`PostHog loadExternalDependency extension not found.`,ai=`on_reject`,oi=`always`,W=`anonymous`,G=`identified`,si=`identified_only`,ci=`visibilitychange`,li=`beforeunload`,ui=`$pageview`,di=`$pageleave`,fi=`$identify`,pi=`$groupidentify`;function mi(e,t){A(e)&&e.forEach(t)}function K(e,t){if(!I(e)){if(A(e))e.forEach(t);else if(xe(e))e.forEach(((e,n)=>t(e,n)));else for(var n in e)ge.call(e,n)&&t(e[n],n)}}var q=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var i of n)for(var a in i)i[a]!==void 0&&(e[a]=i[a]);return e};function hi(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var gi=function(e){try{return e()}catch{return}},_i=function(e){return function(){try{for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,n)}catch(e){B.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),B.critical(e)}}},vi=function(e){var t={};return K(e,(function(e,n){(P(e)&&e.length>0||L(e))&&(t[n]=e)})),t},yi=[`herokuapp.com`,`vercel.app`,`netlify.app`];function bi(e){var t=e?.hostname;if(!P(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of yi)if(n===r)return!1;return!0}function J(e,t,n,r){var i=r??{},a=i.capture,o=i.passive;e?.addEventListener(t,n,{capture:a!==void 0&&a,passive:o===void 0||o})}function xi(e){return e.name===`ph_toolbar_internal`}var Si=e=>{if(c){try{for(var t=e+`=`,n=c.cookie.split(`;`).filter((e=>e.length)),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return L(e)&&isFinite(e)&&Math.floor(e)===e});var Ci=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>t||0>n||0>r||0>i||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/256,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);
2if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},wi=class{generate(){var e=this.generateOrAbort();if(!N(e))return e;this.Gr=0;var t=this.generateOrAbort();if(N(t))throw Error(`Could not generate UUID after timestamp reset`);return t}generateOrAbort(){var e=Date.now();if(e>this.Gr)this.Gr=e,this.Qr();else{if(this.Gr>=e+1e4)return;this.Jr++,this.Jr>4398046511103&&(this.Gr++,this.Qr())}return Ci.fromFieldsV7(this.Gr,Math.trunc(this.Jr/2**30),this.Jr&2**30-1,this.Yr.nextUint32())}Qr(){this.Jr=1024*this.Yr.nextUint32()+(1023&this.Yr.nextUint32())}constructor(){this.Gr=0,this.Jr=0,this.Yr=new Di}},Ti,Ei=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&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};a&&!N(a.crypto)&&crypto.getRandomValues&&(Ei=e=>crypto.getRandomValues(e));var Di=class{nextUint32(){return this.At.length>this.Kr||(Ei(this.At),this.Kr=0),this.At[this.Kr++]}constructor(){this.At=new Uint32Array(8),this.Kr=1/0}},Oi=()=>ki().toString(),ki=()=>(Ti||=new wi).generate(),Ai=``,ji=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Y={Xr:()=>!!c,ii(e){B.error(`cookieStore error: `+e)},ti:Si,ni(e){var t;try{t=JSON.parse(Y.ti(e))||{}}catch{}return t},ei(e,t,n,r,i){if(!c)return!1;try{var a=``,o=``,s=function(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=c),Ai)return Ai;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Oi();!Ai&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,Ai=a)}return Ai}(e);if(!n){var r=(e=>{var t=e.match(ji);return t?t[0]:``})(e);r!==n&&B.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}(c.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),a=`; expires=`+l.toUTCString()}i&&(o=`; secure`);var u=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return u.length>3686.4&&B.warn(`cookieStore warning: large cookie, len=`+u.length),c.cookie=u,!0}catch{return!1}},ri(e,t){if(c!=null&&c.cookie)try{Y.ei(e,``,-1,t)}catch{return}}},Mi=null,X={Xr(){if(!F(Mi))return Mi;var e=!0;if(N(a))e=!1;else try{var t=`__mplssupport__`;X.ei(t,`xyz`),X.ti(t)!==`"xyz"`&&(e=!1),X.ri(t)}catch{e=!1}return e||B.error(`localStorage unsupported; falling back to cookie store`),Mi=e,e},ii(e){B.error(`localStorage error: `+e)},ti(e){try{return a?.localStorage.getItem(e)}catch(e){X.ii(e)}return null},ni(e){try{return JSON.parse(X.ti(e))||{}}catch{}return null},ei(e,t){try{return a?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){X.ii(e)}return!1},ri(e){try{a?.localStorage.removeItem(e)}catch(e){X.ii(e)}}},Ni=[Pr,Er,Tr,Or,kr,Ar,Kr,Gr,Ur],Pi=[rr,H,Cr,wr,Qr,Zr,U],Fi=e=>e+`_cpm`,Ii=[`__proto__`,`constructor`,`prototype`],Li=e=>{if(!M(e))return{};var t={};return Object.keys(e).forEach((n=>{Ii.indexOf(n)===-1&&(t[n]=e[n])})),t},Ri=function(e,t){t===void 0&&(t=[]);var n={};return[...Pi,...t].forEach((t=>{var r=e[t];N(r)||F(r)||r===``||(n[t]=r)})),n},zi=e=>{for(var t=5381,n=2166136261,r=0;e.length>r;r++){var i=e.charCodeAt(r);t=33*t^i,n=Math.imul(n^i,16777619)}return e.length.toString(36)+`.`+(t>>>0).toString(36)+`.`+(n>>>0).toString(36)},Bi=(e,t)=>({p:t,f:zi(JSON.stringify(e))}),Vi=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=Y.ni(Fi(e)),r=n?.f===zi(t)&&A(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Hi=(e,t)=>t+`|`+(Y.ti(Fi(e))||``),Ui={},Wi={Xr:()=>!0,ii(e){B.error(`memoryStorage error: `+e)},ti:e=>Ui[e]||null,ni:e=>Ui[e]||null,ei:(e,t)=>(Ui[e]=t,!0),ri(e){delete Ui[e]}},Gi=null,Z={Xr(){if(!F(Gi))return Gi;if(Gi=!0,N(a))Gi=!1;else try{var e=`__support__`;Z.ei(e,`xyz`),Z.ti(e)!==`"xyz"`&&(Gi=!1),Z.ri(e)}catch{Gi=!1}return Gi},ii(e){B.error(`sessionStorage error: `,e)},ti(e){try{return a?.sessionStorage.getItem(e)}catch(e){Z.ii(e)}return null},ni(e){try{return JSON.parse(Z.ti(e))||null}catch{}return null},ei(e,t){try{return a?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Z.ii(e)}return!1},ri(e){try{a?.sessionStorage.removeItem(e)}catch(e){Z.ii(e)}}},Ki=class{constructor(e){this._instance=e}get vn(){return this._instance.config}get consent(){return this.Hs()?0:this.zs}isOptedOut(){return this.vn.cookieless_mode===oi||this.isRejected()||this.consent===-1&&this.vn.cookieless_mode===ai}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.vn.opt_out_capturing_by_default}optInOut(e){this.Us.ei(this.Ws,+!!e,this.vn.cookie_expiration,this.vn.cross_subdomain_cookie,this.vn.secure_cookie)}reset(){this.Us.ri(this.Ws,this.vn.cross_subdomain_cookie)}get Ws(){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)}get zs(){var e=this.Us.ti(this.Ws);return Ae(e)?1:k(je,e)?0:-1}get Us(){var e=this.vn.opt_out_capturing_persistence_type,t=e===`localStorage`?X:Y;if(!this.Vs||this.Vs!==t){this.Vs=t;var n=e===`localStorage`?Y:X;n.ti(this.Ws)&&(this.Vs.ti(this.Ws)||this.optInOut(Ae(n.ti(this.Ws))),n.ri(this.Ws,this.vn.cross_subdomain_cookie))}return this.Vs}Hs(){return!!this.vn.respect_dnt&&[s?.doNotTrack,s?.msDoNotTrack,_.doNotTrack].some((e=>Ae(e)))}};function qi(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!j(r))return t;try{var i=r(t);return P(i)&&i?i:t}catch(e){return B.error(`Error in get_current_url, falling back to window.location.href`,e),t}}var Ji=`__POSTHOG_TOOLBAR__`,Yi=1,Xi=3,Zi=11;function Qi(e){return e instanceof Element&&(e.id===Ji||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function $i(e){return!!e&&e.nodeType===Yi}function ea(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ta(e){return!!e&&e.nodeType===Xi}function na(e){return!!e&&e.nodeType===Zi&&$i(e.host)}var ra=1e3;function ia(e){return e?fe(e).split(/\s+/):[]}function aa(e,t){var n=function(e){var t,n=a==null||(t=a.location)==null?void 0:t.href;return N(n)?void 0:qi(e,n)}(t);return!!(n&&e&&e.some((e=>n.match(e))))}function oa(e){var t=``;switch(typeof 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 ia(t)}function sa(e){return I(e)?null:fe(e).split(/(\s+)/).filter((e=>ja(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function ca(e){var t=``;return Sa(e)&&!Ca(e)&&e.childNodes&&e.childNodes.length&&K(e.childNodes,(function(e){ta(e)&&e.textContent&&(t+=sa(e.textContent)??``)})),fe(t)}function la(e){var t;return N(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var ua=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function da(e,t){if(N(t))return!0;var n,r=function(e){if(t.some((t=>function(e,t){var n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch{return!1}}(e,t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function fa(e){var t=e.parentNode;return!(!t||!$i(t))&&t}var pa=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],ma=[`next`,`previous`,`prev`,`>`,`<`],ha=[...ma,`+`,`-`,`â`,`â`],ga=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,_a=[`.ph-no-rageclick`,`.ph-no-capture`],va=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function ya(e,t){if(!a||ba(e))return!1;var n,r,i,o;if(R(t)?(n=!!t&&_a,r=void 0,i=!1):(n=t?.css_selector_ignorelist??_a,r=t?.content_ignorelist,i=(o=t?.ignore_text_selection)!=null&&o),!1===n||i&&function(e){return!(!e||!$i(e))&&(!!ea(e,`textarea`)||(ea(e,`input`)?k(va,(e.getAttribute(`type`)||``).toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=e.getAttribute==null?void 0:e.getAttribute(`contenteditable`);return t===`true`||t===``}(e)))}(e))return!1;var s=xa(e,!1).targetElementList;return!function(e,t){if(!1===e||N(e))return!1;var n;if(!0===e)n=ma;else{if(!A(e))return!1;if(e.length>10)return B.error(`[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var t=e.safeText,r=e.ariaLabel;return n.some((e=>ga(t,e)||ga(r,e)))}))}(r,s.map((e=>({safeText:ca(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!da(s,n)}var ba=e=>!e||ea(e,`html`)||!$i(e),xa=(e,t)=>{if(!a||ba(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!ea(i,`body`);)if(na(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var o=fa(i);if(!o)break;if(t||ua.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var s=a.getComputedStyle(o);s&&s.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}catch{}r.push(o),i=o}return{parentIsUsefulElement:n,targetElementList:r}};function Sa(e){for(var t=new Set,n=0,r=e;r.parentNode&&!ea(r,`body`);r=r.parentNode){if(n++>=ra||t.has(r))return!1;t.add(r);var i=oa(r);if(k(i,`ph-sensitive`)||k(i,`ph-no-capture`))return!1}if(k(oa(e),`ph-include`))return!0;var a=e.type||``;if(P(a))switch(a.toLowerCase()){case`hidden`:case`password`:return!1}
2var o=e.name||e.id||``;return!P(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 Ca(e){return!!(ea(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||ea(e,`select`)||ea(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var wa=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}))$`),Ta=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ea=[16,15,14,13],Da=RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),Oa=RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),ka=/[0-9A-Za-z_]/;function Aa(e){for(var t=0,n=!1,r=e.length-1;r>=0;r--){var i=e.charCodeAt(r)-48;n&&(i*=2)>9&&(i-=9),t+=i,n=!n}return t%10==0}function ja(e,t){return t===void 0&&(t=!0),!(I(e)||P(e)&&(e=fe(e),(t?wa.test((e||``).replace(/[- ]/g,``)):function(e){var t;for(Ta.lastIndex=0;t=Ta.exec(e);){var n=t[2];if(n)for(var r=n.replace(/[- ]/g,``),i=0;r.length>i;i++)for(var a of Ea){var o=i+a;if(r.length>=o){var s=r.slice(i,o);if(wa.test(s)&&Aa(s))return!0}}}return!1}(e))||(t?Da.test(e):function(e){var t;for(Oa.lastIndex=0;t=Oa.exec(e);){var n=t[1],r=t[3];if(!(n&&r&&ka.test(n)&&ka.test(r)))return!0}return!1}(e))))}function Ma(e){var t=ca(e);return ja(t=(t+` `+Na(e)).trim())?t:``}function Na(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&K(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=ca(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+Na(e)).trim())}catch(e){B.error(`[AutoCapture]`,e)}})),t}function Pa(e){return e.replace(/"|\\"/g,`\\"`)}function Fa(e){var t=e.attr__class;if(t)return A(t)?t:ia(t)}var Ia=V(`[Dead Clicks]`),La=()=>!0,Ra=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(pr)),r=e.instance.config.capture_dead_clicks;return R(r)?r:!!M(r)||n},za=class{get lazyLoadedDeadClicksAutocapture(){return this.Gs}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;`captureDeadClicks`in t&&(this.instance.persistence&&this.instance.persistence.register({[pr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Zs((()=>{this.Qs()})):this.stop()}Zs(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Ia.error(`failed to load script`,t):e()}))}Qs(){var e;if(c){if(!this.Gs&&(e=_.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=M(this.instance.config.capture_dead_clicks)?x({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Gs=_.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Gs.start(c),Ia.info(`starting...`)}}else Ia.error("`document` not found. Cannot start.")}stop(){this.Gs&&(this.Gs.stop(),this.Gs=void 0,Ia.info(`stopping...`))}},Ba=V(`[SegmentIntegration]`),Va=`posthog-js`;function Ha(e,t){var n=t===void 0?{}:t,r=n.organization,i=n.projectId,a=n.prefix,o=n.severityAllowList,s=o===void 0?[`error`]:o,c=n.sendExceptionsToPostHog,l=c===void 0||c;return t=>{if(s!==`*`&&!s.includes(t.level)||!e.__loaded)return t;t.tags||={};var n=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+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,c=t.exception?.values||[],u=c.map((e=>x({},e,{stacktrace:e.stacktrace?x({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>x({},e,{platform:`web:javascript`})))}):void 0}))),d={$exception_message:c[0]?.value||t.message,$exception_type:c[0]?.type,$exception_level:t.level,$exception_list:u,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:c[0]?.value||t.message,$sentry_exception_type:c[0]?.type,$sentry_tags:t.tags};return r&&i&&(d.$sentry_url=(a||`https://sentry.io/organizations/`)+r+`/issues/?project=`+i+`&query=`+t.event_id),l&&((o=e.exceptions)==null||o.sendExceptionEvent(d)),t}}var Ua=class{constructor(e,t,n,r,i,a){this.name=Va,this.setupOnce=function(o){o(Ha(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},Wa=class{constructor(e){this.Js=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(B.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.Ks=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ys()}Ys(){this.Xs=this._instance.sessionManager?.onSessionId(this.Js)}destroy(){var e;(e=this.Xs)==null||e.call(this),this.Xs=void 0}doPageView(e,t){var n=this.ta(e,t);return this.Ks={pathname:a?.location.pathname??``,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){return this.ta(e,this.Ks?.pageViewId)}doEvent(){return{$pageview_id:this.Ks?.pageViewId}}ta(e,t){var n=this.Ks;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var a=i.maxScrollHeight,o=i.lastScrollY,s=i.maxScrollY,c=i.maxContentHeight,l=i.lastContentY,u=i.maxContentY;if(!(N(a)||N(o)||N(s)||N(c)||N(l)||N(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a>1?Me(o/a,0,1,B):1,f=a>1?Me(s/a,0,1,B):1,p=c>1?Me(l/c,0,1,B):1,m=c>1?Me(u/c,0,1,B):1;r=q(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Ga=[`flags`,`surveys`],Ka={[nr]:{exposure:`hidden`},[ar]:{exposure:`hidden`},__cmpns:{exposure:`hidden`},[or]:{exposure:`hidden`},[sr]:{exposure:`event`},[cr]:{exposure:`hidden`},[hr]:{exposure:`hidden`},[lr]:{exposure:`event`},[ur]:{exposure:`hidden`},[dr]:{exposure:`event`},[fr]:{exposure:`event`},[pr]:{exposure:`event`},[mr]:{exposure:`hidden`},[gr]:{exposure:`event`},[_r]:{exposure:`hidden`},$session_recording_enabled_server_side:{exposure:`hidden`},[Cr]:{exposure:`hidden`},[wr]:{exposure:`event`},[vr]:{exposure:`event`,shouldSkipFromEventProperties:e=>F(e)},$session_past_minimum_duration:{exposure:`event`},$session_recording_url_trigger_activated_session:{exposure:`event`},$session_recording_event_trigger_activated_session:{exposure:`event`},$debug_first_full_snapshot_timestamp:{exposure:`event`},$sess_rec_flush_size:{exposure:`hidden`},[Tr]:{exposure:`hidden`,storageGroup:`flags`},[Er]:{exposure:`hidden`,storageGroup:`flags`},[Dr]:{exposure:`hidden`},[Or]:{exposure:`hidden`,storageGroup:`flags`},[kr]:{exposure:`hidden`,storageGroup:`flags`},[Ar]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[jr]:{exposure:`hidden`,storageGroup:`flags`},[Mr]:{exposure:`hidden`},[Nr]:{exposure:`hidden`},[Pr]:{exposure:`hidden`},[Fr]:{exposure:`hidden`},[Lr]:{exposure:`hidden`,storageGroup:`surveys`},[Rr]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[zr]:{exposure:`event`},[Br]:{exposure:`hidden`},[Vr]:{exposure:`hidden`},[Hr]:{exposure:`hidden`},$product_tours_activated:{exposure:`hidden`},$product_tours_activated_session:{exposure:`hidden`},$conversations_widget_session_id:{exposure:`event`},$conversations_ticket_id:{exposure:`event`},$conversations_widget_state:{exposure:`event`}
2,$conversations_user_traits:{exposure:`event`},[Ur]:{exposure:`hidden`},[Wr]:{exposure:`hidden`},[Ir]:{exposure:`event`},[Gr]:{exposure:`hidden`},[Kr]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[U]:{exposure:`hidden`},[qr]:{exposure:`hidden`},[Jr]:{exposure:`hidden`},[Yr]:{exposure:`hidden`},[Xr]:{exposure:`hidden`},[Zr]:{exposure:`hidden`},[Qr]:{exposure:`hidden`},[yr]:{exposure:`event`},[br]:{exposure:`event`},[xr]:{exposure:`event`},[Sr]:{exposure:`event`},[ti]:{exposure:`event`},[ni]:{exposure:`event`},[ri]:{exposure:`event`},$sdk_debug_replay_event_trigger_status:{exposure:`event`},$sdk_debug_replay_linked_flag_trigger_status:{exposure:`event`},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:`event`},$sdk_debug_replay_pending_trigger_conditions:{exposure:`event`},$sdk_debug_replay_remote_trigger_matching_config:{exposure:`event`},$sdk_debug_replay_trigger_groups_count:{exposure:`event`},$sdk_debug_replay_url_trigger_status:{exposure:`event`},$session_recording_start_reason:{exposure:`event`}},qa=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],Ja=e=>{var t=Ka[e];if(t)return t;for(var n of qa){var r=n[1];if(e.indexOf(n[0])===0)return r}},Ya=(e,t)=>{try{return JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t)}catch{return me(e)}},Xa=e=>{var t=c?.createElement(`a`);return N(t)?null:(t.href=e,t)},Za=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;r.length>i;i++){var a=r[i].split(`=`);
2if(a[0]===t){n=a;break}}if(!A(n)||2>n.length)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{B.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},Qa=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[1],a=(r[0]||``).split(`?`),o=a[1],s=a[0],c=(o||``).split(`&`),l=[],u=0;c.length>u;u++){var d=c[u].split(`=`);A(d)&&(t.includes(d[0])?l.push(d[0]+`=`+n):l.push(c[u]))}var f=s;return o!=null&&(f+=`?`+l.join(`&`)),i!=null&&(f+=`#`+i),f},$a=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},eo=(e,t)=>e>=t&&h(),to=(e,t,n,r)=>{if(e===0){if(h()){var i=t+1;return i===n&&r(),i}return t}return 0},no=`https?://(.*)`,ro=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],io=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...ro],ao=`<masked>`,oo=[`li_fat_id`];function so(e,t,n){if(!c)return{};var r,i=t?[...ro,...n||[]]:[],a=co(Qa(c.URL,i,ao),e);return q((r={},K(oo,(function(e){var t=Si(e);r[e]=t||null})),r),a)}function co(e,t){var n=io.concat(t||[]),r={};return K(n,(function(t){r[t]=Za(e,t)||null})),r}function lo(e){var t=function(e){return e?e.search(no+`google.([^/?]*)`)===0?`google`:e.search(no+`bing.com`)===0?`bing`:e.search(no+`yahoo.com`)===0?`yahoo`:e.search(no+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!F(t)){r.$search_engine=t;var i=c?Za(c.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function uo(){return navigator.language||navigator.userLanguage}var fo=`$direct`;function po(){return c?.referrer||fo}function mo(e,t,n){n===void 0&&(n=!1);var r=e?[...ro,...t||[]]:[],i=(n?Bt(l?.href):l?.href)?.substring(0,1e3);return{r:po().substring(0,1e3),u:i?Qa(i,r,ao):void 0}}function ho(e,t){t===void 0&&(t=!1);var n=e.r,r=e.u,i=t?Bt(r):r,a={$referrer:n,$referring_domain:n==null?void 0:n==fo?fo:Xa(n)?.host};if(i){a.$current_url=i;var o=Xa(i);a.$host=o?.host,a.$pathname=o?.pathname,q(a,co(i))}return n&&q(a,lo(n)),a}function go(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _o(){try{return new Date().getTimezoneOffset()}catch{return}}var vo={flags:Kr,surveys:Rr},yo=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],bo=e=>e+`_cookie_identity_change_pending`,xo=`main`,So=(e,t)=>{K(e,((n,r)=>{var i=Ja(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]}))},Co=class{constructor(e,t,n){if(n===void 0&&(n=!0),this.ea={},this.ia=!1,this.ra=!1,this.na=!1,this.sa=!1,this.vn=e,this.aa=n,this.props={},this.oa=void 0,this.la=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Us=this.ua(e),this.ra=this.ha(e),this.load(),e.debug&&B.info(`Persistence loaded`,e.persistence,x({},this.props)),this.update_config(e,e,t),this.save(),a){var r=()=>this.flush();J(a,`beforeunload`,r,{capture:!1}),J(a,`pagehide`,r,{capture:!1})}}da(){var e=this.vn?.persistence_save_debounce_ms;return L(e)&&e>0?e:0}va(e){if(this.vn.cookieWinsOnConflict&&this.vn.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{var t=Ri(e,this.vn.cookie_persisted_properties||[]),n=Bi(t,this.vn.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=Y.ti(this.la)||void 0;i&&Hi(this.la,i)===r&&(this.ca=r,this.fa=i)}catch{}else try{var a=Y.ti(this.la)||void 0;this.ca=a?Hi(this.la,a):void 0,this.fa=a}catch{}}}syncCookieProperties(){return this.pa(this.vn)}pa(e,t){if(t===void 0&&(t=!1),this.ga&&!t||this.sa||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!==`localstorage+cookie`)return!1;var n;try{n=Y.ti(this.la)||void 0}catch{}if(!n||n===this.fa)return!1;var r,i=Hi(this.la,n);try{r=Li(JSON.parse(n))}catch{return!1}if((Y.ti(this.la)||void 0)!==n)return!1;this.ca=i,this.fa=n;var a=Vi(this.la,n),o=[...Pi,...a.properties],s={};if(Object.keys(r).forEach((e=>{var t=r[e];(N(t)||F(t)||t===``||e===U&&t!==W&&t!==G)&&(s[e]=!0,delete r[e])})),ve(r))return!1;var c=H in r||r[U]===W||r[U]===G,l=this.props[H],u=this.props[U],d=q({},this.props);
2[...Pi,...e.cookie_persisted_properties||[]].forEach((e=>{if(o.indexOf(e)!==-1&&!(e in r)&&!s[e]&&(c||e!==H&&e!==U)){var t=d[e];!a.isValid&&Pi.indexOf(e)!==-1&&(!1===t||t===0)||delete d[e]}})),this.props=q(d,r),!c||U in r||U in this.props||this.ma(U,W);var f=this.props[H],p=this.props[U];return!c||f===l&&p===u||(this.na=!0,Z.ei(bo(this.la),!0),this.ya(Pr),this.ya(Er),this.ya(Tr),this.ya(Or),this.ya(kr),this.ya(Ar),this.ya(Kr),this.ya(Gr),this.ya(Ur),p===W&&(u===G||r[U]===W||!N(l)&&f!==l)&&(So(this.props,r),this.ya(Fr)),p===G?this.props.$user_id=f:delete this.props.$user_id,this.ya(ar)),!0}consumeCookieIdentityChange(){var e=bo(this.la),t=this.na||!!Z.ti(e);return this.na=!1,t&&Z.ri(e),t}ba(e){return e===void 0&&(e=!1),!(this.sa||this.ga&&!e||!this.vn.cookieWinsOnConflict||this.vn.persistence.toLowerCase()!==`localstorage+cookie`||(this.sa=!0,0))}_a(){this.sa&&(N(this.wa)||(clearTimeout(this.wa),this.wa=void 0),delete this.ea[xo],this.ka(!0))}Sa(e){if(e===void 0&&(e=!0),this.sa)try{e?this._a():N(this.wa)||(clearTimeout(this.wa),this.wa=void 0)}finally{this.sa=!1}}isDisabled(){return!!this.ga}ua(e){yo.indexOf(e.persistence.toLowerCase())===-1&&(B.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t,n=function(e,t){e===void 0&&(e=[]),t===void 0&&(t=!1);var n=[...Pi,...e];return x({},X,{ni(e){try{var r,i={};try{r=Y.ti(e)||void 0,i=r?Li(JSON.parse(r)):{}}catch{}var a,o=JSON.parse(X.ti(e)||`{}`);if(t){var s=Vi(e,r),c=[...Pi,...s.properties],l={};
2Object.keys(i).forEach((e=>{var t=i[e];F(t)||t===``||e===U&&t!==W&&t!==G||(l[e]=t)}));var u=H in l||l[U]===W||l[U]===G;if(Object.keys(l).length>0){var d=o[H],f=o[U]??W;n.forEach((e=>{if(c.indexOf(e)!==-1&&!(e in i)&&(u||e!==H&&e!==U)){var t=o[e];!s.isValid&&Pi.indexOf(e)!==-1&&(!1===t||t===0)||delete o[e]}})),!u||U in i||U in o||(o[U]=W),!u||(H in l?l[H]:o[H])===d&&(U in l?l[U]:o[U])===f||(Ni.forEach((e=>delete o[e])),l[U]===G&&H in l?o.$user_id=l[H]:delete o.$user_id,l[U]!==G&&(delete o[Ir],delete o[Fr]),delete o.__alias)}a=q(o,l)}else a=q(i,o);return X.ei(e,a),a}catch{}return null},ei(n,r,i,a,o,s){var c=X.ei(n,r,void 0,void 0,s);try{var l=Ri(r,e);if(Object.keys(l).length){if(t){var u=Fi(n),d=Bi(l,e);if(Y.ei(u,d,i,a,o,s),Y.ti(u)!==JSON.stringify(d)){Y.ri(u,a);var f=Ri(r);return Y.ei(n,f,i,a,o,s),c}}Y.ei(n,l,i,a,o,s)}}catch(e){X.ii(e)}return c},ri(e,t){try{a?.localStorage.removeItem(e),Y.ri(e,t),Y.ri(Fi(e),t)}catch(e){X.ii(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,i=e.persistence.toLowerCase();return i===`localstorage`&&X.Xr()?(t=X,r=!0):i===`localstorage+cookie`&&n.Xr()?(t=n,r=!0):i===`sessionstorage`&&Z.Xr()?t=Z:i===`memory`?t=Wi:i===`cookie`?t=Y:n.Xr()?(t=n,r=!0):t=Y,this.ia=r,t}xa(e){return this.la+`__`+e}ha(e){return this.ia&&!!e.split_storage}properties(){var e={};return K(this.props,((t,n)=>{var r=Ja(n);if(!r||r.exposure===`event`){if(r!=null&&r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t))return;e[n]=t}})),e}load(e){if(e===void 0&&(e=!1),!this.ga||e){var t=this.vn.cookieWinsOnConflict&&this.vn.persistence.toLowerCase()===`localstorage+cookie`,n=t?X.ni(this.la):null,r={};if(t)try{K(r=Li(Y.ni(this.la)),((e,t)=>{(N(e)||F(e)||e===``)&&delete r[t]}))}catch{}var i=this.Us.ni(this.la);if(i&&(this.props=q({},i)),this.ra&&this.Ca(),t&&i){var a=n?.[H],o=n?.[U]??W,s=i[H],c=i[U]??W;if(s!==a||c!==o){this.na=!0,Z.ei(bo(this.la),!0);var l=q({},this.props);Ni.forEach((e=>delete l[e])),c===W&&(o===G||r[U]===W||!N(a)&&s!==a)&&(So(l,r),delete l[Fr]),this.props=l;var u=new Set;Ni.forEach((e=>{var t=Ja(e)?.storageGroup;t&&u.add(t)})),u.forEach((e=>{var t={};K(this.props,((n,r)=>{Ja(r)?.storageGroup===e&&(t[r]=n)})),ve(t)?(X.ri(this.xa(e)),this.ea[e]={}):X.ei(this.xa(e),t)&&(this.ea[e]={persisted:!0,fingerprint:this.Ta(t,e)})}))}}Z.ti(bo(this.la))&&(this.na=!0)}}Ca(){for(var e of Ga){var t=X.ni(this.xa(e));if(t&&!ve(t)){var n=this.Ma(e);n.persisted=!0,this.Ea(e)||(n.fingerprint=this.Ta(t,e)),this.Ia(e,t)||q(this.props,t)}}}Ea(e){return Object.keys(this.props).some((t=>Ja(t)?.storageGroup===e))}Ia(e,t){var n=vo[e];if(!n)return!1;var r=t[n],i=this.props[n];return L(r)&&L(i)&&i>r}refreshKey(e){if(!this.ga){var t=this.ra?Ja(e)?.storageGroup:void 0,n=t?X.ni(this.xa(t)):this.Us.ni(this.la);if(n&&e in n)this.ma(e,n[e]);else{if(t){var r=this.Us.ni(this.la);if(r&&e in r)return void this.ma(e,r[e])}this.ya(e)}}}save(){if(!this.ga){var e=this.da();e>0?N(this.wa)&&(this.wa=setTimeout((()=>{this.wa=void 0,this.ka()}),e)):this.ka()}}flush(){N(this.wa)||(clearTimeout(this.wa),this.wa=void 0,this.ka())}ka(e){e===void 0&&(e=!1),this.ga||this.sa&&!e||(e||this.syncCookieProperties(),this.ra?this.Ra():this.Pa(this.Us,this.la,this.props,xo)&&this.va(this.props))}Ra(){var e=this.Aa(),t=e.main,n=e.groups;for(var r of(this.Pa(this.Us,this.la,t,xo)&&this.va(t),Ga)){var i,a=n[r];(!ve(a)||(i=this.ea[r])!=null&&i.persisted)&&this.Pa(X,this.xa(r),a,r)}}Aa(){var e={},t={flags:{},surveys:{}};return K(this.props,((n,r)=>{var i=Ja(r)?.storageGroup;i?t[i][r]=n:e[r]=n})),{main:e,groups:t}}Ta(e,t){if(t===xo)return JSON.stringify(e)+`|`+this.Fa+`|`+this.Oa+`|`+this.La;var n={};return K(e,((e,t)=>{var r;n[t]=(r=Ja(t))!=null&&r.volatile?`__volatile__`:e})),JSON.stringify(n)}Pa(e,t,n,r){var i,a=this.Ma(r);if(r!==xo&&!a.dirty&&!N(a.fingerprint))return!1;try{if((i=this.Ta(n,r))===a.fingerprint)return a.dirty=!1,!1}catch{i=void 0}return e.ei(t,n,this.Fa,this.Oa,this.La,this.vn.debug)?(a.dirty=!1,r!==xo&&(a.persisted=!0),N(i)||(a.fingerprint=i),!0):(this.vn.debug&&B.warn(`failed to persist storage entry "`+t+`"; will retry on next save`),!1)}remove(e){var t=(e===void 0?{}:e).keepGroupEntries,n=t!==void 0&&t;if(N(this.wa)||(clearTimeout(this.wa),this.wa=void 0),this.Us.ri(this.la,!1),this.Us.ri(this.la,!0),!n&&this.aa)for(var r of Ga)X.ri(this.xa(r));n?delete this.ea[xo]:this.ea={},this.ca=void 0,this.fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(M(e)){this.syncCookieProperties(),N(t)&&(t=`None`),this.Fa=N(n)?this.Da:n;var r=!1;if(K(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.ma(n,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(M(e)){this.syncCookieProperties(),this.Fa=N(t)?this.Da:t;var n=!1;if(K(e,((t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||M(t)||A(t))&&(this.ma(r,t),n=!0)})),n)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t=typeof e==`string`?[e]:e,n=!1;for(var r of t)r in this.props&&(this.ya(r),n=!0);n&&this.save()}update_campaign_params(){var e=c?.URL;if(e!==this.oa){var t=so(this.vn.custom_campaign_params,this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties);ve(vi(t))||this.register(t),this.oa=e}}update_search_keyword(){var e;this.register((e=c?.referrer)?lo(e):{})}update_referrer_info(){this.register_once({$referrer:po(),$referring_domain:c!=null&&c.referrer&&Xa(c.referrer)?.host||fo},void 0)}set_initial_person_info(){this.props[Yr]||this.props[Xr]||this.register_once({[Zr]:mo(this.vn.mask_personal_data_properties,this.vn.custom_personal_data_properties,this.vn.disable_capture_url_hashes
2)},void 0)}get_initial_props(){var e={};K([Xr,Yr],(t=>{var n=this.props[t];n&&K(n,(function(t,n){e[`$initial_`+pe(n)]=t}))}));var t=this.props[Zr];return t&&q(e,function(e,t){t===void 0&&(t=!1);var n=ho(e,t),r={};return K(n,(function(e,t){r[`$initial_`+pe(t)]=e})),r}(t,this.vn.disable_capture_url_hashes)),e}safe_merge(e){return K(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){var r=e.persistence!==t.persistence,i=!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),a=r||i,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,s=e.disable_persistence||!!n,c=!!this.ga&&!s;s||this.pa(t,c),this.vn=e,!s&&(r||i||o)&&(this.ca=void 0,this.fa=void 0,this.pa(x({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),c));var l=a||o?this.ua(e):this.Us,u=this.ha(e),d=a||u!==this.ra,f=!s&&(d||e.cross_subdomain_cookie!==this.Oa||e.secure_cookie!==this.La)&&this.ba(c);try{if(this.Da=this.Fa=e.cookie_expiration,this.set_disabled(s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var p=this.props;this.clear(),this.Us=l,this.ra=u,this.props=p,this.save()}else o&&(this.Us=l,s||(delete this.ea[xo],this.ka()))}finally{f&&this.Sa()}}set_disabled(e){this.ga=e,this.ga?this.remove():this.save()}set_cross_subdomain(e){e!==this.Oa&&(this.Oa=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.La&&(this.La=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var n=this.props[or]||{};
2n[e]=t,this.ma(or,n),this.save()}remove_event_timer(e){var t=this.props[or]||{},n=t[e];return N(n)||(delete t[e],this.ma(or,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.ma(e,t),this.save()}ma(e,t){var n;this.props[e]=t,(n=Ja(e))!=null&&n.volatile||this.$a(e)}ya(e){delete this.props[e],this.$a(e)}$a(e){var t=Ja(e)?.storageGroup;t&&(this.Ma(t).dirty=!0)}Ma(e){return this.ea[e]||(this.ea[e]={})}};function wo(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&j(n.then)&&n.then(void 0,(()=>{}))}}}}var To={GZipJS:`gzip-js`,Base64:`base64`},Eo={Activation:`events`,Cancellation:`cancelEvents`},Do={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},Oo={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},ko={SURVEY_ID:`$survey_id`,SURVEY_NAME:`$survey_name`,SURVEY_RESPONSE:`$survey_response`,SURVEY_ITERATION:`$survey_iteration`,SURVEY_ITERATION_START_DATE:`$survey_iteration_start_date`,SURVEY_PARTIALLY_COMPLETED:`$survey_partially_completed`,SURVEY_SUBMISSION_ID:`$survey_submission_id`,SURVEY_QUESTIONS:`$survey_questions`,SURVEY_COMPLETED:`$survey_completed`,PRODUCT_TOUR_ID:`$product_tour_id`,SURVEY_LAST_SEEN_DATE:`$survey_last_seen_date`,SURVEY_LANGUAGE:`$survey_language`},Ao={Popover:`popover`,Inline:`inline`},jo={SHOWN:`product tour shown`,DISMISSED:`product tour dismissed`,COMPLETED:`product tour completed`,STEP_SHOWN:`product tour step shown`,STEP_COMPLETED:`product tour step completed`,BUTTON_CLICKED:`product tour button clicked`,STEP_SELECTOR_FAILED:`product tour step selector failed`,BANNER_CONTAINER_SELECTOR_FAILED:`product tour banner container selector failed`,BANNER_ACTION_CLICKED:`product tour banner action clicked`},Mo={TOUR_ID:`$product_tour_id`,TOUR_NAME:`$product_tour_name`,TOUR_ITERATION:`$product_tour_iteration`,TOUR_RENDER_REASON:`$product_tour_render_reason`,TOUR_STEP_ID:`$product_tour_step_id`,TOUR_STEP_ORDER:`$product_tour_step_order`,TOUR_STEP_TYPE:`$product_tour_step_type`,TOUR_DISMISS_REASON:`$product_tour_dismiss_reason`,TOUR_BUTTON_TEXT:`$product_tour_button_text`,TOUR_BUTTON_ACTION:`$product_tour_button_action`,TOUR_BUTTON_LINK:`$product_tour_button_link`,TOUR_BUTTON_TOUR_ID:`$product_tour_button_tour_id`,TOUR_STEPS_COUNT:`$product_tour_steps_count`,TOUR_STEP_SELECTOR:`$product_tour_step_selector`,TOUR_STEP_SELECTOR_FOUND:`$product_tour_step_selector_found`,TOUR_STEP_ELEMENT_TAG:`$product_tour_step_element_tag`,TOUR_STEP_ELEMENT_ID:`$product_tour_step_element_id`,TOUR_STEP_ELEMENT_CLASSES:`$product_tour_step_element_classes`,TOUR_STEP_ELEMENT_TEXT:`$product_tour_step_element_text`,TOUR_ERROR:`$product_tour_error`,TOUR_MATCHES_COUNT:`$product_tour_matches_count`,TOUR_FAILURE_PHASE:`$product_tour_failure_phase`,TOUR_WAITED_FOR_ELEMENT:`$product_tour_waited_for_element`,TOUR_WAIT_DURATION_MS:`$product_tour_wait_duration_ms`,TOUR_BANNER_SELECTOR:`$product_tour_banner_selector`,TOUR_LINKED_SURVEY_ID:`$product_tour_linked_survey_id`,USE_MANUAL_SELECTOR:`$use_manual_selector`,INFERENCE_DATA_PRESENT:`$inference_data_present`,TOUR_LAST_SEEN_DATE:`$product_tour_last_seen_date`,TOUR_TYPE:`$product_tour_type`},No=V(`[RateLimiter]`),Po=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{No.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){No.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var n=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,i=new Date().getTime(),a=this.instance.persistence?.get_property(Jr)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);var o=1>a.tokens;if(o||e||(a.tokens=Math.max(0,a.tokens-1)),o&&!e){var s=(L(a.dropped)?a.dropped:0)+1;a.dropped=s,!this.lastEventRateLimited&&this.Na(s)&&(a.dropped=0)}return this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(Jr,a),{isRateLimited:o,remainingTokens:a.tokens}}qa(e){var t=this.instance.config.property_denylist;return!A(t)||!t.includes(e)}ja(){if(this.qa(`$current_url`)&&this.qa(`$pathname`)&&l!=null&&l.pathname)return``+(l.origin??``)+l.pathname}Na(e){var t,n=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,i=this.ja(),a=this.qa(`$session_id`)?(t=this.instance).get_session_id?.call(t):void 0,o=[e+` event(s) dropped since the last warning`,i?`triggered on `+i:void 0,a?`session `+a:void 0].filter(
2Boolean).join(`, `);return!!this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited: `+o+`. Config is set to `+r+` events per second and `+n+` events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},Fo=V(`[RemoteConfig]`),Io=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=_._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ba(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Ha(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback:e})}load(){try{if(this.remoteConfig)return Fo.info(`Using preloaded remote config`,this.remoteConfig),void this.za(this.remoteConfig);if(this._instance.Ua())return void Fo.warn(`Remote config is disabled. Falling back to local config.`);this.Ba((e=>{if(!e)return Fo.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Ha((e=>{this.za(e.json,e)}));this.za(e)}))}catch(e){Fo.error(`Error loading remote config`,e),this.za()}}za(e,t){!e&&t&&(t.statusCode===0?t.error||Fo.warn(`Failed to fetch remote config from PostHog.`):Fo.error(`Failed to fetch remote config from PostHog.`));try{this._instance.za(e?{ok:!0,config:e}:{ok:!1})}catch(e){Fo.error(`Error applying remote config`,e)}if(!1!==e?.hasFeatureFlags&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(e){Fo.error(`Error loading feature flags`,e)}}},Lo=Uint8Array,Ro=Uint16Array,zo=Uint32Array,Bo=new Lo([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]),Vo=new Lo([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]),Ho=new Lo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Uo=function(e,t){for(var n=new Ro(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new zo(n[30]);for(r=1;30>r;++r)for(var a=n[r];n[r+1]>a;++a)i[a]=a-n[r]<<5|r;return[n,i]},Wo=Uo(Bo,2),Go=Wo[1];Wo[0][28]=258,Go[258]=28;for(var Ko=Uo(Vo,0)[1],qo=new Ro(32768),Q=0;32768>Q;++Q){var Jo=(43690&Q)>>>1|(21845&Q)<<1;qo[Q]=((65280&(Jo=(61680&(Jo=(52428&Jo)>>>2|(13107&Jo)<<2))>>>4|(3855&Jo)<<4))>>>8|(255&Jo)<<8)>>>1}var Yo=function(e,t,n){for(var r=e.length,i=0,a=new Ro(t);r>i;++i)++a[e[i]-1];var o,s=new Ro(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Ro(1<<t);var c=15-t;for(i=0;r>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;f>=d;++d)o[qo[d]>>>c]=l}else for(o=new Ro(r),i=0;r>i;++i)o[i]=qo[s[e[i]-1]++]>>>15-e[i];return o},Xo=new Lo(288);for(Q=0;144>Q;++Q)Xo[Q]=8;for(Q=144;256>Q;++Q)Xo[Q]=9;for(Q=256;280>Q;++Q)Xo[Q]=7;for(Q=280;288>Q;++Q)Xo[Q]=8;var Zo=new Lo(32);for(Q=0;32>Q;++Q)Zo[Q]=5;var Qo=Yo(Xo,9,0),$o=Yo(Zo,5,0),es=function(e){return(e/8>>0)+(7&e&&1)},ts=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Ro?Ro:e instanceof zo?zo:Lo)(n-t);return r.set(e.subarray(t,n)),r},ns=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},rs=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},is=function(e,t){for(var n=[],r=0;e.length>r;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new Lo(0),0];if(i==1){var o=new Lo(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 s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[d].f>n[l].f?l++:d++],c=n[l!=u&&n[d].f>n[l].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;i>r;++r)a[r].s>f&&(f=a[r].s);var p=new Ro(f+1),m=as(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i>r;++r){var v=a[r].s;if(t>=p[v])break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;t>p[y]?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return[new Lo(p),m]},as=function(e,t,n){return e.s==-1?Math.max(as(e.l,t,n+1),as(e.r,t,n+1)):t[e.s]=n},os=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ro(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;t>=s;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>
22&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},ss=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},cs=function(e,t,n){var r=n.length,i=es(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;r>a;++a)e[i+a+4]=n[a];return 8*(i+4+r)},ls=function(e,t,n,r,i,a,o,s,c,l,u){ns(t,u++,n),++i[256];for(var d=is(i,15),f=d[0],p=d[1],m=is(a,15),h=m[0],g=m[1],_=os(f),v=_[0],y=_[1],b=os(h),x=b[0],S=b[1],C=new Ro(19),w=0;v.length>w;++w)C[31&v[w]]++;for(w=0;x.length>w;++w)C[31&x[w]]++;for(var T=is(C,7),E=T[0],D=T[1],O=19;O>4&&!E[Ho[O-1]];--O);var ee,te,ne,re,ie=l+5<<3,ae=ss(i,Xo)+ss(a,Zo)+o,oe=ss(i,f)+ss(a,h)+o+14+3*O+ss(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(ae>=ie&&oe>=ie)return cs(t,u,e.subarray(c,c+l));if(ns(t,u,1+(ae>oe)),u+=2,ae>oe){ee=Yo(f,p,0),te=f,ne=Yo(h,g,0),re=h;var se=Yo(E,D,0);for(ns(t,u,y-257),ns(t,u+5,S-1),ns(t,u+10,O-4),u+=14,w=0;O>w;++w)ns(t,u+3*w,E[Ho[w]]);u+=3*O;for(var ce=[v,x],le=0;2>le;++le){var ue=ce[le];for(w=0;ue.length>w;++w)ns(t,u,se[de=31&ue[w]]),u+=E[de],de>15&&(ns(t,u,ue[w]>>>5&127),u+=ue[w]>>>12)}}else ee=Qo,te=Xo,ne=$o,re=Zo;for(w=0;s>w;++w)if(r[w]>255){var de;rs(t,u,ee[257+(de=r[w]>>>18&31)]),u+=te[de+257],de>7&&(ns(t,u,r[w]>>>23&31),u+=Bo[de]);var k=31&r[w];rs(t,u,ne[k]),u+=re[k],k>3&&(rs(t,u,r[w]>>>5&8191),u+=Vo[k])}else rs(t,u,ee[r[w]]),u+=te[r[w]];return rs(t,u,ee[256]),u+te[256]},us=new zo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ds=function(){for(var e=new zo(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),fs=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ps(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p(t){for(var n=e,r=0;t.length>r;++r)n=ds[255&n^t[r]]^n>>>8;e=n},d(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a,o,s,c,l=(s=10+((i=t).filename&&i.filename.length+1||0),c=8,function(e,t,n,r,i,a){var o=e.length,s=new Lo(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=cs(c,l,e.subarray(u,d)):(c[u]=!0,l=cs(c,l,e.subarray(u,o)))}else{for(var f=us[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new Ro(32768),_=new Ro(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new zo(25e3),S=new Ro(288),C=new Ro(32),w=0,T=0,E=(u=0,0),D=0,O=0;o>u;++u){var ee=b(u),te=32767&u,ne=_[ee];if(g[te]=ne,_[ee]=te,u>=D){var re=o-u;if((w>7e3||E>24576)&&re>423){l=ls(e,c,0,x,S,C,T,E,O,u-O,l),E=w=T=0,O=u;for(var ie=0;286>ie;++ie)S[ie]=0;for(ie=0;30>ie;++ie)C[ie]=0}var ae=2,oe=0,se=m,ce=te-ne&32767;if(re>2&&ee==b(u-ce))for(var le=Math.min(p,re)-1,ue=Math.min(32767,u),de=Math.min(258,re);ue>=ce&&--se&&te!=ne;){if(e[u+ae]==e[u+ae-ce]){for(var k=0;de>k&&e[u+k]==e[u+k-ce];++k);if(k>ae){if(ae=k,oe=ce,k>le)break;var fe=Math.min(ce,k-2),pe=0;for(ie=0;fe>ie;++ie){var me=u-ce+ie+32768&32767,he=me-g[me]+32768&32767;he>pe&&(pe=he,ne=me)}}}ce+=(te=ne)-(ne=g[te])+32768&32767}if(oe){x[E++]=268435456|Go[ae]<<18|Ko[oe];var ge=31&Go[ae],_e=31&Ko[oe];T+=Bo[ge]+Vo[_e],++S[257+ge],++C[_e],D=u+ae,++w}else x[E++]=e[u],++S[e[u]]}}l=ls(e,c,!0,x,S,C,T,E,O,u-O,l)}return ts(s,0,r+es(l)+i)}(a=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+o.mem,s,c)),u=l.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&fs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;n.length>=r;++r)e[r+10]=n.charCodeAt(r)}}(l,t),fs(l,u-8,n.d()),fs(l,u-4,r),l}var ms=!!d||!!u,hs=`text/plain`,gs=!1,_s=(e,t)=>{var n=e.split(`#`),r=n[1],i=n[0].split(`?`),a=i[0],o=i[1];if(!o)return e;var s=o.split(`&`).filter((e=>e.split(`=`)[0]!==t)).join(`&`);return a+(s?`?`+s:``)+(r?`#`+r:``)},vs=function(e,t,n){n===void 0&&(n=!0);var r=e.split(`?`),i=r[0],a=r[1],o=x({},t),s=a?.split(`&`).map((e=>{var t,r=e.split(`=`),i=r[0],a=n&&(t=o[i])!=null?t:r[1];return delete o[i],i+`=`+a}))??[],c=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return K(e,(function(e,t){N(e)||N(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)}(o);return c&&s.push(c),s.length>0?i+`?`+s.join(`&`):i},ys=e=>{if(e.Wa)return e.Wa;var t=e.data,n=e.compression;if(t){if(n===To.GZipJS){var r=ps(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new Lo(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;n>o;++o){if(i+5>r.length){var s=new Lo(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);128>c?a(c):2048>c?(a(192|c>>>6),a(128|63&c)):c>55295&&57344>c?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return ts(r,0,i)}(Ya(t)),{mtime:0});return{contentType:hs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===To.Base64){var i=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:Ya(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>
2String.fromCharCode(parseInt(t,16)))))}(Ya(t)));return{contentType:`application/x-www-form-urlencoded`,body:i,estimatedSize:new Blob([i]).size}}var a=Ya(t);return{contentType:`application/json`,body:a,estimatedSize:new Blob([a]).size}}},bs=e=>{var t,n,r=()=>e.transport===`sendBeacon`?{url:vs(e.url,{compression:To.Base64}),encodedBody:ys(x({},e,{compression:To.Base64,Wa:void 0}))}:{url:_s(e.url,`compression`),encodedBody:ys(x({},e,{compression:void 0,Wa:void 0}))};try{t=ys(e)}catch(t){if(qt(e.compression,Za(e.url,`compression`)))return B.error(`Failed to gzip request body, sending uncompressed payload`,t),r();throw t}return t&&qt(e.compression,Za(e.url,`compression`))&&!((n=t.body)instanceof ArrayBuffer?Kt(new Uint8Array(n)):ArrayBuffer.isView(n)&&Kt(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(gs=!0,r()):{url:e.url,encodedBody:t}},xs=e=>{try{return bs(e)}catch(t){B.error(t),e.callback==null||e.callback({statusCode:0,error:t});return}},Ss=function(){var e=b((function*(e){var t=yield function(e,t,n){return Zt.apply(this,arguments)}(Ya(e.data),v.DEBUG,{rethrow:!0});if(!t)return e;var n=yield t.arrayBuffer();return x({},e,{Wa:{contentType:hs,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Cs=/Failed to fetch|NetworkError|Load failed/i,ws=e=>e?.name===`TypeError`&&Cs.test(e?.message||``),Ts=e=>{var t=xs(e);if(t){var n=t.url,r=t.encodedBody??{},i=r.contentType,a=r.body,o=r.estimatedSize,s=new Headers;K(e.headers,(function(e,t){s.append(t,e)})),i&&s.append(`Content-Type`,i);var c=null,l=!1;if(f){var d=new f;c={signal:d.signal,timeout:setTimeout((()=>{var t;l=!0,d.abort(zt(`AbortError`,`PostHog request timed out`+((t=e.timeout)?` after `+t+`ms`:``)))}),e.timeout)}}var p=t=>{l&&t?.name===`AbortError`||ws(t)?B.warn(t):B.error(t),e.callback==null||e.callback({statusCode:0,error:t})};try{u(n,x({method:e?.method||`GET`,headers:s,keepalive:e.method===`POST`&&!e.Va&&52428.8>(o||0),body:a,signal:c?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){B.error(e)}e.callback==null||e.callback(r)})))).catch(p).finally((()=>c?clearTimeout(c.timeout):null))}catch(e){c&&clearTimeout(c.timeout),p(e)}}},Es=e=>{try{var t=bs(e),n=t.url,r=t.encodedBody??{},i=r.body,a=r.estimatedSize;if(!i)return;var o=i instanceof Blob?i:new Blob([i],{type:r.contentType});if(s.sendBeacon(n,o))return;var c=A(e.data)?e.data:e.data?.batch;if(A(c)&&c.length>1&&(a??0)>16384){var l=Math.ceil(c.length/2),u=t=>A(e.data)?t:x({},e.data,{batch:t});Es(x({},e,{data:u(c.slice(0,l))})),Es(x({},e,{data:u(c.slice(l))}));return}B.warn(`Beacon of ~`+(a??0)+` bytes was rejected by the browser, falling back to fetch`),Ts(x({},e,{Va:!0}))}catch(e){B.warn(`Beacon send failed`,e)}},Ds=(e,t,n,r)=>{var i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return vs(n===To.GZipJS?_s(e,`compression`):e,x({},i?{[i]:Date.now().toString()}:{},n===To.GZipJS?{}:{compression:n}))},Os=[];u&&Os.push({transport:`fetch`,method:Ts}),d&&Os.push({transport:`XHR`,method(e){var t=xs(e);if(t){var n=new d,r=t.encodedBody;n.open(e.method||`GET`,t.url,!0);var i=r??{},a=i.contentType,o=i.body;K(e.headers,(function(e,t){n.setRequestHeader(t,e)})),a&&n.setRequestHeader(`Content-Type`,a),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var t={statusCode:n.status,text:n.responseText};if(n.status===200)try{t.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(t)}},n.send(o)}}}),s!=null&&s.sendBeacon&&Os.push({transport:`sendBeacon`,method:Es});var ks=3e3,As=class{constructor(e,t){this.Ga=!0,this.Za=[],this.Qa=Me(t?.flush_interval_ms||ks,250,5e3,B.createLogger(`flush interval`),ks),this.Ja=e}enqueue(e){this.Za.push(e),this.Ka||this.Ya()}unload(){this.Xa();var e=this.Za.length>0?this.eo():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.io(x({},e,{transport:`sendBeacon`}))}))}enable(){this.Ga=!1,this.Ya()}Ya(){var e=this;this.Ga||(this.Ka=setTimeout((()=>{if(this.Xa(),this.Za.length>0){var t=this.eo(),n=function(){var n=t[r],i=new Date().getTime();n.data&&A(n.data)&&K(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.io(n)};for(var r in t)n()}}),this.Qa))}io(e){try{this.Ja(e)}catch(e){B.error(e)}}Xa(){clearTimeout(this.Ka),this.Ka=void 0}eo(){var e={};return K(this.Za,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;N(e[i])&&(e[i]=x({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.Za=[],e}},js=[`retriesPerformedSoFar`],Ms=class{constructor(e){this.ro=!1,this.no=3e3,this.Za=[],this._instance=e,this.Za=[],this.so=!0,!N(a)&&`onLine`in a.navigator&&(this.so=a.navigator.onLine,this.ao=()=>{this.so=!0,this.oo()},this.lo=()=>{this.so=!1},J(a,`online`,this.ao),J(a,`offline`,this.lo))}get length(){return this.Za.length}retriableRequest(e){var t=e.retriesPerformedSoFar,n=S(e,js);be(t)&&(n.url=vs(n.url,{retry_count:t})),this._instance._send_request(x({},n,{callback:e=>{if(e.statusCode!==200&&(400>
2e.statusCode||e.statusCode>=500)){if((e.statusCode===0?3:10)>(t??0))return void this.Yn(x({retriesPerformedSoFar:t},n));e.statusCode===0&&B.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after `+(t??0)+` retries.`)}n.callback==null||n.callback(e)}}))}Yn(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=Math.random()-.5;return Math.ceil(r+i*(r-n))}(t),r=Date.now()+n;this.Za.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),B.warn(i),this.ro||(this.ro=!0,this.uo())}uo(){if(this.ho&&clearTimeout(this.ho),this.Za.length===0)return this.ro=!1,void(this.ho=void 0);this.ho=setTimeout((()=>{this.so&&this.Za.length>0&&this.oo(),this.uo()}),this.no)}oo(){var e=Date.now(),t=[],n=this.Za.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Za=t,n.length>0)for(var r of n)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.ho&&=(clearTimeout(this.ho),void 0),this.ro=!1,N(a)||(this.ao&&=(a.removeEventListener(`online`,this.ao),void 0),this.lo&&=(a.removeEventListener(`offline`,this.lo),void 0)),this.Za)){var t=e.requestOptions;try{this._instance._send_request(x({},t,{transport:`sendBeacon`}))}catch(e){B.error(e)}}this.Za=[]}},Ns=class{constructor(e){this.do=()=>{this.vo||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.vo.lastScrollY=Math.ceil(t),this.vo.maxScrollY=Math.max(t,this.vo.maxScrollY??0),this.vo.maxScrollHeight=Math.max(n,this.vo.maxScrollHeight??0),this.vo.lastContentY=r,this.vo.maxContentY=Math.max(r,this.vo.maxContentY??0),this.vo.maxContentHeight=Math.max(i,this.vo.maxContentHeight??0)},this._instance=e}get co(){return this._instance.config.scroll_root_selector}getContext(){return this.vo}resetContext(){var e=this.vo;return setTimeout(this.do,0),e}startMeasuringScrollPosition(){J(a,`scroll`,this.do,{capture:!0}),J(a,`scrollend`,this.do,{capture:!0}),J(a,`resize`,this.do)}scrollElement(){if(!this.co)return a?.document.documentElement;for(var e of A(this.co)?this.co:[this.co]){var t=a?.document.querySelector(e);if(t)return t}}fo(e){var t=e===`y`?`scrollTop`:`scrollLeft`;if(this.co){var n=this.scrollElement();return n&&n[t]||0}return a?e===`y`?a.scrollY||a.pageYOffset||a.document.documentElement.scrollTop||0:a.scrollX||a.pageXOffset||a.document.documentElement.scrollLeft||0:0}scrollY(){return this.fo(`y`)}scrollX(){return this.fo(`x`)}},Ps=e=>mo(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),Fs=class{constructor(e,t,n,r){this.xt=e=>{var t=this.po();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.mo(this._instance)};this.yo.register({[qr]:n})}},this._instance=e,this.bo=t,this.yo=n,this.mo=r||Ps,this.bo.onSessionId(this.xt)}po(){return this.yo.props[qr]}getSetOnceProps(){var e=this.po()?.props;return e?`r`in e?ho(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return K(vi(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+pe(n)]=t})),e}},Is=class{on(e,t){return this._o[e]||(this._o[e]=[]),this._o[e].push(t),()=>{this._o[e]=this._o[e].filter((e=>e!==t))}}emit(e,t){for(var n of this._o[e]||[])n(t);for(var r of this._o[`*`]||[])r(e,t)}constructor(){this._o={}}},Ls=V(`[SessionId]`),Rs=864e5,zs=class{on(e,t){return this.wo.on(e,t)}constructor(e,t,n){var r;if(this.ko=null,this.So=null,this.xo=[],this.Co=void 0,this.To=!1,this.wo=new Is,this.Mo=(e,t)=>!(!be(e)||!be(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===oi)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.vn=e.config,this.yo=e.persistence,this.Ct=void 0,this.Le=void 0,this._sessionStartTimestamp=null,this.Eo=void 0,this._sessionActivityTimestamp=null,this.Io=t||Oi,this.Ro=n||Oi;var i=this.vn.persistence_name||this.vn.token;if(this._sessionTimeoutMs=1e3*Me(this.vn.session_idle_timeout_seconds||1800,60,36e3,Ls.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Po(),this.Ao=`ph_`+i+`_window_id`,this.Fo=`ph_`+i+`_primary_window_exists`,this.Oo()){var a=Z.ni(this.Ao),o=Z.ni(this.Fo);a&&!o?this.Ct=a:Z.ri(this.Ao),Z.ei(this.Fo,!0)}(r=this.vn.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.vn.bootstrap.sessionID),this.Lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return N(this.xo)&&(this.xo=[]),this.xo.push(e),this.Le&&e(this.Le,this.Ct),()=>{this.xo=this.xo.filter((t=>t!==e))}}Oo(){return this.vn.persistence!==`memory`&&!this.yo.ga&&Z.Xr()}Do(e){e!==this.Ct&&(this.Ct=e,this.Oo()&&Z.ei(this.Ao,e))}$o(){return this.Ct?this.Ct:this.Oo()?Z.ni(this.Ao):null}No(e){var t=this.ko;return!F(t)&&!F(e)&&5e3>Math.abs(e-t)}qo(e,t,n){var r=t!==this._sessionActivityTimestamp,i=e===this.Le&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Le=e,i&&!r||i&&this.No(t)||(this.ko=t,this.yo.register({[Cr]:[t,e,n]}))}jo(){var e=this.vn?.persistence_save_debounce_ms;return be(e)&&e>0}Bo(){this.jo()?this.yo.refreshKey(Cr):(this.yo.flush(),this.yo.load())}Ho(){if(!F(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ko){this.Bo();var e=this.zo();e[1]===this.Le&&e[2]===this._sessionStartTimestamp&&(this.ko=this._sessionActivityTimestamp,this.yo.register({[Cr]:[this._sessionActivityTimestamp,this.Le??null,this._sessionStartTimestamp]}),this.yo.flush())}}Uo(){var e=this.zo()[0],t=be(e)?e:0,n=be(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Wo(e){return this.Bo(),this.Mo(e,this.Uo())}zo(){var e=this.yo.props[Cr];return A(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.ko=null,this.Eo=void 0,clearTimeout(this.Vo),this.Vo=void 0,this.qo(null,null,null)}
2setBootstrapSessionId(e,t){t===void 0&&(t=!1);var n=function(e,t){t===void 0&&(t=new Date().getTime());try{var n=(e=>{var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(e);return n>t+6e4?void Ls.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){Ls.error(`Invalid sessionID in bootstrap`,e);return}}(e);return!N(n)&&(t?this.Eo={sessionId:e,sessionStartTimestamp:n}:this.qo(e,new Date().getTime(),n),!0)}destroy(){this.To=!0,this.Ho(),clearTimeout(this.Vo),this.Vo=void 0,this.Co&&a&&(a.removeEventListener(li,this.Co,{capture:!1}),this.Co=void 0),this.xo=[]}Lo(){this.Co=()=>{this.Ho(),this.Oo()&&Z.ri(this.Fo)},J(a,li,this.Co,{capture:!1})}checkAndGetSessionAndWindowId(e,t,n){if(e===void 0&&(e=!1),t===void 0&&(t=null),n===void 0&&(n=!1),this.vn.cookieless_mode===oi)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var r=t||new Date().getTime(),i=this.Le;if(n)this.So=r;else if(F(this.So)||this.So>r||r-this.So>=1e3){var a,o;(a=(o=this.yo).syncCookieProperties)==null||a.call(o),this.So=r}var s=this.zo(),c=s[1],l=s[2],u=!N(i)&&c!==i,d=this.Uo(),f=this.$o(),p=this.Eo,m=!!p&&(p.sessionStartTimestamp>r+6e4||r-p.sessionStartTimestamp>Rs),h=p?m:be(l)&&Math.abs(r-l)>Rs,g=!1,_=u,v=!c||!!p,y=c,b=!v&&!e&&this.Mo(r,d);if(b){(b=this.Wo(r))||Ls.info(`cross-tab refresh kept the session alive`,{sessionId:c});var x=this.zo();c=x[1],l=x[2]}if(v||b||h){_=!1;var S=p&&!m;c=S?p.sessionId:this.Io(),f=this.Ro(),Ls.info(`new session ID assigned`,{sessionId:c,windowId:f,bootstrapped:!!S,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),l=S?p.sessionStartTimestamp:r,this.Eo=void 0,g=!0}else f||(f=this.Ro(),g=!0),(_||=c!==y)&&(Ls.info(`adopted cross-tab session id`,{sessionId:c,windowId:f}),g=!0);var C=be(d)&&e&&!h?d:r,w=be(l)?l:new Date().getTime();this.Do(f),this.qo(c,C,w),e||this.Po();var T={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:_};return g&&this.xo.forEach((e=>e(c,f,T))),{sessionId:c,windowId:f,sessionStartTimestamp:w,changeReason:g?T:void 0,lastActivityTimestamp:d}}Po(){this.To||(clearTimeout(this.Vo),this.Vo=setTimeout((()=>{if(!this.To){if(this.Wo(new Date().getTime())){var e=this.Le;this.resetSessionId(),this.wo.emit(`forcedIdleReset`,{idleSessionId:e})}else this.Po()}}),1.1*this.sessionTimeoutMs))}},Bs=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&de(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>de(e?.brand,t))))return!0}catch{}return!!e.webdriver};function Vs(){return(Vs=b((function*(){var e=s?.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=(yield e.getHighEntropyValues([`model`]))?.model;return P(t)&&t.length>0?t:void 0}catch(e){B.info(`Unable to resolve $device_model from userAgentData.getHighEntropyValues`,e);return}}))).apply(this,arguments)}function Hs(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Us=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ws=e=>e.toLowerCase(),Gs={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Us(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Us(t,e))))),icontains:(e,t)=>t.map(Ws).some((t=>e.map(Ws).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Ws).every((t=>e.map(Ws).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))};function Ks(e,t){return!e||Object.entries(e).every((e=>{var n=e[1],r=t?.[e[0]];if(r==null)return!1;var i=Gs[n.operator];return!!i&&i(n.values,[String(r)])}))}function qs(e,t,n){return Ya({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Js=`custom`,Ys=`i.posthog.com`,Xs=/^\/static\//,Zs=[`/s/`,`/e/`,`/i/`],Qs=class{constructor(e){this.Go={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+Ys,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.Go[this.apiHost]||(this.Go[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`:Js),this.Go[this.apiHost]}Zo(e){if(Xs.test(e)){var t=this.instance.config.asset_host;if(typeof t==`string`)return t.trim().replace(/\/$/,``)||void 0}}Qo(e){var t=Xa(e);return t?t.protocol+`//`+t.host+t.pathname:void 0}Jo(e,t,n){if(e===`ui`)return n;var r=n,i=this.instance.config.rewriteRequestPath;if(i){var a=Xa(n)?.href||n;r=i(new URL(a)).toString()}if(i&&e===`api`&&Zs.some((e=>t.indexOf(e)===0))){var o=this.Qo(r);if(o){var s=this.apiHost,c=this.Ko;c?.apiHost===s&&c.rewriteRequestPath===i||(c={apiHost:s,rewriteRequestPath:i,urls:new Set},this.Ko=c),c.urls.add(o)}}return r}isIngestionEndpoint(e){var t=this.Ko,n=this.Qo(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.Jo(e,t,this.uiHost+t);if(e===`flags`)return this.Jo(e,t,this.flagsApiHost+t);if(e===`assets`){var n=this.Zo(t);if(n)return this.Jo(e,t,``+n+t)}if(this.region===Js)return this.Jo(e,t,this.apiHost+t);var r=Ys+t;switch(e){case`assets`:return this.Jo(e,t,`https://`+this.region+`-assets.`+r);case`api`:return this.Jo(e,t,`https://`+this.region+`.`+r)}}},$=V(`[Surveys]`),$s=`seenSurvey_`,ec=e=>{try{var t=(e=>((e,t)=>``+$s+function(e){return e.current_iteration&&e.current_iteration>0?e.id+`_`+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,`true`)}catch(e){$.error(`Failed to persist survey seen state`,e)}},tc=[Do.Popover,Do.Widget,Do.API],nc={ignoreConditions:!1,ignoreDelay:!1,displayType:Ao.Popover}
2,rc=V(`[PostHog ExternalIntegrations]`),ic={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},ac=class{constructor(e){this._instance=e}Zs(e,t){var n;(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return rc.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,r,i,a=n[0],o=n[1];!o||(t=_.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[a]||e.Zs(ic[a],(()=>{var t;(t=_.__PosthogExtensions__)==null||(t=t.integrations)==null||(t=t[a])==null||t.start(e._instance)})),!o&&(r=_.__PosthogExtensions__)!=null&&(r=r.integrations)!=null&&r[a]&&((i=_.__PosthogExtensions__)==null||(i=i.integrations)==null||(i=i[a])==null||i.stop())};for(var n of Object.entries((r=this._instance.config.integrations)??{})){var r;t()}}},oc=class{constructor(e,t){this.I=e,this.Os=t,this.Yo=new Map,this.Rs=!1}add(e){var t=this;return b((function*(){if(t.Rs)throw Error(`Cannot add an extension to a disposed ExtensionRuntime`);if(t.Yo.has(e.name))throw Error(`Browser extension "`+e.name+`" is already registered`);t.Yo.set(e.name,e);try{var n=e.setup(t.Os);n&&(yield n)}catch(n){var r=t.Yo.get(e.name)===e;r&&t.Yo.delete(e.name),t.I.error(`Failed to set up browser extension "`+e.name+`"`,n),r&&t.Xo(e)}}))()}getExtension(e){return this.Yo.get(e)}dispose(){if(!this.Rs){this.Rs=!0;var e=Array.from(this.Yo.values()).reverse();for(var t of(this.Yo.clear(),e))this.Xo(t)}}Xo(e){try{var t=e.dispose==null?void 0:e.dispose();t&&j(t.then)&&t.then(void 0,(t=>{this.I.error(`Failed to dispose browser extension "`+e.name+`"`,t)}))}catch(t){this.I.error(`Failed to dispose browser extension "`+e.name+`"`,t)}}},sc=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e==`string`)return t?.get_property(e);var n={};for(var r of e){var i=t?.get_property(r);N(i)||(n[r]=i)}return n}set(e,t){var n;(n=this._instance.persistence)==null||n.register(typeof e==`string`?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)==null||t.unregister(e)}},cc=`extensionsRemoteConfig`,lc=class{constructor(e){this.Rs=!1,this.instance=e,this.I=B,this.tl=e.el,this.kv=new sc(e),this.onEvent=e=>wo(this.instance.on(`eventCaptured`,(t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.I.error(`Browser extension event listener failed`,e)}}))),this.onRemoteConfig=e=>{if(this.Rs)return wo((()=>{}));var t=t=>{try{e(t)}catch(e){this.I.error(`Browser extension remote config listener failed`,e)}},n=this.instance.il.on(cc,t);return this.tl&&t(this.tl),wo(n)}
2,this.rl=new oc(B.createLogger(`[BrowserExtensions]`),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){return this.instance.get_property(rr)??this.distinctId}get deviceId(){var e=this.instance.get_property(rr);return typeof e==`string`?e:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){return this.instance.persistence?.get_initial_props()??{}}get groups(){return this.instance.getGroups()}get session(){try{var e=this.instance.sessionManager?.checkAndGetSessionAndWindowId(!0);return{sessionId:e?.sessionId??``,windowId:e?.windowId??``,sessionStartTimestamp:e?.sessionStartTimestamp??0}}catch{return{sessionId:``,windowId:``,sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.rl.add(e)}getExtension(e){return this.rl.getExtension(e)}capture(e,t,n){var r=this;return b((function*(){n?r.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):r.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return wo(this.instance.nl(e))}handleRemoteConfig(e){this.Rs||(this.tl=e,this.instance.il.emit(cc,e))}sendRequest(e,t){var n=this;return b((function*(){t===void 0&&(t={});var r=n.instance.requestRouter.endpointFor(t.target??`api`,e),i={method:t.method,url:t.query?vs(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target===`flags`&&t.compression===`best-available`?O.Base64:void 0,timestampMode:t.sentAt};return t.transport===`sendBeacon`?(n.instance._send_request(i),{statusCode:202}):new Promise((e=>{i.callback=e,n.instance._send_request(i)}))}))()}dispose(){this.Rs||(this.Rs=!0,this.rl.dispose())}},uc={},dc=0,fc=()=>{},pc=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,mc=`Surveys module not available`,hc=`sanitize_properties is deprecated. Use before_send instead`,gc=`Invalid value for property_denylist config: `,_c=[`token`,`distinct_id`,ei],vc=`posthog`,yc=!ms&&m?.indexOf(`MSIE`)===-1&&m?.indexOf(`Mozilla`)===-1,bc=e=>{var t={};return e&&e!==`unset`?(`2025-11-30`>e||(t.strictMinimumDuration=!0),`2026-05-30`>e||(t.canvasCapture={resolutionScale:.6}),`2026-06-25`>e||(t.streamNetworkBody=!0),`2026-08-30`>e||(t.captureJsonLd=!0),t):t},xc=e=>{var t;return x({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,asset_host:null,token:``,autocapture:!0,cross_subdomain_cookie:bi(c?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:fc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e??`unset`,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&P(l?.search)&&l.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:`fallback`,enable_recording_console_log:void 0,secure_cookie:(a==null||(t=a.location)==null?void 0:t.protocol)===`https:`,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(e){B.error(`Bad HTTP status: `+e.statusCode+` `+e.text)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:si,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:ks},error_tracking:{},_onCapture:fc},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:ha,ignore_text_selection:!0}
2:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:bc(e),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),cookieWinsOnConflict:!(!e||e===`unset`||`2026-08-29`>e)}))(e))},Sc=[[`process_person`,`person_profiles`],[`xhr_headers`,`request_headers`],[`cookie_name`,`persistence_name`],[`disable_cookie`,`disable_persistence`],[`__preview_disable_beacon`,`disable_beacon`],[`store_google`,`save_campaign_params`],[`verbose`,`debug`],[`__preview_cookie_wins_on_conflict`,`cookieWinsOnConflict`]],Cc=e=>{var t={};for(var n of Sc){var r=n[0],i=n[1];N(e[r])||(t[i]=e[r])}var a=q({},t,e),o=e.__preview_external_dependency_versioned_paths;return N(o)||(N(e.strict_script_versioning)&&(a.strict_script_versioning=!!o),P(o)&&N(e.asset_host)&&(a.asset_host=o)),A(e.property_blacklist)&&(N(e.property_denylist)?a.property_denylist=e.property_blacklist:A(e.property_denylist)?a.property_denylist=[...e.property_blacklist,...e.property_denylist]:B.error(gc+e.property_denylist)),a},wc=class{constructor(){this.__forceAllowLocalhost=!1}get sl(){return this.__forceAllowLocalhost}set sl(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Tc=class e{al(e,t){if(e){var n=this.Yo.indexOf(e);n!==-1&&this.Yo.splice(n,1)}return this.Yo.push(t),t.initialize==null||t.initialize(),t}ol(){return this.config.cookieless_mode===oi||this.config.cookieless_mode===ai&&this.consent.isRejected()}ll(){if(!this.ol()&&this.get_distinct_id()===$r){var e=this.persistence;if(e){this.ul()||e.load(!0);var t=this.get_distinct_id();if(!t||t===$r){var n=this.config.get_device_id(Oi());this.register({distinct_id:n,$device_id:n}),e.set_property(U,W)}this.hl()}}}get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new wc,this.dl=!1,this.version=v.LIB_VERSION,this.vl=new Set,this.cl=``,this.il=new Is,this.Yo=[],this.fl=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xc(),this.SentryIntegration=Ua,this.sentryIntegration=e=>function(e,t){var n=Ha(e,t);return{name:Va,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.pl=!1,this.gl=null,this.ml=null,this.yl=null,this.scrollManager=new Ns(this),this.pageViewManager=new Wa(this),this.rateLimiter=new Po(this),this.requestRouter=new Qs(this),this.consent=new Ki(this),this.externalIntegrations=new ac(this);var t=e.__defaultExtensionClasses??{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,n)=>{var r=P(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=P(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>B.info(`send "`+e?.event+`"`,e)))}init(t,n,r){if(r&&r!==vc){var i=uc[r]??new e;return i._init(t,n,r),uc[r]=i,uc[vc][r]=i,i}return this._init(t,n,r)}_init(e,t,n){var r;t===void 0&&(t={});var i=P(e)?e.trim():``;if(!i)return B.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 i===this.config?.token?console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`):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('`+i+`', { ... }, 'project2')`),this;this.__loaded=!0,this.config=xc(t.defaults),t.debug=this.bl(t.debug),this._l=t,this.wl=[],t.person_profiles?this.ml=t.person_profiles:t.process_person&&(this.ml=t.process_person);var o=xc(t.defaults),s=Cc(t),c=q({},o,s,{name:n,token:i});M(o.rageclick)&&M(s.rageclick)&&(c.rageclick=q({},o.rageclick,s.rageclick)),M(o.session_recording)&&M(s.session_recording)&&(c.session_recording=q({},o.session_recording,s.session_recording)),this.set_config(c),this.config.on_xhr_error&&B.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:To.GZipJS;var l=this.ul();if(this.persistence=new Co(this.config,l),this.sessionPersistence=this.config.persistence===`
2sessionStorage`||this.config.persistence===`memory`?this.persistence:new Co(x({},this.config,{persistence:`sessionStorage`}),l,!1),this.cl=`ph_`+(this.config.persistence_name||this.config.token)+`_session_registered_properties`,this.config.persistence!==`memory`&&!l&&Z.Xr()){var u=Z.ni(this.cl);A(u)&&u.forEach((e=>{P(e)&&this.vl.add(e)}))}else Z.ri(this.cl);var d=x({},this.persistence.props),f=x({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.kl=new As((e=>this.Sl(e)),this.config.request_queue_config),this.xl=new Ms(this),this.__request_queue=[];var p=this.ol();if(p||(this.sessionManager=new zs(this),this.sessionPropsManager=new Fs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((e,t,n)=>{(n!=null&&n.activityTimeout||n!=null&&n.sessionPastMaximumLength||n!=null&&n.crossTabAdoption)&&this.Cl()}))),this.Tl(),this.config.__preview_deferred_init_extensions?(B.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.Ml(p)}),0)):(B.info(`Initializing extensions synchronously`),this.Ml(p)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&B.info(`Starting in debug mode`,{this:this,config:t,thisC:x({},this.config),p:d,s:f}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=x({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),t.bootstrap?.distinctID!==void 0){var m=t.bootstrap.distinctID,h=this.get_distinct_id(),g=this.persistence.get_property(U);if(t.bootstrap.isIdentifiedID&&h!=null&&h!==m&&g===W)this.identify(m);else if(t.bootstrap.isIdentifiedID&&h!=null&&h!==m&&g===G)B.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 _=this.config.get_device_id(Oi()),y=t.bootstrap.isIdentifiedID?_:m;this.persistence.set_property(U,t.bootstrap.isIdentifiedID?G:W),this.register({distinct_id:m,$device_id:y})}}if(p)this.register_once({distinct_id:$r,$device_id:null},``);else if(!this.get_distinct_id()){var b=this.config.get_device_id(Oi());this.register_once({distinct_id:b,$device_id:b},``),this.persistence.set_property(U,W)}return J(a,`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 r=n=>{var r=()=>n.anonymousId()||Oi();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(U,G)),t()},i=n.user();`then`in i&&j(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{typeof Promise<`u`&&Promise.resolve||Ba.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ba.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ba.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,ui),identify:e=>t(e,fi),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}(this,(()=>this.El())):this.El(),j(this.config._onCapture)&&this.config._onCapture!==fc&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&B.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 Vs.apply(this,arguments)}().then((e=>{e&&this.register({[ir]:e})})).catch(fc),this}Il(e){var t=e;return P(t.name)&&j(t.setup)}Rl(e,t){this.Il(e)?t.push((()=>{this.Pl().add(e).catch((()=>
2e.dispose==null?void 0:e.dispose())).catch((t=>{B.error(`Failed to dispose browser extension "`+e.name+`"`,t)}))})):this.Yo.push(e)}Tl(){var t,n,r,i=this.config.__extensionClasses?.featureFlags??e.__defaultExtensionClasses?.featureFlags;i&&(this.featureFlags&&this.featureFlags instanceof i||((t=this.Al)==null||t.call(this),this.Al=void 0,this.featureFlags=new i(this)),j(this.featureFlags.onReloading)&&j(this.featureFlags.setup)?this.Al||(this.Al=this.featureFlags.onReloading((()=>{this.il.emit(`featureFlagsReloading`,!0)})),this.Pl().add(this.featureFlags)):(n=(r=this.featureFlags).initialize)==null||n.call(r))}Ml(t){var n=performance.now(),r=x({},e.__defaultExtensionClasses,this.config.__extensionClasses),i=[];r.exceptions&&this.Yo.push(this.exceptions=this.exceptions??new r.exceptions(this)),r.historyAutocapture&&this.Yo.push(this.historyAutocapture=new r.historyAutocapture(this)),r.tracingHeaders&&this.Yo.push(this.tracingHeaders=new r.tracingHeaders(this)),r.siteApps&&this.Yo.push(this.siteApps=new r.siteApps(this)),r.sessionRecording&&!t&&this.Yo.push(this.sessionRecording=new r.sessionRecording(this)),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.autocapture&&this.Rl(this.autocapture=new r.autocapture(this),i),r.surveys&&this.Rl(this.surveys=this.surveys??new r.surveys(this),i),r.logs&&this.Rl(this.logs=this.logs??new r.logs(this),i),r.metrics&&this.Yo.push(this.metrics=this.metrics??new r.metrics(this)),r.conversations&&this.Yo.push(this.conversations=this.conversations??new r.conversations(this)),r.productTours&&this.Yo.push(this.productTours=new r.productTours(this)),r.heatmaps&&this.Yo.push(this.heatmaps=new r.heatmaps(this)),r.webVitalsAutocapture&&this.Yo.push(this.webVitalsAutocapture=new r.webVitalsAutocapture(this)),r.exceptionObserver&&this.Yo.push(this.exceptionObserver=new r.exceptionObserver(this)),r.deadClicksAutocapture&&this.Yo.push(this.deadClicksAutocapture=new r.deadClicksAutocapture(this,Ra)),r.toolbar&&this.Yo.push(this.toolbar=this.toolbar??new r.toolbar(this)),r.experiments&&this.Yo.push(this.experiments=this.experiments??new r.experiments(this)),this.Yo.forEach((e=>{e.initialize&&i.push((()=>{e.initialize==null||e.initialize()}))})),i.push((()=>{if(this.Fl){var e=this.Fl;this.Fl=void 0,this.Yo.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}})),this.Ol(i,n)}Ol(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Ol(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){B.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({[ti]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[ni]:r}),this.config.__preview_deferred_init_extensions&&B.info(`PostHog extensions initialized (`+r+`ms)`)}za(e){var t;if(!c||!c.body)return B.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.za(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.Fl=e),this.el=e,this.compression=void 0,e.ok){var n,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=k(r.supp
2ortedCompression,To.GZipJS)?To.GZipJS:k(r.supportedCompression,To.Base64)?To.Base64:void 0),(n=r.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.ml?this.ml:si}),(t=this.Ll)==null||t.handleRemoteConfig(e),this.Yo.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}El(){try{this.config.loaded(this)}catch(e){B.critical("`loaded` function failed",e)}if(this.Dl(),this.config.internal_or_test_user_hostname&&l!=null&&l.hostname){var e=l.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ol())&&this.$l()}),1),this.Nl=new Io(this),this.Nl.load()}Dl(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.kl)==null||e.enable())}_dom_loaded(){this.is_capturing()&&mi(this.__request_queue,(e=>this.Sl(e))),this.__request_queue=[],this.Dl()}_handle_unload(){var e,t,n,r,i;(e=this.surveys)==null||e.handlePageUnload==null||e.handlePageUnload(),(t=this.metrics)==null||t.flush(`sendBeacon`),this.config.request_batching?(this.ql()&&this.capture(di),(n=this.logs)==null||n.flushLogs(`sendBeacon`),(r=this.kl)==null||r.unload(),(i=this.xl)==null||i.unload()):this.ql()&&this.capture(di,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded?yc?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=x({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression??e.compressionFallback:e.compression,(N(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=x({},e);t.timeout=t.timeout||6e4;var n,r,i,a,o=t.transport??`fetch`;o===`sendBeacon`&&N(t.compression)&&t.data&&(t.compression=To.Base64),t.method===`POST`&&t.data&&(t.timestampMode===`capture-body`?t.data={api_key:((a=(i=(A(n=t.data)?n:[n]).map((e=>x({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{}))))[0])==null||(r=a.properties)==null?void 0:r.token)??a?.token,batch:i,sent_at:new Date().toISOString()}:t.timestampMode===`body`&&(t.data=function(e,t){return t===void 0&&(t=new Date().toISOString()),A(e)?e.map((e=>x({},e,{sent_at:t}))):x({},e,{sent_at:t})}(t.data))),t.url=Ds(t.url,t.method,t.compression,t.timestampMode);var s=Os.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),c=function(e,t){for(var n=0;e.length>n;n++)if(e[n].transport===o)return e[n]}(s)?.method??s[0].method;if(!c)throw Error(`No available transport method`);var l=e=>{try{c(e)}catch(e){ws(e)?B.warn(e):B.error(e),t.callback==null||t.callback({statusCode:0,error:e})}};o!==`sendBeacon`&&t.data&&t.compression===To.GZipJS&&p&&typeof Promise<`u`&&!gs?Ss(t).then((e=>{l(e)})).catch((n=>{if(Jt(n))return gs=!0,void l(x({},t,{compression:void 0,url:Ds(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||typeof e!=`object`)return!1;var t=`name`in e?String(e.name):``;return Jt(e)||t===Gt})(n)&&(gs=!0),l(t)})):c(t)})(x({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(n=(r=this.config).on_request_error)==null||n.call(r,t),e.callback==null||e.callback(t)}}))):e.fireCallbackOnDrop&&(e.callback==null||e.callback({statusCode:0}))}Sl(e){this.xl?this.xl.retriableRequest(e):this._send_request(e)}_execute_array(e){dc++;try{var t,n=[],r=[],i=[];mi(e,(e=>{if(e){if(A(t=e[0]))i.push(e);else if(j(e))try{e.call(this)}catch(t){B.error(`Error executing queued PostHog call`,e,t)}else A(e)&&t===`alias`?n.push(e):A(e)&&t.indexOf(`capture`)!==-1&&j(this[t])?i.push(e):r.push(e)}}));var a=function(e,t){mi(e,(function(e){try{if(A(e[0])){var n=t;K(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){B.error(`Error executing queued PostHog call`,e,t)}}))};a(n,this),a(r,this),a(i,this)}finally{dc--}}push(t){if(dc>0&&A(t)&&P(t[0])){var n=e.prototype[t[0]];j(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,n){var r,i,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.kl){if(this.is_capturing()){if(!N(e)&&P(e)){this.ll();var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var c=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){t!=null&&t.$current_url&&!P(t?.$current_url)&&(B.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.jl||B.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 l=new Date,u=n?.timestamp||l,d=Rt(n?.uuid,Oi),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},u,d)};e===ui&&this.config.__preview_capture_bot_pageviews&&s&&(f.event=`$bot_pageview`,f.properties.$browser_type=`bot`),c&&(f.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var p=e===`$feature_flag_called`&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(jr);n!=null&&n.$set&&!p&&(f.$set=n?.$set);var m=n?.$unset;m&&(f.$unset=m);var h,g,_,v=p?void 0:this.Bl(n?.$set_once,e!==pi,e===fi);if(v&&(f.$set_once=v),n!=null&&n._noTruncate||(r=this.config.properties_string_max_length,i=f,a=e=>P(e)?e.slice(0,r):e,o=new Set,f=function e(t,n){if(t!==Object(t))return a?a(t):t;if(!o.has(t)){var r;if(o.add(t),A(t))r=[],mi(t,(t=>{r.push(e(t))}));else{var i={};K(t,((t,n)=>{o.has(t)||(i[n]=e(t,n))})),r=i}return r}}(i)),f.timestamp=u,N(n?.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=l),p&&(f.properties=function(e,t){t===void 0&&(t=[]);var n={},r=t=>{e[t]!==void 0&&(n[t]=e[t])};
2return E.forEach(r),t.forEach(r),n}(f.properties,_c)),e===Oo.DISMISSED||e===Oo.SENT){var y=t?.[ko.SURVEY_ID],b=t?.[ko.SURVEY_ITERATION];ec({id:y,current_iteration:b}),f.$set=x({},f.$set,{[(h={id:y,current_iteration:b},g=e===Oo.SENT?`responded`:`dismissed`,_=`$survey_`+g+`/`+h.id,h.current_iteration&&h.current_iteration>0&&(_=`$survey_`+g+`/`+h.id+`/`+h.current_iteration),_)]:!0})}else e===Oo.SHOWN&&(f.$set=x({},f.$set,{[ko.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===jo.SHOWN){var S=t?.[Mo.TOUR_TYPE];S&&(f.$set=x({},f.$set,{[Mo.TOUR_LAST_SEEN_DATE+`/`+S]:new Date().toISOString()}))}var C=x({},f.properties.$set,f.$set);if(ve(C)||this.setPersonPropertiesForFlags(C),!I(this.config.before_send)){var w=this.Jn(f);if(!w)return;(f=w).uuid=Rt(f.uuid,Oi)}this.il.emit(`eventCaptured`,f);var T=n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),D={method:`POST`,url:T,data:f,compression:`best-available`,timestampMode:n?._batchKey===`recordings`||/\/s\/(?:\?|$)/.test(T)?`body`:`capture-body`,batchKey:n?._batchKey,transport:n?.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Sl(D):this.kl.enqueue(D),f}B.critical(`This capture call is ignored due to client rate limiting.`)}}else B.error(`No event name provided to posthog.capture`)}}else B.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}getExtension(e){return this.Ll?.getExtension(e)}Pl(){return this.Ll??=new lc(this)}nl(e){this.fl.push(e);var t=!0;return()=>{if(t){t=!1;var n=this.fl.indexOf(e);n!==-1&&this.fl.splice(n,1)}}}Hl(e){var t,n,r;return e===void 0&&(e=!0),!((t=this.persistence)==null||!t.consumeCookieIdentityChange())&&(this.yl=null,this.persistence.get_property(U)===W&&((r=this.sessionPersistence)==null||r.clear(),this.vl.clear(),this.zl()),(n=this.featureFlags)==null||n.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.Hl();var o=i?void 0:this.persistence.remove_event_timer(e),s=x({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,this.ol()&&(s[ei]=!0),e===`$snapshot`){var u=x({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=u.distinct_id,(!P(s.distinct_id)&&!L(s.distinct_id)||ye(s.distinct_id))&&B.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),s}var d,f=function(e,t,n,r){var i,o,s;if(r===void 0&&(r=!1),!m)return{};var c,u=e?[...ro,...t||[]]:[],d=function(e){for(var t=0;Ft.length>t;t++){var n=Ft[t],r=n[1],i=n[0].exec(e),a=i&&(j(r)?r(i,e):r);if(a)return a}return[``,``]}(m),f=d[0],p=d[1],h=(c=typeof navigator<`u`?navigator:void 0)!=null&&c.brave?{brave:!0}:{},g={};N(n)||(g.detectGoogleSearchApp=n);var _={},y=(i=navigator)==null||(i=i.userAgentData)==null?void 0:i.platform,b=navigator?.maxTouchPoints,x=a==null||(o=a.screen)==null?void 0:o.width,S=a==null||(s=a.screen)==null?void 0:s.height,C=a?.devicePixelRatio;N(y)||(_.userAgentDataPlatform=y),N(b)||(_.maxTouchPoints=b),N(x)||(_.screenWidth=x),N(S)||(_.screenHeight=S),N(C)||(_.devicePixelRatio=C);var w,T,E,D,O=q(vi({$os:f,$os_version:p,$browser:Mt(m,navigator.vendor,h,g),$device:It(m),$device_type:(T=m,E=_,D=It(T),D===ze||D===Re||D===`Kobo`||D===`Kindle Fire`||D===ht?Le:D===it||D===ot||D===at||D===ft?`Console`:D===Ve?`Wearable`:D?Pe:E?.userAgentDataPlatform===`Android`&&(E?.maxTouchPoints??0)>0?600>Math.min(E?.screenWidth??0,E?.screenHeight??0)/(E?.devicePixelRatio??1)?Pe:Le:`Desktop`),$timezone:go(),$timezone_offset:_o()}),{$current_url:Qa(r?Bt(l?.href):l?.href,u,ao),$host:l?.host,$pathname:l?.pathname,$raw_user_agent:m.length>1e3?m.substring(0,997)+`...`:m,$browser_version:Pt(m,navigator.vendor,h,g),$browser_language:uo(),$browser_language_prefix:(w=uo(),typeof w==`string`?w.split(`-`)[0]:void 0),$screen_height:a?.screen.height,$screen_width:a?.screen.width,$viewport_height:a?.innerHeight,$viewport_width:a?.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=v.SDK_DIST_CHANNEL),O}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes
2);if(this.sessionManager){var p=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime(),!0),h=p.windowId;s.$session_id=p.sessionId,s.$window_id=h}this.sessionPropsManager&&q(s,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&q(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=this.xl?.length}catch(e){s.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Js&&(s.$lib_custom_api_host=this.config.api_host),d=e!==ui||i?e!==di||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=q(s,d),e===ui&&c&&(s.title=c.title),!N(o)){var g=n.getTime()-o;s.$duration=parseFloat((g/1e3).toFixed(3))}m&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?`bot`:`browser`);var _=this.persistence.properties(),y=this.sessionPersistence.properties();K([`$referrer`,`$referring_domain`],(e=>{e in _&&delete y[e]}));var b={};if(this.fl.length>0)for(var S of this.fl.slice())try{q(b,S())}catch(e){B.error(`Failed to produce browser extension event properties`,e)}(s=q({},f,_,y,x({},b,s))).$is_identified=this._isIdentified(),A(this.config.property_denylist)?K(this.config.property_denylist,(function(e){delete s[e]})):B.error(gc+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var C=this.config.sanitize_properties;C&&(B.error(hc),s=C(s,e));var w=this.Ul();return s.$process_person_profile=w,w&&!i&&this.Wl(`_calculate_event_properties`),s}Bl(e,t,n){if(t===void 0&&(t=!0),n===void 0&&(n=!1),!this.persistence||!this.Ul()||this.dl&&!n)return e;var r=q({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),i=this.config.sanitize_properties;return i&&(B.error(hc),r=i(r,`$set_once`)),t&&(this.dl=!0),ve(r)?void 0:r}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t,n;(t=this.persistence)==null||t.syncCookieProperties(),this.Hl(),(n=this.sessionPersistence)==null||n.register(e),Object.keys(e).forEach((e=>this.vl.add(e))),this.zl()}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e),this.vl.delete(e),this.zl()}Vl(e,t){this.register({[e]:t})}Cl(){this.vl.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.vl.clear(),this.zl()}zl(){var e;if(this.cl){if(this.config.persistence===`memory`||(e=this.sessionPersistence)!=null&&e.ga||!Z.Xr())Z.ri(this.cl);else{var t=[];this.vl.forEach((e=>t.push(e))),t.length>0?Z.ei(this.cl,t):Z.ri(this.cl)}}}getFeatureFlag(e,t){return this.featureFlags?.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags?.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags?.getFeatureFlagResult(e,t)}getAllFeatureFlags(){return this.featureFlags?.getAllFeatureFlags()??[]}isFeatureEnabled(e,t){return this.featureFlags?.isFeatureEnabled(e,t)??t?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,n){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,n)}updateEarlyAccessFeatureEnrollment(e,t,n){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags?.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.il.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:mc}),()=>{})}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:mc})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:mc})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t){var n;t===void 0&&(t=nc),(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys?.canRenderSurvey(e)??{visible:!1,disabledReason:mc}}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys?.canRenderSurveyAsync(e,t)??Promise.resolve({visible:!1,disabledReason:mc})}Gl(e){return!e||ye(e)?(B.critical(`Unique user id has not been set in posthog.identify`),!1):e===$r?(B.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())||(B.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
2ot a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning(`posthog.identify`);if(L(e)&&(e=e.toString(),B.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),this.Gl(e)&&this.Wl(`posthog.identify`)){this.ll();var r=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.Hl(!1),o=this.persistence.ba(),s=!1;try{var c=this.get_distinct_id();this.register({$user_id:e}),this.get_property(rr)||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},``),e!==c&&e!==this.get_property(ar)&&(this.unregister(ar),this.register({distinct_id:e}));var l,u=(this.persistence.get_property(U)||W)===W,d=e!==c,f=!d&&u;if(d&&u)this.persistence.set_property(U,G),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture(fi,{distinct_id:e,$anon_distinct_id:c},{$set:t||{},$set_once:n||{}}),this.yl=qs(e,t,n),(l=this.featureFlags)==null||l.setAnonymousDistinctId(c);else if(f){this.persistence.set_property(U,G);var p=t||{},m=n||{};this.setPersonPropertiesForFlags({$set:p,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence._a(),this.capture(`$set`,{$set:p,$set_once:m}),this.yl=qs(e,t,n)}else(t||n)&&this.setPersonProperties(t,n);d||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ur)):f&&(t||n)&&this.reloadFeatureFlags(),s=!0}finally{o&&this.persistence.Sa(s)}}}setPersonProperties(e,t){if((e||t)&&this.Wl(`posthog.setPersonProperties`)){var n=qs(this.get_distinct_id(),e,t);this.yl===n?B.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.yl=n)}}unsetPersonProperties(e){var t,n=(A(e)?e:[e]).filter((e=>P(e)&&e.length>0));n.length!==0&&this.Wl(`posthog.unsetPersonProperties`)&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(n,!0),this.capture(`$set`,{$unset:n}),this.yl=null)}group(e,t,n){var r;if(e&&t){(r=this.persistence)==null||r.syncCookieProperties(),this.Hl();var i=this.getGroups(),a=i[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:x({},i,{[e]:t})}),a||n){var o={$group_type:e,$group_key:t};n&&(o.$group_set=n),this.capture(pi,o)}n&&this.setGroupPropertiesForFlags({[e]:n}),a&&!n&&this.reloadFeatureFlags()}else B.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),(n=this.featureFlags)==null||n.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;e===void 0&&(e=!0),(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var n;t===void 0&&(t=!0),this.Wl(`posthog.setGroupPropertiesForFlags`)&&((n=this.featureFlags)==null||n.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t=R(e)?e:e?.resetDeviceID,n=R(e)||e==null?void 0:e.bootstrap;this.Zl(t,!1,n)}Zl(e,t,n){var r,i;if(t===void 0&&(t=!1),B.info(`reset`),!this.__loaded)return B.uninitializedWarning(`posthog.reset`);var a=n?.sessionID;this.config.bootstrap=n||this._l?.bootstrap||{},(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.Ua());var o=this.get_property(rr),s=this.get_property(ir),c=this.get_property(_r),l=this.is_capturing();this.consent.reset(),t||!l||this.is_capturing()||console.warn(`[PostHog.js]`,"reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var u=(i=this.persistence)==null||i.ba==null?void 0:i.ba(),d=!1;try{var f,p,m,h,g,_,v,y,b,S,C,w,T;if((f=this.persistence)==null||f.clear(),(p=this.sessionPersistence)==null||p.clear(),this.vl.clear(),this.zl(),N(c)||(S=this.persistence)==null||S.register({[_r]:c}),(m=this.surveys)==null||m.reset(),(h=this.featureFlags)==null||h.reset(),(g=this.conversations)==null||g.reset(),(_=this.logs)==null||_.reset(),(v=this.metrics)==null||v.reset(),(y=this.persistence)==null||y.set_property(U,W),(b=this.sessionManager)==null||b.resetSessionId(),this.yl=null,this.config.cookieless_mode===oi)this.register_once({distinct_id:$r,$device_id:null},``);else{var E=this.config.get_device_id(Oi());this.register_once({distinct_id:E,$device_id:e?E:o},``),e||N(s)||this.register({[ir]:s})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID===void 0||this.ol()||((T=this.persistence)==null||T.set_property(U,n.isIdentifiedID?G:W),this.register({distinct_id:n.distinctID})),(C=this.featureFlags)==null||C.initialize(),!(N(a)||(w=this.sessionManager)!=null&&w.setBootstrapSessionId(a,!0)))){var D=x({},n);delete D.sessionID,this.config.bootstrap=D}delete this.config.identity_distinct_id,delete this.config.identity_hash,d=!0}finally{var O;u&&((O=this.persistence)==null||O.Sa==null||O.Sa(d))}this.reloadFeatureFlags()}shutdown(e){var t=this;return b((function*(){var e,n,r,i,a;if(t.__loaded){t.Pl().dispose(),(e=t.sessionRecording)==null||e.dispose(),(n=t.logs)==null||n.flushLogs(`sendBeacon`),(r=t.metrics)==null||r.flush(`sendBeacon`),(i=t.kl)==null||i.unload(),(a=t.xl)==null||a.unload();try{var o;(o=t.featureFlags)==null||o.destroy()}catch(e){B.error(`Error while destroying feature flags`,e)}}else B.uninitializedWarning(`posthog.shutdown`)}))()}setIdentity(e,t){var n;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(n=this.conversations)==null||n.Ql()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Jl(
2)}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionStartTimestamp,r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t.sessionId);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(nr)?(B.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.Wl(`posthog.alias`)?(N(t)&&(t=this.get_distinct_id()),e===t?(B.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.Vl(ar,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=x({},this.config);if(M(e)){var n,r,i,a,o,s,c,l,u,d,f,p;q(this.config,Cc(e));var m=this.ul();(n=this.persistence)==null||n.update_config(this.config,t,m),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Co(x({},this.config,{persistence:`sessionStorage`}),m,!1);var h,g=this.bl(this.config.debug);R(g)&&(this.config.debug=g),R(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,X.Xr()&&X.ei(`ph_debug`,!0),B.info(`set_config`,{config:e,oldConfig:t,newConfig:x({},this.config)})):(v.DEBUG=!1,X.Xr()&&X.ri(`ph_debug`))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.Ua()),(i=this.exceptionObserver)==null||i.onConfigChange(),(a=this.exceptions)==null||a.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(s=this.tracingHeaders)==null||s.startIfEnabledOrStop(),(c=this.autocapture)==null||c.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(`capture_pageview`in e||`disable_capture_url_hashes`in e)&&((h=this.historyAutocapture)==null||h.startIfEnabledOrStop()),(u=this.exceptionObserver)==null||u.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(f=this.surveys)==null||f.loadIfEnabled(),this.hl(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){v.LIB_NAME=e,v.LIB_VERSION=t}startSessionRecording(e){var t,n,r,i,a,o=!0===e,s={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(s).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),s.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),s.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger(`url`)),s.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger(`event`))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(x({},r,t))}}addExceptionStep(e,t){var n;(n=this.exceptions)==null||n.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){return this.logs?.logger??e.Kl}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t;return(t=this.toolbar?.loadToolbar(e))!=null&&t}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??vc;return e!==vc&&(e=vc+`.`+e),e}_isIdentified(){return this.persistence?.get_property(U)===G||this.sessionPersistence?.get_property(U)===G}Ul(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===si&&!this._isIdentified()&&ve(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[ar])&&((t=this.persistence)==null||(t=t.props)==null||!t[Qr]))}ql(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&!!this.config.capture_pageview}createPersonProfile(){this.Ul()||this.Wl(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wl(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}Wl(e){return this.config.person_profiles===`never`?(B.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.Vl(Qr,!0),!0)}ul(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ai)}hl(){var e,t,n,r=this.ul();return this.is_capturing()||(e=this.logs)==null||e.Yl(),this.persistence?.ga!==r&&((t=this.persistence)==null||t.set_disabled(r)),this.sessionPersistence?.ga!==r&&((n=this.sessionPersistence)==null||n.set_disabled(r)),r&&(this.vl.clear(),this.zl()),r}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==oi){if(this.ol()){var r,i;this.Zl(!0,!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewM
2anager)==null||i.destroy(),this.sessionManager=new zs(this),this.pageViewManager=new Wa(this),this.persistence&&(this.sessionPropsManager=new Fs(this,this.sessionManager,this.persistence));var a,o=this.config.__extensionClasses?.sessionRecording??e.__defaultExtensionClasses?.sessionRecording;o&&(this.sessionRecording=this.al(this.sessionRecording,new o(this)),this.el&&((a=this.sessionRecording)==null||a.onRemoteConfig==null||a.onRemoteConfig(this.el)))}var s;this.consent.optInOut(!0),this.hl(),this.Dl(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==ai&&((s=this.surveys)==null||s.loadIfEnabled()),(N(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture(t?.captureEventName??`$opt_in`,t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$l()}else B.warn(pc)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===oi?B.warn(pc):(this.config.cookieless_mode===ai&&this.consent.isOptedIn()&&this.Zl(!0,!0),this.consent.optInOut(!1),this.hl(),this.config.cookieless_mode===ai&&(this.register({distinct_id:$r,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.$l(),this.Dl()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?`granted`:e===0?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===oi||(this.config.cookieless_mode===ai?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hl()}_is_bot(){return s?Bs(s,this.config.custom_blocked_useragents):void 0}$l(){c&&(c.visibilityState===`visible`?this.pl||(this.pl=!0,this.capture(ui,{title:c.title},{send_instantly:!0}),this.gl&&=(c.removeEventListener(ci,this.gl),null)):this.gl||(this.gl=this.$l.bind(this),J(c,ci,this.gl)))}debug(e){!1===e?(a?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(a?.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}))}Ua(){var e=this._l||{};return`advanced_disable_flags`in e?!!e.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(B.warn(`Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version.`),!0):function(e,t,n,r,i){var a=t in e&&!I(e[t]),o=n in e&&!I(e[n]);return a?e[t]:!!o&&(i&&i.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n])}(e,`advanced_disable_flags`,`advanced_disable_decide`,0,B):!!this.config.advanced_disable_flags}Jn(e){if(I(this.config.before_send))return e;var t=Object.keys(e.properties??{}).filter(Ce),n=A(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n)try{if(r=i(r),I(r)){var a=`Event '`+e.event+`' was rejected in beforeSend function`;return Se(e.event)?B.warn(a+`. This can cause unexpected behavior.`):B.info(a),null}r.properties&&!ve(r.properties)||B.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}catch(t){return B.error(`Error in beforeSend function for event '`+e.event+`':`,t),null}for(var o of t)if(r.properties&&I(r.properties[o]))return B.warn(`Event '`+e.event+`' had its '`+o+`' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){return this.pageViewManager.Ks?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}bl(e){var t=R(e)&&!e,n=X.Xr()&&X.ti(`ph_debug`)===`true`;return!t&&(!!n||e)}};Tc.__defaultExtensionClasses={},Tc.Kl=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=_i(e.prototype[t[n]])}(Tc,[`identify`]);var Ec=class{constructor(e){this.disabled=!1===e;var t=M(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>n-r.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}},Dc=`$copy_autocapture`,Oc=V(`[AutoCapture]`);function kc(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Ac(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!$i(t));return t}function jc(e,t){var n,r=t.e,i=t.maskAllElementAttributes,o=t.maskAllText,s=t.elementAttributeIgnoreList,c=t.elementsC
2hainAsString,l=t.disableCaptureUrlHashes;if(!$i(e))return{props:{}};for(var u=[e],d=new Set([e]),f=e;f.parentNode&&!ea(f,`body`)&&ra>u.length;)if(na(f.parentNode)){var p=f.parentNode.host;if(d.has(p))break;d.add(p),u.push(p),f=p}else{if(!$i(f.parentNode)||d.has(f.parentNode))break;d.add(f.parentNode),u.push(f.parentNode),f=f.parentNode}var m,h,g=[],_={},v=!1,y=!1;if(K(u,(e=>{var t=Sa(e);if(ea(e,`a`)){var n=e.getAttribute(`href`);v=!!(t&&n&&ja(n))&&(l?Bt(n):n)}k(oa(e),`ph-no-capture`)&&(y=!0),g.push(function(e,t,n,r,i){i===void 0&&(i=!1);var a=e.tagName.toLowerCase(),o={tag_name:a};ua.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?kc(1024,Ma(e)):kc(1024,ca(e)));var s=oa(e);s.length>0&&(o.classes=s.filter((function(e){return e!==``}))),K(e.attributes,(function(n){var a;if((!Ca(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&ja(n.value)&&(!P(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){var s=n.value;n.name===`class`&&(s=ia(s).join(` `)),o[`attr__`+n.name]=kc(1024,n.name===`href`&&i?Bt(s):s)}}));for(var c=1,l=1,u=e;u=Ac(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,i,o,s,l)),q(_,function(e){if(!Sa(e))return{};var t={};return K(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&ja(r)&&(t[n]=r)}})),t}(e))})),y)return{props:{},explicitNoCapture:y};if(o||(g[0].$el_text=ea(e,`a`)||ea(e,`button`)?Ma(e):ca(e)),v){var b;g[0].attr__href=v;var S=Xa(v)?.host,C=a==null||(b=a.location)==null?void 0:b.host;S&&C&&S!==C&&(m=v)}return{props:q({$event_type:r.type,$ce_version:1},c?{}:{$elements:g},{$elements_chain:(h=g,function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=x({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return hi(r).sort(((e,t)=>{return(r=t[0])>(n=e[0])?-1:+(n>r);var n,r})).forEach((e=>{var t=e[1];return i[Pa(e[0].toString())]=Pa(t.toString())})),(t+=`:`)+hi(i).map((e=>e[0]+`="`+e[1]+`"`)).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:Fa(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return hi(e).filter((e=>e[0].indexOf(`attr__`)===0)).forEach((e=>t.attributes[e[0]]=e[1])),t}))}(h)))},(n=g[0])!=null&&n.$el_text?{$el_text:g[0]?.$el_text}:{},m&&r.type===`click`?{$external_click_url:m}:{},_)}}var Mc=class{constructor(e){this.name=`autocapture`,this.Ts=!1,this.Ms=null,this.Es=!1,this.Is=!1,this.vn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Rs=!1,this.Ps=e,this.Ps.refresh(this.vn),this.rageclicks=new Ec(this.vn.rageclick),this.As=null}setup(e){this.Fs(),this.Os=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Rs?t.dispose():(this.Ls=t,this.startIfEnabled())}dispose(){var e;this.Rs||(this.Rs=!0,this.Os=void 0,(e=this.Ls)==null||e.dispose(),this.Ls=void 0,this.Ds())}$s(){return this.Ps.refresh(this.vn),this.vn}Fs(){return this.$s(),this.vn.url_allowlist=this.vn.url_allowlist?.map((e=>new RegExp(e))),this.vn.url_ignorelist=this.vn.url_ignorelist?.map((e=>new RegExp(e))),this.vn}Ns(){if(this.isBrowserSupported()){if(a&&c){var e=this.qs=e=>{e||=a?.event;try{this.js(e)}catch(e){Oc.error(`Failed to capture event`,e)}};if(J(c,`submit`,e,{capture:!0}),J(c,`change`,e,{capture:!0}),J(c,`click`,e,{capture:!0}),this.$s().capture_copied_text){var t=this.Bs=e=>{e||=a?.event;try{this.js(e,Dc)}catch(e){Oc.error(`Failed to capture clipboard event`,e)}};J(c,`copy`,t,{capture:!0}),J(c,`cut`,t,{capture:!0}),J(c,`paste`,t,{capture:!0})}}}else Oc.info(`Disabling Automatic Event Collection because this browser is not supported`)}Ds(){this.qs&&=(c?.removeEventListener(`submit`,this.qs,!0),c?.removeEventListener(`change`,this.qs,!0),c?.removeEventListener(`click`,this.qs,!0),void 0),this.Bs&&=(c?.removeEventListener(`copy`,this.Bs,!0),c?.removeEventListener(`cut`,this.Bs,!0),c?.removeEventListener(`paste`,this.Bs,!0),void 0),this.Ts=!1}startIfEnabled(){!this.Rs&&this.Os&&this.isEnabled&&!this.Ts&&(this.Ns(),this.Ts=!0)}onRemoteConfig(e){if(!this.Rs){if(this.Es=!0,e.ok){var t=e.config;
2t.elementsChainAsString&&(this.Is=t.elementsChainAsString);var n,r=t.autocapture_opt_out;R(r)&&((n=this.Os)==null||n.kv.set(sr,r),this.Ms=r),this.startIfEnabled()}else this.startIfEnabled()}}setElementSelectors(e){this.As=e}getElementSelectors(e){var t,n=[];return(t=this.As)==null||t.forEach((t=>{(c?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){if(this.Rs)return!1;var e=this.Os?.kv.get(sr),t=this.Ms,n=this.$s(),r=n.remoteRequestsDisabled&&!this.Es;if(F(t)&&!R(e)&&!r)return!1;var i=this.Ms??!!e;return!!n.enabled&&!i}js(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n=la(e);ta(n)&&(n=n.parentNode||null);var r,i=this.Fs();t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&i.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&ya(n,i.rageclick)&&this.js(e,`$rageclick`);var o=t===Dc,s=o?x({},i,{dom_event_allowlist:void 0}):i;if(n&&function(e,t,n,r,i,o){if(!a||ba(e)||n!=null&&n.url_allowlist&&!aa(n.url_allowlist,o)||n!=null&&n.url_ignorelist&&aa(n.url_ignorelist,o))return!1;if(n!=null&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some((e=>t.type===e)))return!1}var c=xa(e,r),l=c.parentIsUsefulElement,u=c.targetElementList;if(!function(e,t){var n=t?.element_allowlist;if(N(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(u,n)||!da(u,n?.css_selector_allowlist)||da(u,n?.css_selector_ignorelist??pa))return!1;try{var d=a.getComputedStyle(e);if(d&&d.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0}catch{}var f=e.tagName.toLowerCase();switch(f){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return l?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(ua.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}(n,e,s,o,o?[`copy`,`cut`,`paste`]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var c,l=jc(n,{e,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.Is,disableCaptureUrlHashes:i.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var d=this.getElementSelectors(n);if(d&&d.length>0&&(u.$element_selectors=d),t===Dc){var f=e.type||`clipboard`;if(f!==`paste`){var p,m=a==null||(p=a.getSelection())==null?void 0:p.toString(),h=sa(m);if(!h)return!1;u.$selected_content=h,u.$clipboard_text_length=m?.length??0}u.$copy_type=f}return(c=this.Os)==null||c.capture(t,u).catch((e=>Oc.error(`Failed to capture event`,e))),!0}}}isBrowserSupported(){return j(c?.querySelectorAll)}},Nc=class{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,n=M(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.Ua(),e.url_allowlist=n?.url_allowlist,e.url_ignorelist=n?.url_ignorelist,e.dom_event_allowlist=n?.dom_event_allowlist,e.element_allowlist=n?.element_allowlist,e.css_selector_allowlist=n?.css_selector_allowlist,e.css_selector_ignorelist=n?.css_selector_ignorelist,e.element_attribute_ignorelist=n?.element_attribute_ignorelist,e.capture_copied_text=n?.capture_copied_text}},Pc=V(`[ExceptionAutocapture]`),Fc=()=>{},Ic=e=>{if(j(e))return e.__posthog_layer__??e.__rrweb_layer__};function Lc(e,t,n){try{if(!(t in e))return Fc;
2var r={next:e[t]},i=n((function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return r.next.apply(this,t)}));return j(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),e[t]=i,()=>{if(e[t]!==i)for(var n=e[t],a=Ic(n);a;){if(a.next===i)return void(a.next=r.next);a=Ic(n=a.next)}else e[t]=r.next}}catch{return Fc}}var Rc=V(`[TracingHeaders]`),zc=V(`[Web Vitals]`),Bc=9e5,Vc=[`CLS`,`FCP`,`INP`,`LCP`],Hc=[`INP`,`LCP`],Uc=[`interactionTarget`,`interactionType`,`inputDelay`,`processingDuration`,`presentationDelay`,`loadState`,`target`,`url`,`timeToFirstByte`,`resourceLoadDelay`,`resourceLoadDuration`,`elementRenderDelay`,`largestShiftTarget`,`largestShiftTime`,`largestShiftValue`,`firstByteToFCP`],Wc=`disabled`,Gc=`lazy_loading`,Kc=`awaiting_config`,qc=`missing_config`;V(`[SessionRecording]`),V(`[SessionRecording]`);var Jc=`[SessionRecording]`,Yc=V(Jc),Xc=V(`[Heatmaps]`);function Zc(e){return M(e)&&`clientX`in e&&`clientY`in e&&L(e.clientX)&&L(e.clientY)}var Qc=V(`[Product Tours]`),$c=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(mr))},el=[`$set_once`,`$set`],tl=V(`[SiteApps]`),nl=`Error while initializing PostHog app with config id `,rl=(e,t)=>e!=null&&e.then?e.then(t):t(e),il=`SDK is not enabled or survey functionality is not yet loaded`,al=`Disabled. Not loading surveys.`,ol=class{constructor(e,t){this.name=`surveys`,this._surveyEventReceiver=null,this._surveyManager=null,this.Xl=!1,this.tu=[],this.eu=null,this.iu=null,this.Rs=!1,this.ru=new Set,this.onRemoteConfig=e=>{if(!this.Rs&&!this.vn.disableSurveys){if(!e.ok)return $.warn(`Remote config unavailable. Not loading surveys.`);var t=e.config.surveys;if(I(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.nu=R(t)?t:t.length>0,$.info(`flags response received, isSurveysEnabled: `+this.nu),this.loadIfEnabled()}},this.Ps=e,this.su=t}setup(e){if(!this.Rs)return this.au=e,rl(e.kv.initialize(),(()=>{if(this.au===e&&!this.Rs){this.au=void 0,this.Os=e;var t=e.onRemoteConfig(this.onRemoteConfig);this.Rs?t.dispose():(this.Ls=t,this.loadIfEnabled())}}))}dispose(){var e,t,n;this.Rs||(this.Rs=!0,this.au=void 0,this.Os=void 0,(e=this.Ls)==null||e.dispose(),this.Ls=void 0,(t=this._surveyEventReceiver)==null||t.dispose(),this._surveyEventReceiver=null,(n=this._surveyManager)==null||n.dispose==null||n.dispose(),this._surveyManager=null,this.tu=[],this.eu=null,this.ru.forEach((e=>clearTimeout(e))),this.ru.clear())}get vn(){return this.Ps.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)==null||e.reset(),localStorage.removeItem(`lastSeenSurveyDate`);for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith($s)||r!=null&&r.startsWith(`inProgressSurvey_`))&&t.push(r)}t.forEach((e=>localStorage.removeItem(e)))}catch{}}loadIfEnabled(){if(!this.Rs&&this.Os){var e=this.vn;if(!this._surveyManager){if(this.Xl)$.info(`Already initializing surveys, skipping...`);else if(e.disableSurveys)$.info(al);else if(e.cookielessMode&&this.Ps.isOptedOut())$.info(`Not loading surveys in cookieless mode without consent.`);else{var t=this.Ps.getExtensions();if(t){if(!N(this.nu)||e.advancedEnableSurveys){var n=this.nu||e.advancedEnableSurveys;this.Xl=!0;try{var r=t.generateSurveys;if(r)return this.ou(r,n),void(this.Xl=!1);var i=t.loadExternalDependency;if(!i)return this.lu(ii),void(this.Xl=!1);i((e=>{try{if(this.Rs)return;var t=this.Ps.getExtensions();e||t==null||!t.generateSurveys?this.lu(`Could not load surveys script`,e):this.ou(t.generateSurveys,n)}finally{this.Xl=!1}}))}catch(e){throw this.Xl=!1,this.lu(`Error initializing surveys`,e),e}}}else $.error(`PostHog Extensions not found.`)}}}}ou(e,t){this.Rs||(this._surveyManager=e(t),this._surveyEventReceiver=this.Ps.createEventReceiver(),$.info(`Surveys loaded successfully`),this.uu({isLoaded:!0}))}lu(e,t){$.error(e,t),this.uu({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.tu.push(e),this._surveyManager&&this.uu({isLoaded:!0}),()=>{this.tu=this.tu.filter((t=>t!==e))}}getSurveys(e,t){t===void 0&&(t=!1);var n=this.Os??this.su;if(n&&!this.Rs){if(this.vn.disableSurveys)return $.info(al),e([]);var r=n.kv.get(Lr);if(r&&!t)return e(r,{isLoaded:!0}
2),void(this.hu()&&this.getSurveys((()=>{}),!0));if(this.eu)this.eu.then((t=>{this.Rs||e(t.surveys,t.context)})).catch((e=>$.error(`Error in survey callback`,e)));else{var i=this.du(`/api/surveys/`,{method:`GET`,query:{token:n.projectToken},sentAt:`query`,timeoutMs:this.vn.requestTimeoutMs}).then((e=>{try{return this.vu(n,e)}catch(e){return $.error(`Error processing surveys response`,e),this.vu(n,{statusCode:0,error:e})}}),(e=>this.vu(n,{statusCode:0,error:e})));this.eu=i;var a=()=>{this.eu===i&&(this.eu=null)};i.then((t=>{a(),this.Rs||e(t.surveys,t.context)}),a).catch((e=>$.error(`Error in survey callback`,e)))}}}du(e,t){var n=this.Os;return n?n.sendRequest(e,t):new Promise((e=>e({statusCode:0,error:Error(il)})))}vu(e,t){if(this.Rs)return{surveys:[],context:{isLoaded:!1,error:il}};var n=t.statusCode;if(n!==200||!t.json){var r=`Surveys API could not be loaded, status: `+n;return n===0?t.error||$.warn(r):$.error(r),this.iu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.iu=null;var i,a=t.json.surveys||[],o=a.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(Hs(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));return o.length>0&&((i=this._surveyEventReceiver)==null||i.register(o)),e.kv.set({[Lr]:a,[Rr]:Date.now()}),{surveys:a,context:{isLoaded:!0}}}hu(){return this.cu()&&!this.eu&&!this.fu()}cu(){var e=(this.Os??this.su)?.kv.get(Rr);return L(e)&&Date.now()-e>3e5}fu(){return L(this.iu)&&3e5>Date.now()-this.iu}markSurveyAsSeen(e,t){ec({id:e,current_iteration:t?.iteration??null});try{localStorage.setItem(`lastSeenSurveyDate`,new Date().toISOString())}catch{}}uu(e){for(var t of this.tu)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){$.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!I(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);$.warn(`init was not called`)}pu(e){var t=null;return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}gu(e){if(I(this._surveyManager))return{eligible:!1,reason:il};var t=typeof e==`string`?this.pu(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}mu(e){if(I(this._surveyManager))return{eligible:!1,reason:il};var t=typeof e==`string`?this.pu(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(I(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:il};var t=this.mu(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return I(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:il})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.mu(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(I(this._surveyManager))$.warn(`init was not called`);else{var i=typeof e==`string`?this.pu(e):e;if(i!=null&&i.id){if(tc.includes(i.type)){var a=c?.querySelector(t);if(a){if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds){$.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`);var o=setTimeout((()=>{var e;this.ru.delete(o),this.Rs||($.info(`Rendering survey `+i.id+` with delay of `+i.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(i,a,n),$.info(`Survey `+i.id+` rendered`))}),1e3*i.appearance.surveyPopupDelaySeconds);this.ru.add(o)}else this._surveyManager.renderSurvey(i,a,n)}else $.warn(`Survey element not found`)}else $.warn(`Surveys of type `+i.type+` cannot be rendered in the app`)}else $.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(I(this._surveyManager))$.warn(`init was not called`);else{var r=this.pu(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=x({},r,{appearance:x({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Ao.Popover&&t.initialResponses&&$.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.gu(r);if(!a.eligible)return void $.warn(`Survey is not eligible to be displayed: `,a.reason)}t.displayType===Ao.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else $.warn(`Survey not found`)}}
2cancelPendingSurvey(e){I(this._surveyManager)?$.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}};function sl(e,t,n){if(I(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var cl=class{constructor(e){this.yu=new Set,this.bu=new Set,this._u=new Is,this.wu=(e,t)=>this.ku(e,t)&&this.Su(e,t)&&this.xu(e,t)&&this.Cu(e,t),this.ku=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e}init(){N(this._instance?._addCaptureHook)||(this.Tu=this._instance?._addCaptureHook(((e,t)=>{this.on(e,t)})))}dispose(){var e;(e=this.Tu)==null||e.call(this),this.Tu=void 0,this._u=new Is}register(e){var t;if(!N(this._instance?._addCaptureHook)&&(e.forEach((e=>{var t;this.yu.add(e),(t=e.steps)==null||t.forEach((e=>{this.bu.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n=new Set;this.yu.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&n.add(e.selector)}))})),this._instance.autocapture.setElementSelectors(n)}}replace(e){this.yu.clear(),this.bu.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.bu.has(e)||this.bu.has(t.event))&&this.yu.forEach((e=>{this.Mu(t,e)&&this._u.emit(`actionCaptured`,e.name)}))}Eu(e){this.onAction(`actionCaptured`,(t=>e(t)))}Mu(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.wu(e,n))return!0;return!1}onAction(e,t){return this._u.on(e,t)}Su(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!sl(r,t.url,t.url_matching||`contains`))return!1}return!0}xu(e,t){return!!this.Iu(e,t)&&!!this.Ru(e,t)&&!!this.Pu(e,t)}Iu(e,t){var n;if(t==null||!t.href)return!0;var r=this.Au(e);if(r.length>0)return r.some((e=>sl(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&sl((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Ru(e,t){var n;if(t==null||!t.text)return!0;var r=this.Au(e);if(r.length>0)return r.some((e=>sl(e.text,t.text,t.text_matching||`exact`)||sl(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!I(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>sl(e,a,o))))}Pu(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Au(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Cu(e,t){return t==null||!t.properties||t.properties.length===0||Ks(t.properties.reduce(((e,t)=>{var n=A(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},ll=class{constructor(e){var t;this.Fu=[],this._instance=e,this.Ou=new Map,this.Lu=new Map,this.Du=new Map,this.$u=(t=this._instance)==null||t.onSessionId==null?void 0:t.onSessionId((e=>this.Nu(e)))}qu(e){return!1}ju(){return null}Bu(e){}Hu(){}zu(e,t){return!!e&&Ks(e.propertyFilters,t?.properties)}Uu(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}Wu(e,t,n){var r=(n===Eo.Activation?this.Ou:this.Lu).get(e),i=[];return this.Vu((e=>{i=e.filter((e=>r?.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.zu(a,t)}))}register(e){this.Gu(e,!1)}replace(e){this.Gu(e,!0)}Gu(e,t){N(this._instance?._addCaptureHook)||(this.Zu(e,t),this.Qu(e,t))}Qu(e,t){var n=e.filter((e=>{var t;return(t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length}));if(t&&this.Du.clear(),n.length!==0){this.Ju||(this.Ju=new cl(this._instance),this.Ju.init(
2),this.Ju.Eu((e=>this.onAction(e))));var r=[];n.forEach((e=>{var t;(t=e.conditions)==null||(t=t.actions)==null||t.values.forEach((t=>{if(r.push(t),t.name){var n=this.Du.get(t.name)??[];n.includes(e.id)||n.push(e.id),this.Du.set(t.name,n)}}))})),t?this.Ju.replace(r):this.Ju.register(r)}else{var i;t&&((i=this.Ju)==null||i.replace([]))}}Ku(e,t){t.forEach(((t,n)=>{var r=e.get(n)??[];t.forEach((e=>{r.includes(e)||r.push(e)})),e.set(n,r)}))}Zu(e,t){var n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0})),i=this.Uu(e,Eo.Activation),a=this.Uu(e,Eo.Cancellation);t?(this.Ou=i,this.Lu=a):(this.Ku(this.Ou,i),this.Ku(this.Lu,a)),(n.length!==0||r.length!==0)&&(this.Tu??=this._instance?._addCaptureHook(((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var n,r,i=this.Yu(),a=(t==null||(n=t.properties)==null?void 0:n.$survey_id)||(t==null||(r=t.properties)==null?void 0:r.$product_tour_id);if(a&&this.getActivatedIds().includes(a)){var o=this.Xu(e,a);if(o===`consume`)return i.info(`event consumed activated item, removing it`,{event:e,itemId:a}),void this.th([a]);if(o===`persist`)return i.info(`shown item promoted to persisted activation`,{event:e,itemId:a}),this.eh(a),void this.ih([a])}if(this.Lu.has(e)){var s=this.Wu(e,t,Eo.Cancellation);s.length>0&&(i.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:s.map((e=>e.id))}),this.th(s.map((e=>e.id))),s.forEach((e=>this.rh(e.id))))}if(this.Ou.has(e)){i.info(`event name matched`,{event:e,eventPayload:t,items:this.Ou.get(e)});var c=this.Wu(e,t,Eo.Activation);this.nh(c.map((e=>e.id)))}}onAction(e){this.Du.has(e)&&this.nh(this.Du.get(e)||[])}nh(e){var t;if(e.length!==0){var n=!((t=this._instance)==null||t.get_session_id==null||!t.get_session_id()),r=[];for(var i of e)n&&this.qu(i)?this.eh(i)&&this.sh(i):r.push(i);r.length>0&&(this.Fu=[...new Set([...this.Fu,...r])]),this.Yu().info(`updating activated items`,{activatedItems:this.getActivatedIds()})}}eh(e){this.Fu=this.Fu.filter((t=>t!==e));var t=this.ah();return!t.includes(e)&&(this.oh([...t,e]),this.lh(),!0)}th(e){var t=new Set(e);this.Fu=this.Fu.filter((e=>!t.has(e)));var n=this.uh(),r=n.filter((e=>!t.has(e)));r.length!==n.length&&(this.oh(r),r.length===0&&this.hh()),this.ih(e)}dh(){var e,t=this.ju();if(!t)return{};var n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n&&typeof n==`object`?n:{}}sh(e){if(this.ju()){var t=this.dh();this.Bu(x({},t,{[e]:Date.now()}))}}ih(e){if(this.ju()){var t=this.dh(),n={},r=!1;for(var i of Object.entries(t)){var a=i[0],o=i[1];e.includes(a)?r=!0:n[a]=o}r&&(ve(n)?this.Hu():this.Bu(n))}}fh(){this.ju()&&this.Hu()}getActivationTimestamp(e){if(this.ah().includes(e)){var t=this.dh()[e];return L(t)?t:void 0}}uh(){var e,t=this.ph();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}ah(){var e,t,n=this.uh();if(n.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.gh()],i=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return i&&r===i?n:[]}lh(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.mh(t)}hh(){this.yh()}Nu(e){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.gh()];if(n&&n!==e){var r=this.uh(),i=this.dh();r.length>0&&(this.oh([]),r.filter((e=>L(i[e]))).forEach((e=>this.rh(e)))),this.hh(),this.fh()}}getActivatedIds(){return[...new Set([...this.ah(),...this.Fu])].filter((e=>!this.bh(e)))}dispose(){var e,t,n;(e=this.$u)==null||e.call(this),this.$u=void 0,(t=this.Tu)==null||t.call(this),this.Tu=void 0,(n=this.Ju)==null||n.dispose(),this.Ju=void 0}reset(){this.Fu=[],this.uh().length>0&&this.oh([]),this.hh(),this.fh()}getEventToItemsMap(){return this.Ou}_h(){return this.Ju}},ul=class extends ll{constructor(e){super(e)}ph(){return zr}gh(){return Br}ju(){return Vr}Bu(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Vr]:e})}Hu(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Vr)}qu(e){var t,n;this.Vu((t=>{n=t.find((t=>t.id===e))}));var r=(t=n)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return L(r)&&r>0}wh(){return Oo.SHOWN}Vu(e){var t;(t=this._instance)==null||t.getSurveys(e)}rh(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Yu(){return $}oh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[zr]:e})}mh(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Br]:e})}yh(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Br)}bh(){return!1}Xu(e,t){var n;return this.Vu((e=>{n=e.find((e=>e.id===t))})),!n||function(e){var t;return Hs(e)&&!((t=e.conditions)==null||(t=t.events)==null||!t.repeatedActivation)||e.schedule===`always`}(n)?e===Oo.SHOWN?`consume`:`ignore`:e===Oo.SHOWN?`persist`:e===Oo.DISMISSED||e===Oo.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}
2getEventToSurveys(){return this.getEventToItemsMap()}},dl=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e==`string`)return this._instance.get_property(e);var t={};for(var n of e){var r=this._instance.get_property(n);N(r)||(t[n]=r)}return t}set(e,t){this._instance.register(typeof e==`string`?{[e]:t}:e)}remove(e){typeof e==`string`?this._instance.unregister(e):e.forEach((e=>this._instance.unregister(e)))}},fl=class{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=_?.__PosthogExtensions__;if(e){var t=e.generateSurveys,n=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:n?e=>n(this._instance,`surveys`,e):void 0}}}createEventReceiver(){return new ul(this._instance)}},pl=a!=null&&a.location?$a(a.location.hash,`__posthog`)||$a(location.hash,`state`):null,ml=`_postHogToolbarParams`,hl=V(`[Toolbar]`),gl=V(`[FeatureFlags]`),_l=class{constructor(e,t){t===void 0&&(t=!1),this.kh=!1,this.update(e,t)}update(e,t){this.Sh=((e,t)=>({bootstrap:{featureFlags:e.bootstrap?.featureFlags,featureFlagPayloads:e.bootstrap?.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,refreshIntervalMs:e.remote_config_refresh_interval_ms??3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:`best-available`,evaluationContexts:e.evaluation_contexts??e.evaluation_environments??[],flagKeys:A(e.flag_keys)?e.flag_keys:void 0}))(e,t),!e.evaluation_environments||e.evaluation_contexts||this.kh||(gl.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.kh=!0),N(e.flag_keys)||A(e.flag_keys)||gl.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.Sh}},vl=V(`[FeatureFlags]`),yl=V(`[FeatureFlags]`,{debugEnabled:!0}),bl=`" failed. Feature flags didn't load in time.`,xl=`connection_error`,Sl=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},Cl=e=>{var t={};for(var n of hi(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},wl=V(`[Error tracking]`),Tl=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`],El=[`__firefox__`,`__gCrWeb`],Dl=`Refusing to render web experiment since the viewer is a likely bot`,Ol={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Us(t,e),not_regex:(e,t)=>!Us(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},kl=class e{get vn(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.xh(`retrieved web experiments from the server`),n.Ch=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.Ch&&(e.xh(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.Ch)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);P(i)&&t.variants[i]&&n.Th(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.Mh(o,n._instance)&&n.Th(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())e.xh(Dl);else if(!this.vn.disable_web_experiments){if(I(this.Ch))return this.Ch=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.xh(`applying feature flags`,t),t.forEach((e=>{var t;if(this.Ch&&(t=this.Ch)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.Ch?.get(e);n&&r!=null&&r.variants[n]&&this.Th(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=Za(t?.search,`__experiment_id`),r=Za(t?.search,`__experiment_variant`);n&&r&&(e.xh(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.Eh(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this.vn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}
2getWebExperiments(e,t,n){if(this.vn.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this.vn.token),method:`GET`,timestampMode:`query`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}Eh(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.xh(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.Th(i[0].name,n,i[0].variants[n].transforms))}static Mh(t,n){return!I(t.conditions)&&e.Ih(t,n)&&e.Rh(t)}static Ih(t,n){if(I(t.conditions)||I(t.conditions?.url))return!0;var r=e.getWindowLocation();if(r){var i,a=qi(n,r.href);return(i=t.conditions)==null||!i.url||Ol[t.conditions?.urlMatchType??`icontains`](t.conditions.url,a)}return!1}static getWindowLocation(){return a?.location}static Rh(e){if(I(e.conditions)||I(e.conditions?.utm))return!0;var t=so();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static xh(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];B.info(`[WebExperiments] `+e,n)}Th(t,n,r){this._is_bot()?e.xh(Dl):n===`control`?e.xh(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(e.xh(`applying transform of variant `+n+` for experiment `+t+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return s&&this._instance?Bs(s,this.vn.custom_blocked_useragents):void 0}},Al=V(`[Conversations]`),jl=`Conversations not available yet.`;function Ml(e,t){var n=e?.flushIntervalMs??3e3,r=e?.maxBufferSize??100,i=t!=null&&t.consoleCapture?void 0:e?.maxLogsPerInterval??1e3,a=N(i)?Math.max(r,2048):Math.max(r,i),o=e?.resourceAttributes;return{serviceName:o?.[`service.name`]??e?.serviceName??t?.serviceNameDefault,serviceVersion:o?.[`service.version`]??e?.serviceVersion,environment:o?.[`deployment.environment`]??e?.environment,resourceAttributes:o,beforeSend:e?.beforeSend,flushIntervalMs:n,maxBufferSize:r,maxQueueSize:a,maxBatchRecordsPerPost:100,rateCapWindowMs:n,maxLogsPerInterval:i,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Nl=[`debug`,`log`,`warn`,`error`,`info`],Pl=`console`,Fl=`__posthogHandledLogsRequestError`,Il=(e,t)=>{var n=e instanceof Error?e:Error(t);return n[Fl]=!0,n},Ll=e=>!!e&&typeof e==`object`&&!0===e[Fl],Rl={featureFlags:class{constructor(e){this.name=`featureFlags`,this.Ph=!1,this.featureFlagEventHandlers=[],this.I=vl,this.Ah={},this.Fh={},this.Oh=[],this.Lh=!1,this.Dh=!1,this.$h=0,this.Nh=!1,this.qh=!1,this.jh=!1,this.Bh=!1,this.Hh=0,this.Ht=()=>{var e=this.zh();this.Hh=0,e&&this.reloadFeatureFlags()},this.Uh=()=>{var e=this.Wh;N(e)||this.vn.remoteRequestsDisabled||!c||c.visibilityState===`hidden`||Date.now()-(this.Vh??0)<e||(this.reloadFeatureFlags(),this.Gh())},this.$t=()=>{c?.visibilityState===`visible`&&this.Uh()},`get`in e?this.Ps=e:(this.Zh=new _l(e.config,e.Ua()),this.Ps=this.Zh)}updateConfig(e,t){var n;(n=this.Zh)==null||n.update(e,t),this.Os&&this.Qh()}setup(e){return this.au=e,this.I=e.logger.createLogger(`[FeatureFlags]`),rl(e.kv.initialize(),(()=>{this.au===e&&(this.au=void 0,this.Os=e,this.Jh(e))}))}Jh(e){if(this.Os===e)return a&&J(a,`online`,this.Ht),this.Qh(),this.Kh=e.registerDynamicEventProperties((()=>this.Yh()?this.Ah:this.Fh)),this.Xh(),this.initialize()}Qh(){var e=this.vn.refreshIntervalMs,t=!this.vn.remoteRequestsDisabled&&c&&!N(e)&&e>0?e:void 0;t!==this.Wh&&(this.td(),N(t)||(this.Wh=t,this.Gh(),c!=null&&c.addEventListener&&J(c,ci,this.$t)))}Gh(){N(this.Wh)||(N(this.ed)||clearInterval(this.ed),this.Vh=Date.now(),this.ed=setInterval(this.Uh,this.Wh))}td(){N(this.ed)||(clearInterval(this.ed),this.ed=void 0,c==null||c.removeEventListener==null||c.removeEventListener(ci,this.$t)),this.Wh=void 0,this.Vh=void 0}destroy(){this.rd()}dispose(){this.rd()}rd(){var e;this.td(),this.$h++,this.qh=!1,this.au=void 0,this.Os&&=(this.nd(),(e=this.Kh)==null||e.dispose(),this.Kh=void 0,this.Oh=[],a?.removeEventListener(`online`,this.Ht),void 0)}get vn(){return this.Ps.get()}sd(e){return this.Os?.kv.get(e)}ei(e){this.ad((()=>this.Os?.kv.set(e)))}ri(e){this.ad((()=>this.Os?.kv.remove(e)))}ad(e){try{e()}catch(e){this.I.error(`Failed to update feature flag persistence`,e)}}Xh(){var e={};for(var t of[Er,kr,Ar,Mr]){var n=this.sd(t);N(n)||(e[t]=n)}this.Ah=e;var r=x({},e),i=this.sd(Tr);
2if(i)for(var a of Object.entries(i))r[`$feature/`+a[0]]=a[1];this.Fh=r}Yh(){var e=this.vn.cacheTtlMs;if(!e||0>=e)return!1;var t=this.sd(Kr);return typeof t!=`number`||Date.now()-t>e}od(){return!!this.Yh()&&(this.Bh||this.Dh||(this.Bh=!0,this.I.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}ld(){var e=this.vn.evaluationContexts;return e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||this.I.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}ud(){var e=this.vn.flagKeys;if(!N(e))return e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||this.I.error(`Invalid flag key found:`,e,`Expected non-empty string`),t}))}initialize(){var e=this.vn,t=e.bootstrap?.featureFlags??{};if(Object.keys(t).length){var n=e.bootstrap?.featureFlagPayloads??{},r=Object.keys(t).filter((e=>!!t[e])).reduce(((e,n)=>(e[n]=t[n]||!1,e)),{}),i=Object.keys(n).filter((e=>r[e])).reduce(((e,t)=>(e[t]=n[t],e)),{});return this.hd({featureFlags:r,featureFlagPayloads:i})}}updateFlags(e,t,n){var r,i,a=n!=null&&n.merge&&(r=this.sd(Tr))!=null?r:{},o=n!=null&&n.merge&&(i=this.sd(kr))!=null?i:{},s=x({},a,e),c=x({},o,t),l={};for(var u of Object.entries(s)){var d=u[0],f=u[1];l[d]={key:d,enabled:w(f),variant:T(f),reason:void 0,metadata:N(c?.[d])?void 0:{id:0,version:void 0,description:void 0,payload:c[d]}}}this.hd({flags:l})}get hasLoadedFlags(){return this.Lh}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.sd(Or),t=this.sd(Mr),n=this.sd(Nr);if(!n&&!t)return e||{};var r=q({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=N(c)?(a=s?.enabled)!=null&&a:!!c,u=N(c)?s?.variant:typeof c==`string`?c:void 0,d=n?.[i],f=x({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=x({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.Ph||=(this.I.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:w(r),variant:T(r),payload:C(t[n])}}))}getFlagVariants(){var e=this.sd(Tr),t=this.sd(Mr);if(!t)return e||{};for(var n=q({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Ph||=(this.I.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this.sd(kr),t=this.sd(Nr);if(!t)return e||{};for(var n=q({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.Ph||=(this.I.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.Nh||this.vn.featureFlagsDisabled||this.zh()||this.dd||(this.Oh.slice().forEach((e=>{try{e()}catch(e){this.I.error(`Error while running feature flags reloading callback`,e)}})),this.dd=setTimeout((()=>{this.vd()}),5))}nd(){clearTimeout(this.dd),this.dd=void 0}onReloading(e){return this.Oh.push(e),()=>{this.Oh=this.Oh.filter((t=>t!==e))}}ensureFlagsLoaded(){this.Lh||this.Dh||this.dd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Nh=e}resetFlagCallReported(){this.ri(Ur)}vd(e){this.nd();var t=this.Os;if(t&&!this.vn.remoteRequestsDisabled&&!this.zh()){if(this.Dh)this.qh=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:x({},t.initialPersonProperties,this.sd(Pr)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.sd(Fr),timezone:go()};N(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.vn.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.ld();r.length&&(n.evaluation_contexts=r);var i=this.ud();N(i)||(n.flag_keys=i);var a=this.vn.onlyEvaluateSurveyFeatureFlags,o=`/flags/?v=2`+(a?`&only_evaluate_survey_feature_flags=true`:``),s=this.$h;this.Dh=!0;var c=()=>{this.qh&&(this.qh=!1,this.vd())},l=e=>{this.Dh=!1,s===this.$h?(this.ei({[Gr]:[xl]}),this.I.error(`Feature flag request failed`,e),c()):c()};try{t.sendRequest(o,{target:`flags`,method:`POST`,body:n,compression:this.vn.compression,sentAt:`body`,timeoutMs:this.vn.requestTimeoutMs}).then((e=>{var t,r=e.json??{},i=e.statusCode!==200;if(this.Dh=!1,s===this.$h){if(this.fd(e.statusCode),i||this.qh||(this.$anon_distinct_id=void 0),!n.disable_flags||this.qh){this.jh=!i;var o=[];e.error?o.push(e.error instanceof Error&&e.error.name===`AbortError`?`timeout`:e.error instanceof Error?xl:`unknown_error`):e.statusCode!==200&&o.push(`api_error_`+e.statusCode),r.errorsWhileComputingFlags&&o.push(`errors_while_computing_flags`);var l=!((t=r.quotaLimited)==null||!t.includes(`feature_flags`));l&&o.push(`quota_limited`),this.ei({[Gr]:o}),l?this.I.warn(`You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.`):n.disable_flags||this.hd(r,i,{partialResponse:a}),c()}}else c()})).catch(l)}catch(e){l(e)}}}}zh(){return eo(this.Hh,3)}fd(e){this.Hh=to(e,this.Hh,3,(()=>this.I.warn(`Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.`)))}getFeatureFlag(e,t){if(t===void 0&&(t={}),!t.fresh||this.jh){if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}}else this.I.warn(`getFeatureFlag for key "`+e+bl)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.jh){if(this.Lh||this.getFlags()&&this.getFlags().length>0){if(!this.od()){var n,r=this.getFlagVariants(),i=e in r,a=r[e],o=this.getFlagPayloads()[e],s=String(a),c=this.sd(Ar)||void 0,l=this.sd(Kr)||void 0,u=this.sd(Ur)||{};if(this.vn.deduplicateCallsPerSession){var d=this.Os?.session.sessionId,f=this.sd(Wr);d&&d!==f&&(u={},n=d)}if(t.send_event||!(`send_event`in t)){if(e in u&&u[e].includes(s))n&&this.ei({[Ur]:u,[Wr]:n});else{var p,m,h,g,_,v,y,b;A(u[e])?u[e].push(s):u[e]=[s],this.ei(x({[Ur]:u},n?{[Wr]:n}:{}));var S=this.getFeatureFlagDetails(e),w=[...this.sd(Gr)??[]];N(a)&&w.push(`flag_missing`);var T={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o??null,$feature_flag_request_id:c,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((p=this.vn.bootstrap)==null||(p=p.featureFlags)==null?void 0:p[e])??null,$feature_flag_bootstrapped_payload:((m=this.vn.bootstrap)==null||(m=m.featureFlagPayloads)==null?void 0:m[e])??null,$used_bootstrap_value:!this.jh};N(S==null||(h=S.metadata)==null?void 0:h.has_experiment)||(T.$feature_flag_has_experiment=S.metadata.has_experiment),N(S==null||(g=S.metadata)==null?void 0:g.version)||(T.$feature_flag_version=S.metadata.version);var E,D=(S==null||(_=S.reason)==null?void 0:_.description)??(S==null||(v=S.reason)==null?void 0:v.code);D&&(T.$feature_flag_reason=D),S!=null&&(y=S.metadata)!=null&&y.id&&(T.$feature_flag_id=S.metadata.id),N(S?.original_variant)&&N(S?.original_enabled)||(T.$feature_flag_original_response=N(S.original_variant)?S.original_enabled:S.original_variant),S!=null&&(b=S.metadata)!=null&&b.original_payload&&(T.$feature_flag_original_payload=S==null||(E=S.metadata)==null?void 0:E.original_payload),w.length&&(T.$feature_flag_error=w.join(`,`)),this.pd(T)}}else n&&this.ei({[Ur]:u,[Wr]:n});if(i)return{key:e,enabled:!!a,variant:typeof a==`string`?a:void 0,payload:C(o)}}}else this.I.warn(`getFeatureFlagResult for key "`+e+bl)}}pd(e){try{var t;(t=this.Os)==null||t.capture(`$feature_flag_called`,e).catch((e=>{this.I.error(`Failed to capture feature flag call`,e)}))}catch(e){this.I.error(`Failed to capture feature flag call`,e)}}getRemoteConfigPayload(e,t){this.gd(e,t)}gd(e,t){var n=this;return b((function*(){var r=n.Os;if(r){var i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},a=n.ld();a.length&&(i.evaluation_contexts=a);var o,s=n.ud();N(s)||(i.flag_keys=s);try{o=(yield r.sendRequest(`/flags/?v=2`,{target:`flags`,method:`POST`,body:i,compression:n.vn.compression,sentAt:`body`,timeoutMs:n.vn.requestTimeoutMs})).json?.featureFlagPayloads?.[e]||void 0}catch(e){n.I.error(`Remote config feature flag request failed`,e);return}try{t(o)}catch(e){n.I.error(`Remote config feature flag callback failed`,e)}}}))()}isFeatureEnabled(e,t){if(t===void 0&&(t={}),t.fresh&&!this.jh)return t.defaultValue;if(!(this.Lh||this.getFlags()&&this.getFlags().length>
20))return this.I.warn(`isFeatureEnabled for key "`+e+bl),t.defaultValue;var n=this.getFeatureFlag(e,t);return N(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){this.hd(e,t,n)}hd(e,t,n){if(this.Os){this.Lh=!0;var r=function(e,t,n,r,i,a){t===void 0&&(t={}),n===void 0&&(n={}),r===void 0&&(r={}),a===void 0&&(a=vl);var o=((e,t)=>{var n=e.flags;return n?x({},e,{featureFlags:Object.fromEntries(Object.keys(n).map((e=>[e,n[e].variant??n[e].enabled]))),featureFlagPayloads:Object.fromEntries(Object.keys(n).filter((e=>n[e].enabled)).filter((e=>n[e].metadata?.payload)).map((e=>[e,n[e].metadata?.payload])))}):(e.featureFlags&&t.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e)})(e,a),s=o.flags,c=o.featureFlags,l=o.featureFlagPayloads;if(c){var u=e.requestId,d=e.evaluatedAt;if(A(c)){a.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var f={};if(c)for(var p=0;c.length>p;p++)f[c[p]]=!0;return{[Er]:c,[Tr]:f,[jr]:!1}}var m=c,h=l,g=s;if(i!=null&&i.partialResponse)m=x({},t,m),h=x({},n,h),g=x({},r,g);else if(e.errorsWhileComputingFlags){if(s){var _=new Set(Object.keys(s).filter((e=>{var t;return!((t=s[e])!=null&&t.failed)})));m=x({},t,Object.fromEntries(Object.entries(m).filter((e=>_.has(e[0]))))),h=x({},n,Object.fromEntries(Object.entries(h||{}).filter((e=>_.has(e[0]))))),g=x({},r,Object.fromEntries(Object.entries(g||{}).filter((e=>_.has(e[0])))))}else m=x({},t,m),h=x({},n,h),g=x({},r,g)}return x({[Er]:Object.keys(Cl(m)),[Tr]:m||{},[kr]:h||{},[Or]:g||{},[jr]:!0===e.minimalFlagCalledEvents},u?{[Ar]:u}:{},d?{[Kr]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.I);r&&this.ei(r),t||(this.Bh=!1),this.md(t)}}override(e,t){t===void 0&&(t=!1),this.I.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.yd(e)}yd(e){if(this.Os){if(!1===e)return this.ri([Mr,Nr]),this.md(),void yl.info(`All overrides cleared`);if(A(e))return this.ei({[Mr]:Sl(e)}),this.md(),void yl.info(`Flag overrides set`,{flags:e});if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;this.Ph=!!((t=n.suppressWarning)!=null&&t);var r={},i=n.flags,a=n.payloads;i&&(r[Mr]=A(i)?Sl(i):i),a&&(r[Nr]=a),Object.keys(r).length&&this.ei(r),!1===i&&!1===a?this.ri([Mr,Nr]):!1===i?this.ri(Mr):!1===a&&this.ri(Nr),this.md(),!1===i?yl.info(`Flag overrides cleared`):i&&yl.info(`Flag overrides set`,{flags:i}),!1===a?yl.info(`Payload overrides cleared`):a&&yl.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.ei({[Mr]:e}),this.md(),void yl.info(`Flag overrides set`,{flags:e});this.I.warn(`Invalid overrideOptions provided to overrideFeatureFlags`,{overrideOptions:e})}else this.I.warn(`posthog.featureFlags.overrideFeatureFlags called before feature flags were ready`)}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Lh){var t=this.bd(),n=t.flags,r=t.flagVariants;try{e(n,r)}catch(e){this.I.error(`Error while running feature flags callback`,e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r=(this.sd(Dr)||[]).find((t=>t.flagKey===e)),i={[`$feature_enrollment/`+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:i};r&&(a.$early_access_feature_name=r.name),n&&(a.$feature_enrollment_stage=n);var o=x({},this.getFlagVariants(),{[e]:t});this.ei({[Er]:Object.keys(Cl(o)),[Tr]:o,[Pr]:x({},this.sd(Pr)||{},i)}),this.md();try{var s;(s=this.Os)==null||s.capture(`$feature_enrollment_update`,a).catch((e=>{this.I.error(`Failed to capture early access feature enrollment`,e)}))}catch(e){this.I.error(`Failed to capture early access feature enrollment`,e)}}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this.sd(Dr);!r||t?this._d(e,n):e(r)}_d(e,t){var n=this;return b((function*(){var r=n.Os;if(r){var i,a=t?`&`+t.map((e=>`stage=`+e)).join(`&`):``;try{var o=yield r.sendRequest(`/api/early_access_features/?token=`+r.projectToken+a,{target:`api`,method:`GET`,sentAt:`query`});if(!o.json)return;n.ei({[Dr]:i=o.json.earlyAccessFeatures})}catch(e){n.I.error(`Early access feature request failed`,e);return}try{e(i)}catch(e){n.I.error(`Early access feature callback failed`,e)}}}))()}bd(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}md(e){this.Xh();var t=this.bd(),n=t.flags,r=t.flagVariants;
2this.featureFlagEventHandlers.forEach((t=>{try{t(n,r,{errorsLoading:e})}catch(e){this.I.error(`Error while running feature flags callback`,e)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.wd(e,t)}wd(e,t){t===void 0&&(t=!0);var n=this.sd(Pr)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),i=e?.$set_once,a={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(a[o]=i[o]));this.ei({[Pr]:x({},n,a,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=x({},this.sd(Pr)||{});e.forEach((e=>{delete n[e]})),this.ei({[Pr]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.ri(Pr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.sd(Fr)||{},r=x({},n);for(var i of Object.keys(e))r[i]=x({},n[i],e[i]);this.ei({[Fr]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.sd(Fr)||{};this.ei({[Fr]:x({},t,{[e]:{}})})}else this.ri(Fr)}reset(){this.$h++,this.qh=!1,this.Ah={},this.Fh={},this.Lh=!1,this.Nh=!1,this.jh=!1,this.$anon_distinct_id=void 0,this.nd(),this.Ph=!1,this.Hh=0}}},zl={sessionRecording:class{get vn(){return this._instance.config}get yo(){return this._instance.persistence}get started(){var e;return!((e=this.kd)==null||!e.isStarted)}get status(){return this.Sd===Kc||this.Sd===qc?this.Sd:this.kd?.status??this.Sd}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Sd=Wc,this.xd=void 0,this.Cd=!1,this.Dt=(()=>{var e;if(c==null||!c.visibilityState||c.visibilityState===`visible`)return!0;var t=a==null||(e=a.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType(`visibility-state`);return!(t!=null&&t.length)||t.some((e=>e.name===`visible`))})(),this.$t=()=>{var e;c?.visibilityState===`visible`&&(this.Dt=!0,(e=this.kd)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Yc.error(`started without valid sessionManager`),Error(Jc+` started without valid sessionManager. This is a bug.`);if(this.vn.cookieless_mode===oi)throw Error(Jc+` cannot be used with cookieless_mode="always"`);c!=null&&c.addEventListener&&J(c,`visibilitychange`,this.$t)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Cd=!0,c==null||c.removeEventListener==null||c.removeEventListener(`visibilitychange`,this.$t),this.stopRecording()}get Td(){var e,t=!((e=this._instance.get_property(_r))==null||!e.enabled),n=!this.vn.disable_session_recording,r=this.vn.disable_session_recording||this._instance.consent.isOptedOut();return a&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.Cd||this.Td&&(t=this.kd)!=null&&t.isStarted)){var n=!N(Object.assign)&&!N(Array.from);this.Td&&n?(this.Md(e),Yc.info(`starting`)):(this.Sd=Wc,this.stopRecording())}}Md(e){var t,n,r;this.Td&&(this.Sd!==Kc&&this.Sd!==qc&&(this.Sd=Gc),_!=null&&(t=_.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=_.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Ed(e):(r=_.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Id,(t=>{if(t)return this._instance.register_for_session({[ri]:!0}),Yc.error(`could not load recorder`,t);this.Ed(e)})))}stopRecording(){var e,t;(e=this.xd)==null||e.call(this),this.xd=void 0,(t=this.kd)==null||t.stop()}Rd(){var e,t;(e=this.xd)==null||e.call(this),this.xd=void 0,(t=this.kd)==null||t.discard()}Pd(){var e,t;(e=this.yo)==null||e.unregister(wr),(t=this.yo)==null||t.unregister(vr)}Ad(e,t){if(I(e))return null;var n,r=L(e)?e:parseFloat(e);return typeof(n=r)!=`number`||!Number.isFinite(n)||0>n||n>1?(Yc.warn(t+` must be between 0 and 1. Ignoring invalid value:`,e),null):r}Fd(e){if(this.yo){var t,n=this.yo,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Ad(this.vn.session_recording?.sampleRate,`session_recording.sampleRate`),i=this.Ad(t?.sampleRate,`remote config sampleRate`),a=r??i;I(a)&&this.Pd();var o=t?.minimumDurationMilliseconds;n.register({[_r]:x({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:x({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:a,minimumDurationMilliseconds:N(o)?null:o,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers,version:t?.version,triggerGroups:t?.triggerGroups})})};r(),(t=this.xd)==null||t.call(this),this.xd=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;t&&`sessionRecording`in t?!1===t.sessionRecording?(this.Fd(t),this.Rd()):(this.Fd(t),this.startIfEnabledOrStop()):(this.Sd===Kc&&(this.Sd=qc,Yc.warn(`config refresh failed, recording will not start until page reload`)),this.startIfEnabledOrStop())}log(e,t){var n;t===void 0&&(t=`log`),(n=this.kd)!=null&&n.log?this.kd.log(e,t):Yc.warn(`log called before recorder was ready`)}get Id(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(_r);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Od(){var e,t=this._instance.get_property(_r);if(!t)return!1;try{e=typeof t==`object`?t:JSON.parse(t)}catch(e){return Yc.warn(`persisted remote config for session recording is invali
2d and will be ignored`,e),!1}return!I(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Ed(e){var t,n,r;if(!this.Cd){if((t=_.__PosthogExtensions__)==null||!t.initSessionRecording)return Yc.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[ri]:!0});if(this.kd||(this.kd=_.__PosthogExtensions__?.initSessionRecording(this._instance,this.Dt),this.kd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Od()){if(this.Sd===qc||this.Sd===Kc)return;this.Sd=Kc,Yc.info(`persisted remote config is stale, requesting fresh config before starting`),new Io(this._instance).load();return}this.Sd=Gc,(n=(r=this.kd).setDocumentWasEverVisible)==null||n.call(r,this.Dt),this.kd.start(e)}}onRRwebEmit(e){var t;(t=this.kd)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.kd||(t=this.yo)==null||t.register({[br]:!0}),(e=this.kd)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.kd||(t=this.yo)==null||t.register({[yr]:!0}),(e=this.kd)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.kd||(n=this.yo)==null||n.register({[e===`url`?xr:Sr]:!0}),(t=this.kd)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.kd?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.kd)==null||!n.tryAddCustomEvent(e,t))}}},Bl={autocapture:class extends Mc{constructor(e){super(new Nc(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.Ld=this.Dd()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this.$d();return!!(e.path||e.search||this.Nd(e))}startIfEnabled(){this.isEnabled&&(B.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Ld=this.Dd(),this.startIfEnabled()}stop(){this.qd&&this.qd(),this.qd=void 0,this.jd&&this.jd(),this.jd=void 0,B.info(`History API monitoring stopped`)}monitorHistoryChanges(){a&&a.history&&(this.Bd(`pushState`),this.Bd(`replaceState`),this.Hd(),this.Nd()&&this.zd())}Bd(e){var t;if(a&&((t=a.history[e])==null||!t.__posthog_wrapped__)){var n=this;Lc(a.history,e,(t=>function(r,i,a){t.call(this,r,i,a),n.Ud(e)}))}}Dd(){var e=a?.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}$d(){var e=this._instance.config.capture_pageview;return e===`history_change`?{path:!0}:M(e)?e:{}}Nd(e){return e===void 0&&(e=this.$d()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}Wd(e){var t=this.$d(),n=this.Ld;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.Nd(t)&&e.hash!==n.hash))}Ud(e){try{var t=this.Dd();if(!t)return;this.Wd(t)&&this._instance.capture(ui,{navigation_type:e}),this.Ld=t}catch(t){B.error(`Error capturing `+e+` pageview`,t)}}Hd(){if(!this.qd){var e=()=>{this.Ud(`popstate`)};J(a,`popstate`,e),this.qd=()=>{a&&a.removeEventListener(`popstate`,e)}}}zd(){if(!this.jd){var e=()=>{this.Ud(`hashchange`)};J(a,`hashchange`,e),this.jd=()=>{a&&a.removeEventListener(`hashchange`,e)}}}},heatmaps:class{get vn(){return this.instance.config}constructor(e){var t;this.Vd=!1,this.Ts=!1,this.Gd=null,this.instance=e,this.Vd=!((t=this.instance.persistence)==null||!t.props[cr]),this.rageclicks=new Ec(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return M(this.vn.capture_heatmaps)&&this.vn.capture_heatmaps.flush_interval_milliseconds&&(e=this.vn.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return I(this.vn.capture_heatmaps)?I(this.vn.enable_heatmaps)?this.Vd:this.vn.enable_heatmaps:!1!==this.vn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ts)return;Xc.info(`starting...`),this.Zd(),this.$t()}else clearInterval(this.Gd??void 0),this.Qd(),this.getAndClearBuffer()}onRemoteConfig(e){if(e.ok){var t=e.config;if(`heatmaps`in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cr]:n}),this.Vd=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.At;return this.At=void 0,e}Jd(e){Zc(e.originalEvent)&&this.Qi(e.originalEvent,`deadclick`)}$t(){this.Gd&&clearInterval(this.Gd),this.Gd=c?.visibilityState===`visible`?setInterval(this.oo.bind(this),this.flushIntervalMilliseconds):null}Zd(){a&&c&&(this.Kd=this.oo.bind(this),J(a,li,this.Kd),this.Yd=e=>this.Qi(e||a?.event),J(c,`click`,this.Yd,{capture:!0}),this.Xd=e=>this.tv(e||a?.event),J(c,`mousemove`,this.Xd,{capture:!0}),this.ev=new za(this.instance,La,this.Jd.bind(this)),this.ev.startIfEnabledOrStop(),this.iv=this.$t.bind(this),J(c,ci,this.iv),this.Ts=!0)}Qd(){var e;a&&c&&(this.Kd&&a.removeEventListener(li,this.Kd),this.Yd&&c.removeEventListener(`click`,this.Yd,{capture:!0}),this.Xd&&c.removeEventListener(`mousemove`,this.Xd,{capture:!0}),this.iv&&c.removeEventListener(ci,this.iv),clearTimeout(this.rv),(e=this.ev)==null||e.stop(),this.Ts=!1)}nv(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),o=function(e,t,n){for(var r=e;r&&$i(r)&&!ea(r,`body`);){if(r===n)return!1;var i=void 0;try{i=(r.ownerDocument?.defaultView??a)?.getComputedStyle(r).position}catch{return!1}if(k(t,i))return!0;r=fa(r)}return!1}(la(e),[`fixed`,`sticky`],i);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Qi(e,t){var n;if(t===void 0&&(t=`click`),!Qi(e.target)&&Zc(e)){var r=this.nv(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ya(la(e),this.instance.config.rageclick)&&this.fs(x({},r,{type:`rageclick`})),this.fs(r)}}tv(e){!Qi(e.target)&&Zc(e)&&(clearTimeout(this.rv),this.rv=setTimeout((()=>
2{this.fs(this.nv(e,`mousemove`))}),500))}fs(e){if(a){var t=this.vn.disable_capture_url_hashes?Bt(a.location.href):a.location.href,n=this.vn.custom_personal_data_properties,r=Qa(t,this.vn.mask_personal_data_properties?[...ro,...n||[]]:[],ao);this.At=this.At||{},this.At[r]||(this.At[r]=[]),this.At[r].push(e)}}oo(){this.At&&!ve(this.At)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:za,webVitalsAutocapture:class{constructor(e){var t;this.Vd=!1,this.Ts=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.sv=()=>{clearTimeout(this.av),this.av=void 0,this.At.metrics.length!==0&&(this._instance.capture(`$web_vitals`,x({$current_url:this.At.url},this.At.metrics.reduce(((e,t)=>x({},e,{[`$web_vitals_`+t.name+`_event`]:x({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{}))),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ov=e=>{if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},I(e?.name)||I(e?.value))zc.error(`Invalid metric received`,e);else{var t=typeof e.navigationURL==`string`?e.navigationURL:void 0,n=this.lv(t);if(!N(n)){var r=L(e.navigationId)||typeof e.navigationId==`string`?`navigation:`+e.navigationId:`url:`+n;if(!this.uv||this.uv>e.value){this.At.navigationKey!==r&&(this.sv(),this.av=setTimeout(this.sv,this.flushToCaptureTimeoutMs)),N(this.At.navigationKey)&&(this.At.navigationKey=r,this.At.url=n),this.At.firstMetricTimestamp=N(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;var i=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0),a=x({},e,t?{navigationURL:n}:{},{$current_url:n,timestamp:Date.now()});if(delete a.entries,M(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){var o={};for(var s of Uc){var c=s===`url`&&typeof e.attribution[s]==`string`?this.lv(e.attribution[s]):e.attribution[s];N(c)||(o[s]=c)}a.attribution=o}else delete a.attribution;N(i)||(a.$session_id=i.sessionId,a.$window_id=i.windowId),this.At.metrics.push(a),this.At.metrics.length===this.allowedMetrics.length&&this.sv()}else zc.error(`Ignoring metric with value >= `+this.uv,e)}}},this.hv=()=>{if(!this.Ts){var e,t,n,r,i=!1,a=_.__PosthogExtensions__,o=a?.postHogWebVitalsCallbacksByFlavor,s=o?.[this.dv]||(this.dv===`web-vitals`&&N(o)?a?.postHogWebVitalsCallbacks:void 0);if(!N(s)){var c=s.withoutAttribution,l=this.attributionMetrics;i=!N(c),e=l.indexOf(`LCP`)>-1?s.onLCP:c?.onLCP||s.onLCP,t=l.indexOf(`CLS`)>-1?s.onCLS:c?.onCLS||s.onCLS,n=l.indexOf(`FCP`)>-1?s.onFCP:c?.onFCP||s.onFCP,r=l.indexOf(`INP`)>-1?s.onINP:c?.onINP||s.onINP}if(e&&t&&n&&r){var u={reportSoftNavs:this.useSoftNavs},d=i&&this.attributionMetrics.indexOf(`INP`)>-1?x({},u,{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.ov.bind(this),u),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.ov.bind(this),u),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.ov.bind(this),u),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.ov.bind(this),d),this.Ts=!0}else zc.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.Vd=!((t=this._instance.persistence)==null||!t.props[fr]),this.startIfEnabled()}get vv(){return this._instance.config.capture_performance}get allowedMetrics(){var e=M(this.vv)?this.vv?.web_vitals_allowed_metrics:void 0;return I(e)?this._instance.persistence?.props[gr]||Vc:e}get flushToCaptureTimeoutMs(){return(M(this.vv)?this.vv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=M(this.vv)?this.vv.web_vitals_attribution:void 0;return R(e)?e?Vc:[]:A(e)?e:Hc}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=M(this.vv)?this.vv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get uv(){var e=M(this.vv)&&L(this.vv.__web_vitals_max_value)?this.vv.__web_vitals_max_value:Bc;return e>0&&6e4>=e?Bc:e}get isEnabled(){var e=l?.protocol;if(e!==`http:`&&e!==`https:`)return zc.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=M(this.vv)?this.vv.web_vitals:R(this.vv)?this.vv:void 0;return R(t)?t:this.Vd}startIfEnabled(){this.isEnabled&&!this.Ts&&(zc.info(`enabled, starting...`),this.Zs(this.hv))}onRemoteConfig(e){if(e.ok){var t=e.config;if(`capturePerformance`in t){var n=M(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=M(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[fr]:n}),this._instance.persistence.register({[gr]:r})),this.Vd=n,this.startIfEnabled()}}}get dv(){return this.useSoftNavs?this.useAttribution?`web-vitals-with-attribution-soft-navs`:`web-vitals-soft-navs`:this.useAttribution?`web-vitals-with-attribution`:`web-vitals`}Zs(e){var t=_.__PosthogExtensions__,n=this.dv,r=t?.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n===`web-vitals`&&N(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(t=>{t?zc.error(`failed to load script`,t):e()}))}lv(e){var t=e||a?.location.href;if(t){var n=this._instance.config.disable_capture_url_hashes?Bt(t):t,r=this._instance.config.custom_personal_data_properties;return Qa(n,this._instance.config.mask_personal_data_properties?[...ro,...r||[]]:[],ao)}zc.error(`Could not determine current URL`)}}},Vl={exceptionObserver:class{constructor(e){var t;this.hv=()=>{var e;if(a&&this.isEnabled&&(e=_.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=_.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=_.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=_.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fv&&this.vn.capture_unhandled_errors&&(this.fv=t(this.captureException.bind(this))),!this.pv&&this.vn.capture_unhandled_rejections&&(this.pv=n(this.captureException.bind(this))),!this.gv&&this.vn.capture_console_errors&&(this.gv=r(this.captureException.bind(this)))}catch(e){Pc.error(`failed to start`,e),this.mv()}}},this._instance=e,this.yv=!((t=this._instance.persistence)==null||!t.props[lr]),this.de=new Ne(x({},function(e){return e===void 0&&(e={}),{refillRate:e.exceptionRateLimiterRefillRate??e.__exceptionRateLimiterRefillRate??1,bucketSize:e.exceptionRateLimiterBucketSize??e.__exceptionRateLimiterBucketSize??10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:Pc})),this.vn=this.bv(),this.startIfEnabledOrStop()}
2bv(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return M(e)?t=x({},t,e):(N(e)?this.yv:e)&&(t=x({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.vn.capture_console_errors||this.vn.capture_unhandled_errors||this.vn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pc.info(`enabled`),this.mv(),this.Zs(this.hv)):this.mv()}Zs(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return Pc.error(`failed to load script`,t);e()}))}mv(){var e,t,n;(e=this.fv)==null||e.call(this),this.fv=void 0,(t=this.pv)==null||t.call(this),this.pv=void 0,(n=this.gv)==null||n.call(this),this.gv=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;`autocaptureExceptions`in t&&(this.yv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[lr]:this.yv}),this.vn=this.bv(),this.startIfEnabledOrStop())}}onConfigChange(){this.vn=this.bv()}captureException(e){var t,n,r=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.de.consumeRateLimit(r)?Pc.info(`Skipping exception capture because of client rate limiting.`,{exception:r}):(n=this._instance.exceptions)==null||n.sendExceptionEvent(e)}},exceptions:class{constructor(e){this._v=[],this.wv=new bn([new Mn,new Hn,new Pn,new Nn,new Bn,new zn,new In,new Vn],function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];return function(t,r){r===void 0&&(r=0);for(var i=[],a=t.split(` 3`),o=r;a.length>o;o++){var s=a[o];if(1024>=s.length){var c=jn.test(s)?s.replace(jn,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of n){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return x({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||xn});var n}))}(i)}}(`web:javascript`,Dn,An)),this._instance=e,this._v=this._instance.persistence?.get_property(ur)??[],this.Sv=qn(this.xv()),this.Cv=new Jn(this.Sv)}onConfigChange(){this.Sv=qn(this.xv()),this.Cv.setConfig(this.Sv)}onRemoteConfig(e){if(e.ok){var t=e.config;if(`errorTracking`in t){var n=t.errorTracking?.suppressionRules??[],r=t.errorTracking?.captureExtensionExceptions;this._v=n,this._instance.persistence&&this._instance.persistence.register({[ur]:this._v,[dr]:r})}}}get Tv(){var e,t=!!this._instance.get_property(dr);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.wv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Sv.enabled)try{if(!P(e)||e.trim().length===0)return void wl.warn(`Ignoring exception step because message must be a non-empty string`);var n=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((n,r)=>Gn.has(r)?(t.push(r),n):(n[r]=e[r],n)),{}),droppedKeys:t}}(this.Mv(t)),r=n.sanitizedProperties,i=n.droppedKeys;i.length>0&&wl.warn(`Ignoring reserved exception step fields`,{droppedKeys:i}),this.Cv.add(x({[Un]:e,[Wn]:new Date().toISOString()},r))}catch(e){wl.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ev(t)){if(this.Iv(t))return this.Rv(`Exception dropped: matched a suppression rule`),void wl.info(`Skipping exception capture because a suppression rule matched`);if(!this.Tv&&this.Pv(t))return this.Rv(`Exception dropped: thrown by a browser extension`),void wl.info(`Skipping exception capture because it was thrown by an extension`);if(!this.Tv&&this.Av(t))return this.Rv(`Exception dropped: thrown by an injected browser script`),void wl.info(`Skipping exception capture because it was thrown by an injected browser script`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Fv(t))return this.Rv(`Exception dropped: thrown by the PostHog SDK`),void wl.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}var n=this.Sv.enabled&&I(e.$exception_steps)?this.Ov(e):e,r=typeof(a=globalThis._posthogReleaseId)==`string`&&a.length>0?a:void 0;r&&(n.$release_id=r);try{var i=this._instance.capture(`$exception`,n,{_noTruncate:!0,_batchKey:`exceptionEvent`,jl:!0});return i&&this.Cv.clear(),i}catch(e){wl.error(`Failed to capture exception event. Dropping this exception.`,e),this.Cv.clear();return}}catch(e){wl.error(`Failed to process exception event. Ignoring this exception.`,e);return}var a}Ov(e){try{var t=this.Cv.getAttachable();return t.length===0?e:x({},e,{$exception_steps:t})}catch(t){return wl.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}Rv(e){this.Sv.enabled&&this.Cv.add({[Un]:e,[Wn]:new Date().toISOString()})}Mv(e){return M(e)?x({},e):{}}xv(){return this._instance.config.error_tracking?.exception_steps??{}}Iv(e){if(e.length===0)return!1;try{var t=e.reduce(((e,t)=>{var n=t.type,r=t.value;return P(n)&&n.length>0&&e.$exception_types.push(n),P(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this._v.some((e=>{var n=e.values.map((e=>{var n=Gs[e.operator],r=t[e.key];if(!n||!r)return!1;var i=A(e.value)?e.value:[e.value];return i.length>0&&n(i,r)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}catch(e){return wl.warn(`Failed to evaluate suppression rules. Capturing the exception.`,e),!1}}Pv(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>{var t=e.filename;return!!t&&Tl.some((e=>t.startsWith(e)))}))}Av(e){return e.some((e=>{var t=e.value;return P(t)&&El.some((e=>t.includes(e)))}))}Fv(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}Ev(e){return!I(e)&&A(e)}}}
3,Hl=x({productTours:class{get yo(){return this._instance.persistence}constructor(e){this.Lv=null,this.Dv=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if(`productTours`in t){var n;if(this.yo&&this.yo.register({[mr]:!!t.productTours}),!$c(this._instance))return!this.Lv&&I(this.yo?.props[Hr])||Qc.info(`product tours disabled; stopping and clearing cached tours`),(n=this.Lv)==null||n.stop(),this.Lv=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Lv&&$c(this._instance)&&this.Zs((()=>this.$v()))}Zs(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?Qc.error(`Could not load product tours script`,t):e()}))}$v(){var e;!this.Lv&&(e=_.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Lv=_.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!A(this.Dv)||t){var n=this.yo;if(n){var r=n.props[Hr];if(A(r)&&!t)return this.Dv=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:t=>{if($c(this._instance)){var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;r===0?t.error||Qc.warn(i):Qc.error(i),e([],{isLoaded:!1,error:i});return}var a=A(t.json.product_tours)?t.json.product_tours:[];this.Dv=a,n&&n.register({[Hr]:a}),e(a,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Dv,{isLoaded:!0})}getActiveProductTours(e){I(this.Lv)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.Lv.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Lv)==null||t.showTourById(e)}previewTour(e){this.Lv?this.Lv.previewTour(e):this.Zs((()=>{var t;this.$v(),(t=this.Lv)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Lv)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Lv)==null||e.nextStep()}previousStep(){var e;(e=this.Lv)==null||e.previousStep()}clearCache(){var e;this.Dv=null,(e=this.yo)==null||e.unregister(Hr)}resetTour(e){var t;(t=this.Lv)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Lv)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Lv)==null||t.cancelPendingTour(e)}}},Rl),Ul={siteApps:class{constructor(e){this.Nv=0,this._instance=e,this.qv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}jv(e,t){if(t){var n=this.globalsForEvent(t);this.qv.push(n),this.qv.length>1e3&&(this.qv=this.qv.slice(10))}}get siteAppLoaders(){var e;return(e=_._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.jv.bind(this));this.Bv=()=>{e(),this.qv=[],this.Bv=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var i of Object.entries(r)){var a=i[0];t[a]={id:n[a],type:a,properties:i[1]}}var o=e.$set_once,s=e.$set;return{event:x({},S(e,el),{properties:x({},e.properties,s?{$set:x({},e.properties?.$set??{},s)}:{},o?{$set_once:x({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}Hv(e){var t=e.tagName?.toLowerCase();return t===`style`&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(tl.error(`prepare_external_dependency_stylesheet returned null`),null):t===`script`&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(tl.error(`prepare_external_dependency_script returned null`),null):e}zv(){var e;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var t=c?.defaultView,n=t==null||(e=t.Node)==null?void 0:e.prototype;if(!t||!n)return()=>{};if(this.Nv++,this.Uv)return this.Wv();var r=[],i=this,a=new WeakSet,o=(e,t,n)=>{if(e!=null&&e[t]){var i=e[t];e[t]=n(i),r.push((()=>{e[t]=i}))}},s=e=>{if(a.has(e))return e;var t=i.Hv(e);return t&&a.add(t),t},l=e=>e.map((e=>typeof e==`string`?e:s(e))).filter((e=>!F(e)));return o(n,`appendChild`,(e=>function(t){var n=s(t);return n?e.call(this,n):t})),o(n,`insertBefore`,(e=>function(t,n){var r=s(t);return r?e.call(this,r,n):t})),o(n,`replaceChild`,(e=>function(t,n){var r=s(t);return r?e.call(this,r,n):n})),[t.Element?.prototype,t.Document?.prototype,t.DocumentFragment?.prototype].forEach((e=>{o(e,`append`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,l(n))})),o(e,`prepend`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,l(n))}))})),[t.Element?.prototype,t.CharacterData?.prototype,t.DocumentType?.prototype].forEach((e=>{o(e,`before`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,l(n))})),o(e,`after`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e.apply(this,l(n))})),o(e,`replaceWith`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=l(n);return n.length&&!i.length?void 0:e.apply(this,i)}))})),o(t.Element?.prototype,`insertAdjacentElement`,(e=>function(t,n){var r=s(n);return r?e.call(this,t,r):null})),this.Uv=()=>{r.forEach((e=>e())),this.Uv=void 0},this.Wv()}Wv(){var e=!1;return()=>{var t;e||(e=!0,this.Nv--,this.Nv===0&&((t=this.Uv)==null||t.call(this)))}}Vv(e,t){t===void 0&&(t=!0);var n=this.zv();try{var r=e(n);return t&&n(),r}catch(e){throw n(),e}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.qv.length&&(tl.info(`Processing `+this.qv.length+` events for site app with id `+e.id),this.qv.forEach((e=>this.Vv((()=>t.processEvent==null?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&((n=this.Bv)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,tl.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var a=this.Vv((t=>e.init({posthog:this._instance,callback(e){t(),i(e)}})),!1).processEvent;a&&(t.processEvent=a),r=!0}catch(t){tl.error(nl+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){tl.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}Gv(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Zv(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(r){try{t.Vv((()=>r.processEvent==null?void 0:r.processEvent(n)))}catch(t){tl.error(`Error while processing event `+e.event+` for site app `+r.id,t)}};for(var i of Object.values(this.apps))r(i)}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Gv(),void this._instance.on(`eventCaptured`,(e=>this.Zv(e)))):void tl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.Bv)==null||n.call(this),e.ok){var a=e.config;if((r=a.siteApps)!=null&&r.length){if(this.isEnabled){var o=function(){var e,t=s.id,n=s.url;_[`__$$ph_site_app_`+t]=i._instance,(e=_.__PosthogExtensions__)==null||e.loadSiteApp==null||e.loadSiteApp(i._instance,n,(e=>{if(e)return tl.error(nl+t,e)}))};for(var s of a.siteApps)o()}else tl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}}},Wl={tracingHeaders:class{constructor(e){this.Qv=void 0,this.Jv=void 0,this.Kv=void 0,this.hv=()=>{var e,t,n=this.Yv();
3n?(N(this.Qv)&&(this.Qv=(e=_.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),N(this.Jv)&&(this.Jv=(t=_.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.mv()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Zs(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return Rc.error(`failed to load script`,t);e()}))}Xv(){return this._instance.config.tracing_headers??this._instance.config.addTracingHeaders??this._instance.config.__add_tracing_headers}Yv(){var e=this.Xv();return A(e)?(A(this.Kv)?this.Kv.splice(0,this.Kv.length,...e):this.Kv=[...e],e.length>0?this.Kv:void 0):(A(this.Kv)&&this.Kv.splice(0),this.Kv=e||void 0,this.Kv)}mv(){var e,t;(e=this.Qv)==null||e.call(this),(t=this.Jv)==null||t.call(this),this.Qv=void 0,this.Jv=void 0}startIfEnabledOrStop(){this.Yv()?this.Zs(this.hv):this.mv()}}},Gl=x({surveys:class extends ol{constructor(e){var t;super(new fl(e),{get projectToken(){return t.config.token},kv:new dl(t=e)}),this._instance=e}du(e,t){var n=t.query?vs(e,t.query):e;return new Promise((e=>{this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(t.target??`api`,n),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})}))}}},Rl),Kl={toolbar:class{constructor(e){this.instance=e}tc(e){_.ph_toolbar_state=e}ec(){return _.ph_toolbar_state??0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),xi(this.instance.config)||!a||!c)return!1;e??=a.location,n??=a.history;try{if(!t){try{a.localStorage.setItem(`test`,`test`),a.localStorage.removeItem(`test`)}catch{return!1}t=a?.localStorage}var r,i=pl||$a(e.hash,`__posthog`)||$a(e.hash,`state`),o=i?gi((()=>JSON.parse(atob(decodeURIComponent(i)))))||gi((()=>JSON.parse(decodeURIComponent(i)))):null;return o&&o.action===`ph_authorize`?((r=o).source=`url`,r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(ml)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}ic(e){var t=_.ph_load_toolbar||_.ph_load_editor;!I(t)&&j(t)?t(e,this.instance):hl.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(c==null||!c.getElementById(Ji));if(!a||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=x({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(a.localStorage.setItem(ml,JSON.stringify(x({},r,{source:void 0}))),this.ec()===2)this.ic(r);else if(this.ec()===0){var i;this.tc(1),(i=_.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return hl.error(`[Toolbar] Failed to load`,e),void this.tc(0);this.tc(2),this.ic(r)})),J(a,`turbolinks:load`,(()=>{this.tc(0),this.loadToolbar(r)}))}return!0}rc(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}},ql=x({experiments:kl},Rl),Jl=x({},Rl,zl,Bl,Vl,Hl,Ul,Gl,Wl,Kl,ql,{conversations:class{constructor(e){this.nc=void 0,this._conversationsManager=null,this.sc=!1,this.Fe=null,this.ac=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.oc=e.ok,e.ok)){var t=e.config.conversations;I(t)||(R(t)?this.nc=t:(this.nc=t.enabled,this.Fe=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.nc=void 0,this.Fe=null,this.oc=void 0,this.ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.sc||this._instance.config.disable_conversations||xi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=_?.__PosthogExtensions__;if(e&&!N(this.nc)&&this.nc){if(this.Fe&&this.Fe.token){this.sc=!0;try{var t=e.initConversations;if(t)return this.lc(t),void(this.sc=!1);var n=e.loadExternalDependency;if(!n)return void this.uc(ii);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.uc(`Could not load conversations script`,t):this.lc(e.initConversations),this.sc=!1}))}catch(e){this.uc(`Error initializing conversations`,e),this.sc=!1}}else Al.error(`Conversations enabled but missing token in remote config.`)}}}lc(e){if(this.Fe)try{this._conversationsManager=e(this.Fe,this._instance),this.ac=!1,Al.info(`Conversations loaded successfully`)}
3catch(e){this.uc(`Error completing conversations initialization`,e)}else Al.error(`Cannot complete initialization: remote config is null`)}uc(e,t){Al.error(e,t),this._conversationsManager=null,this.sc=!1,this.ac=!0}show(){this._conversationsManager?this._conversationsManager.show():Al.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.nc&&!F(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:xi(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.oc?`remote_config_failed`:N(this.nc)?this.oc?`disabled_in_project`:`remote_config_pending`:this.nc?I(this.Fe)||!this.Fe.token?`missing_token`:_!=null&&_.__PosthogExtensions__?this.sc?`initializing`:this.ac?`load_failed`:`not_loaded`:`extensions_unavailable`:`disabled_in_project`}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return b((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Al.warn(jl),null)}))()}getMessages(e,t){var n=this;return b((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Al.warn(jl),null)}))()}markAsRead(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Al.warn(jl),null)}))()}getTickets(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Al.warn(jl),null)}))()}requestRestoreLink(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Al.warn(jl),null)}))()}restoreFromToken(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Al.warn(jl),null)}))()}restoreFromUrlToken(){var e=this;return b((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Al.warn(jl),null)}))()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}Ql(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Jl(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t,n=this;this.name=`logs`,this.hc=!1,this.dc=!1,this.vc=!1,this.I=V(`[logs]`),this.cc=x({},this.I,{error(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(Ll)||n.I.error(...t)}}),this.Za=[],this.fc=[],this.Hh=0,this.Rs=!1,this.gc=[],this.mc=[],this.yc=!1,this.bc=!1,this._c=()=>{var e,t;this.Rs||(this.Hh=0,(e=this.wc)==null||e.onReconnect(),(t=this.kc)==null||t.onReconnect())},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.hc=!0),a&&J(a,`online`,this._c)}Sc(e,t,n,r){var i,a=Ml((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new dn(this.xc(e,t),a,this.cc,(()=>this.Cc()),(e=>e()),void 0,r),a]}Tc(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.wc||this.Mc!==t){var n;(n=this.wc)==null||n.reset(),this.Mc=t;var r=this.Sc((()=>this.Za),(e=>{this.Za=e}));this.wc=r[0],this.Ec=r[1]}return this.wc}Ic(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.kc||this.Rc!==t){var n;(n=this.kc)==null||n.reset(),this.Rc=t;var r=this.Sc((()=>this.fc),(e=>{this.fc=e}),{serviceNameDefault:`posthog-browser-logs`,consoleCapture:!0},Pl);this.kc=r[0],this.Pc=r[1]}return this.kc}setup(e){var t;if(!this.Rs){this.Os=e,(t=this._instance)!=null&&(t=t.config)!=null&&(t=t.logs)!=null&&t.captureConsoleLogs&&(this.hc=!0),(this.hc||this.Ac()&&this.Fc())&&this.Oc();var n=!1,r=e.onRemoteConfig((e=>{n=e.ok&&!0===e.config.logs?.captureConsoleLogs,this.onRemoteConfig(e)}));this.Rs?r.dispose():(this.Ls=r,n||this.loadIfEnabled())}}dispose(){var e,t,n,r;this.Rs||(this.Rs=!0,this.Lc(),(e=this.Ls)==null||e.dispose(),this.Ls=void 0,this.Os=void 0,this.vc=!1,a?.removeEventListener(`online`,this._c),(t=this.Dc)==null||t.call(this),this.Dc=void 0,(n=this.wc)==null||n.reset(),(r=this.kc)==null||r.reset())}onRemoteConfig(e){var t;if(!this.Rs){var n=e.ok?e.config.logs?.captureConsoleLogs:void 0;I(n)?this.$c():((t=this._instance)==null||(t=t.persistence)==null||t.register({[hr]:!!n}),n?(this.hc=!0,this.dc||this.Oc(),this.loadIfEnabled()):this.$c())}}reset(){var e,t,n,r;this.Lc(),(e=this.wc)==null||e.clearQueue(),this.Za=[],(t=this.wc)==null||t.reset(),(n=this.kc)==null||n.clearQueue(),this.fc=[],(r=this.kc)==null||r.reset(),this.Hh=0}captureLog(e){this.Rs||this.Tc().captureLog(e)}captureConsoleLog(e){this.Rs||this.Ic().captureLog(e)}captureBufferedConsoleLog(e,t,n){this.Rs||this.Ic().captureLog(e,{context:t,occurredAtMs:n})}Fc(){var e;return!((e=this._instance)==null||(e=e.persistence)==null||(e=e.props)==null||!e[hr])}Ac(){var e,t;
3return(e=this._instance)==null||e.Ua==null||!e.Ua()||!((t=_._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null||!t.config)}Yl(){var e;this.Lc(),(e=this.kc)==null||e.clearQueue(),this.fc=[]}$c(){this.hc||this.Lc()}Oc(){var e,t=this;if(!this.yc&&_!=null&&_.console){var n=Ml((e=this._instance)==null||(e=e.config)==null?void 0:e.logs).maxBufferSize,r=function(e){var r;try{r=(e=>{for(;(t=e)!=null&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e})(_.console[e])}catch{return 0}if(!r)return 0;t.mc.push(Lc(_.console,e,(i=>{var a=function(){for(var r=arguments.length,a=Array(r),o=0;r>o;o++)a[o]=arguments[o];try{t.Nc(e,a,n)}catch{}return i.apply(_.console,a)};return a.__rrweb_original__=r,a})))};for(var i of Nl)r(i);this.yc=!0,this.qc=setTimeout((()=>{this.Lc()}),3e4)}}Nc(e,t,n){var r;if(this.yc&&!this.bc&&t.length!==0){if((r=this._instance)!=null&&r.is_capturing()){if(n>this.gc.length){this.bc=!0;try{this.gc.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Cc()})}finally{this.bc=!1}}}else this.Lc()}}Lc(){if(this.gc=[],this.yc){for(var e of(this.yc=!1,this.qc&&=(clearTimeout(this.qc),void 0),this.mc))e();this.mc=[]}}jc(){var e=this.gc;return this.Lc(),e}get logger(){return this.Bc||={trace:(e,t)=>this.captureLog({body:e,level:`trace`,attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:`debug`,attributes:t}),info:(e,t)=>this.captureLog({body:e,level:`info`,attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:`warn`,attributes:t}),error:(e,t)=>this.captureLog({body:e,level:`error`,attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:`fatal`,attributes:t})},this.Bc}flushLogs(e){e?this.Hc(e):(this.wc&&this.wc.flush().catch((e=>this.zc(e))),this.kc&&this.kc.flush().catch((e=>this.zc(e))))}zc(e){Ll(e)||this.I.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(!this.Rs&&this.hc&&!this.dc&&!this.vc){var e=_?.__PosthogExtensions__;if(!e)return this.I.error(`PostHog Extensions not found.`),void this.Lc();var t=e.loadExternalDependency;if(!t)return this.I.error(ii),void this.Lc();this.vc=!0;try{t(this._instance,`logs`,(t=>{if(this.vc=!1,!this.Rs&&this.hc){var n=e.logs;if(t||n==null||!n.initializeLogs)this.I.error(`Could not load logs script`,t),this.Lc();else{var r=this.jc();this.Dc=n.initializeLogs(this.Os??this._instance),this.dc=!0,r.length>0&&(n.replayConsoleBuffer==null||n.replayConsoleBuffer(this.Os??this._instance,r))}}}))}catch(e){throw this.vc=!1,e}}}xc(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:t=>t===D.LogsQueue?e():void 0,setPersistedProperty(e,n){e===D.LogsQueue&&t(n??[])},es:e=>this.es(e),getLibraryId:()=>v.LIB_NAME,getLibraryVersion:()=>v.LIB_VERSION}}es(e){return new Promise((t=>{if(eo(this.Hh,3))t({kind:`fatal`,error:Il(void 0,`logs endpoint is unreachable, dropping batch`)});else{var n=!1,r=e=>{n||(n=!0,clearTimeout(i),t(e))},i=setTimeout((()=>{this.I.warn(`Logs request timed out before receiving a response`),r({kind:`retry-later`,error:Il(void 0,`logs request timed out`)})}),9e4);this._instance._send_request({method:`POST`,url:this.Uc(),data:e,compression:`best-available`,batchKey:`logs`,fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;this.Wc(t),t>=200&&300>t?r({kind:`ok`}):t===413?r({kind:`too-large`}):t!==0&&t!==408&&t!==429&&500>t?r({kind:`fatal`,error:Error(`logs request failed with status `+t)}):t===0?(e.error||this.I.warn(`Logs request failed before receiving an HTTP response`),r({kind:`retry-later`,error:Il(e.error,`logs request failed before receiving an HTTP response`)})):r({kind:`retry-later`,error:e.error??Error(`logs request failed with status `+t)})}})}}))}Wc(e){(e!==0||this._instance.__loaded)&&(this.Hh=to(e,this.Hh,3,(()=>this.I.warn(`Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.`))))}Hc(e){this.Za.length>0&&this.Vc(e,this.Za,this.Ec,v.LIB_NAME,(e=>{this.Za=e})),this.fc.length>0&&this.Vc(e,this.fc,this.Pc,Pl,(e=>{this.fc=e}))}Vc(e,t,n,r,i){if(t.length!==0){var a=t.map((e=>e.record));i([]);var o=un(a,ln(n,v.LIB_NAME,v.LIB_VERSION),r,v.LIB_VERSION);this._instance._send_request({method:`POST`,url:this.Uc(),data:o,compression:`best-available`,batchKey:`logs`,transport:e})}}Uc(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token)}Cc(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=n.windowId,i=n.sessionStartTimestamp,a=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=r,I(i)||(t.sessionStartTimestamp=i),I(a)||
3(t.lastActivityTimestamp=a)}if(_!=null&&(e=_.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Bt(_.location.href):_.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},{metrics:class{constructor(e){this.I=V(`[metrics]`),this._instance=e}initialize(){}Tc(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.wc&&this.Mc===n||((t=this.wc)==null||t.reset(),this.Mc=n,this.wc=new hn(this.xc(),function(e){var t=e?.resourceAttributes;return{serviceName:t?.[`service.name`]??e?.serviceName,serviceVersion:t?.[`service.version`]??e?.serviceVersion,environment:t?.[`deployment.environment`]??e?.environment,resourceAttributes:t,beforeSend:e?.beforeSend,flushIntervalMs:e?.flushIntervalMs??1e4,maxSeriesPerFlush:e?.maxSeriesPerFlush??1e3}}(n),this.I)),this.wc}count(e,t,n){t===void 0&&(t=1),this.Tc().count(e,t,n)}gauge(e,t,n){this.Tc().gauge(e,t,n)}histogram(e,t,n){this.Tc().histogram(e,t,n)}flush(e){if(!this.wc)return Promise.resolve();if(e){var t=this.wc.drainWindow();return t&&this._s(t,e),Promise.resolve()}return this.wc.flush().catch((e=>this.I.error(`PostHog metrics flush failed:`,e)))}reset(){var e;(e=this.wc)==null||e.reset()}xc(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_s:e=>t._s(e),getLibraryId:()=>v.LIB_NAME,getLibraryVersion:()=>v.LIB_VERSION}}_s(e,t){return new Promise((n=>{var r=!1,i=e=>{r||(r=!0,clearTimeout(a),n(e))},a=setTimeout((()=>i({kind:`retry-later`,error:Error(`metrics request timed out`)})),9e4);this._instance._send_request(x({method:`POST`,url:this.Gc(),data:e,compression:`best-available`,batchKey:`metrics`},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;i(t>=200&&300>t?{kind:`ok`}:t===413?{kind:`too-large`}:t!==0&&t!==408&&t!==429&&500>t?{kind:`fatal`,error:Error(`metrics request failed with status `+t)}:{kind:`retry-later`,error:e.error??Error(`metrics request failed with status `+t)})}}))}))}Gc(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/metrics`)+`?token=`+encodeURIComponent(this._instance.config.token)}}});Tc.__defaultExtensionClasses=x({},Jl);var Yl=function(){v.SDK_DIST_CHANNEL=`npm`;var e=uc[vc]=new Tc;return function(){function e(){e.done||(e.done=!0,yc=!1,K(uc,(function(e){e._dom_loaded()})))}c!=null&&c.addEventListener?c.readyState===`complete`?e():J(c,`DOMContentLoaded`,e,{capture:!1}):a&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),Xl=/^\[CONVEX [QMA]\(([^)]*)\)\] \[Request ID: ([0-9a-f]+)\]/,Zl=/^\[CONVEX [QMA]\([^)]*\)\] Connection lost while action was in flight/,Ql=new Set([`Failed to fetch`,`Load failed`,`NetworkError when attempting to fetch resource.`]);function $l(e,t){return Xl.test(t)?e===`ConvexError`?`expected`:`server`:Zl.test(t)||e===`TypeError`&&Ql.has(t)?`expected`:`browser`}var eu=t(r({type:e().catch(``),value:e().catch(``)}));function tu(e){if(e?.event!==`$exception`)return e;let t=eu.safeParse(e.properties.$exception_list);if(!t.success)return e;if(t.data.map(e=>$l(e.type,e.value)).includes(`expected`))return null;let n=t.data.map(e=>Xl.exec(e.value)).find(e=>e!==null);if(!n)return e;let[,r,i]=n;return{...e,properties:{$exception_fingerprint:`convex_server_failure:${r}`,$issue_name:`Convex server failure in browser: ${r}`,...e.properties,error_owner:`backend`,convex_function:r,convex_request_id:i}}}var nu=t(r({type:e().catch(``),value:e().catch(``),stacktrace:r({frames:t(r({filename:e().optional().catch(void 0),function:e().optional().catch(void 0),lineno:n().optional().catch(void 0),colno:n().optional().catch(void 0)}))}).optional().catch(void 0)})).nonempty(),ru;function iu(e){if(e?.event!==`$exception`)return e;let t=nu.safeParse(e.properties.$exception_list);if(!t.success)return e;let[{type:n,value:r,stacktrace:i}]=t.data,a=JSON.stringify({type:n,value:r,fingerprint:e.properties.$exception_fingerprint,frames:i?.frames});return a===ru?null:(ru=a,e)}var au={api_host:`https://v.trybounty.ai`,ui_host:`https://us.posthog.com`,defaults:`2026-01-30`,capture_pageview:`history_change`,before_send:[tu,iu],debug:!1},ou={...au,capture_exceptions:!0,capture_performance:{web_vitals:!0,web_vitals_allowed_metrics:[`LCP`,`CLS`,`FCP`,`INP`],web_vitals_attribution:!0},capture_dead_clicks:!0,disable_session_recording:!1,disable_surveys:!1,disable_surveys_automatic_display:!1},su={...au,capture_exceptions:!1,capture_performance:!1,capture_dead_clicks:!1,disable_session_recording:!0,disable_surveys:!0,disable_surveys_automatic_display:!0},cu=`phc_Cvq8qwYzdJtVPYYJ1TdTpAzYjql4rJjRf1NWfjNh6Up`,lu;function uu(e,t){let n=lu===void 0&&i(e);if(lu===n)return;let r=n?su:ou;lu===void 0?Yl.init(t,r):Yl.set_config(r),lu=n}function du(e){globalThis.window&&(uu(window.location.pathname,cu),e.subscribe(`onBeforeNavigate`,e=>{i(e.toLocation.pathname)||uu(e.toLocation.pathname,cu)}))}var fu=new WeakSet;function pu(e,{source:t,context:n={}}){if(e instanceof Error&&$l(e.name,e.message)===`expected`){console.warn(`[${t}] Expected failure; not reported`,e,n);return}if(e instanceof Object){if(fu.has(e)){console.warn(`[${t}] Already reported; not reported again`,e,n);return}fu.add(e)}console.error(`[${t}] Unexpected error`,e,n);try{Yl.captureException(e,{...n,source:t,surface:`browser`,pathname:globalThis.location?.pathname})}catch{console.error(`[${t}] PostHog capture failed`)}}
3function mu(e,{source:t,message:n,context:r}){return pu(e,{source:t,context:r}),n}export{Yl as i,pu as n,du as r,mu as t}; 4//# chunkId=b2be95e1-0792-436c-85f4-7a4454b8e04c
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.