PageSourceSearch

https://www.medbridge.com/build/assets/t-DgZujj1e.js

js medbridge.com collected 2026-10-02 03:09:31 UTC 278,303 bytes, 3 lines download raw bytes

1import{t as e}from"./defineProperty-BbfpZ9Tg.js";import{d as t,i as n,l as r,o as i,r as a,t as o,u as s}from"./report-BxypIvH3.js";import{n as c,t as l}from"./toPostHog-LRWvoe1Z.js";import{n as u,t as d}from"./assertClassBrand-VHib6NTu.js";import{n as f,r as p,t as m}from"./classPrivateFieldSet2-VQALrk5E.js";var h=typeof window<`u`?window:void 0,g=typeof globalThis<`u`?globalThis:h,_=g==null?void 0:g.navigator,v=g==null?void 0:g.document,y=g==null?void 0:g.location,b=g==null?void 0:g.fetch,x=g!=null&&g.XMLHttpRequest&&`withCredentials`in new g.XMLHttpRequest?g.XMLHttpRequest:void 0,S=g==null?void 0:g.AbortController,C=g==null?void 0:g.CompressionStream,w=_==null?void 0:_.userAgent;function T(){return!(!h||!1===h.navigator.onLine)}var E=typeof globalThis<`u`?globalThis:h;E&&typeof self>`u`&&(E.self=E),E&&typeof File>`u`&&(E.File=function(){});var D=h==null?{}:h,O={DEBUG:!1,LIB_VERSION:`0.5.0`,LIB_NAME:`browser-common`};function ee(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 k(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){ee(a,r,i,o,s,`next`,e)}function s(e){ee(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function A(){return A=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},A.apply(null,arguments)}function j(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 te=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}};function ne(e){return typeof e==`string`||e}function re(e){return typeof e==`string`?e:void 0}var ie,ae=`$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(`.`),oe=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}({}),se=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),ce=[`$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`],le=[`token`],ue=`NativeGzipValidationError`,de=e=>e.length>=2&&e[0]===31&&e[1]===139,fe=(e,t)=>e===se.GZipJS||t===se.GZipJS||t===`gzip`,pe=e=>!(!e||typeof e!=`object`)&&(`name`in e?String(e.name):``)===`NotReadableError`,me=e=>
1{var t=Error(`Native gzip produced invalid output: `+e);throw t.name=ue,t},he=function(){var e=k((function*(e,t){18>e.size&&me(`too-short`);var n=new Uint8Array(yield e.slice(0,10).arrayBuffer());de(n)&&n[2]===8||me(`invalid-header`);var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(ie)return ie;ie=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?3988292384^t>>>1:t>>>1;ie[e]=t>>>0}return ie})(),n=4294967295,r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&me(`invalid-crc`);var i=t.length>>>0;r.getUint32(4,!0)!==i&&me(`invalid-size`)}));return function(t,n){return e.apply(this,arguments)}}();function ge(){return ge=k((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=k((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 he(c,r),c}catch(e){if(n!=null&&n.rethrow)throw e;return t&&console.error(`Failed to gzip compress data`,e),null}})),ge.apply(this,arguments)}var _e=20,ve=1e3,ye=1e4,be=`[Circular]`,xe=`[Truncated]`,Se=`[Unserializable]`,Ce=`[Function]`;function we(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 Te=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),Ee=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return Te.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))};function M(e,t){return e.indexOf(t)!==-1}var De=function(e){return e.trim()},Oe=function(e){return e.replace(/^\$/,``)};function ke(e){var t,n=[];return(t=JSON.stringify(e,(function(e,t){if(typeof t==`bigint`)return t.toString();if(typeof t!=`function`&&typeof t!=`symbol`){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&typeof t==`object`){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(t))return`[Circular]`;n.push(t)}return t}})))==null?`null`:t}var Ae=Object.prototype,je=Ae.hasOwnProperty,Me=Ae.toString,N=Array.isArray||function(e){return Me.call(e)===`[object Array]`},Ne=e=>typeof e==`function`,P=e=>e===Object(e)&&!N(e),Pe=e=>{if(P(e)){for(var t in e)if(je.call(e,t))return!1;return!0}return!1},F=e=>e===void 0,I=e=>Me.call(e)==`[object String]`,Fe=e=>I(e)&&e.trim().length===0,Ie=e=>e===null,L=e=>F(e)||Ie(e),R=e=>Me.call(e)==`[object Number]`&&e==e,Le=e=>R(e)&&e>0,Re=e=>Me.call(e)===`[object Boolean]`,ze=e=>e instanceof FormData,Be=e=>M(ce,e),Ve=e=>M(le,e);function He(e){return typeof e!=`object`||!e}function Ue(e,t){return{}.toString.call(e)===`[object `+t+`]`}function We(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 Ke(e,Error)}}function Ge(e){return typeof Event<`u`&&Ke(e,Event)}function Ke(e,t){try{return e instanceof t}catch{return!1}}var qe=[!0,`true`,1,`1`,`yes`],Je=e=>M(qe,e),Ye=[!1,`false`,0,`0`,`no`];function Xe(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),R(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),Xe(i||n,t,n,r))}var Ze=class{constructor(e){this.k={},this.S=e.S,this.C=Xe(e.bucketSize,0,100,e.I),this.R=Xe(e.refillRate,0,this.C,e.I),this.A=Xe(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={}}},Qe=`Mobile`,$e=`iOS`,et=`Android`,tt=`Tablet`,nt=et+` `+tt,rt=`iPad`,it=`Apple`,at=it+` Watch`,ot=`Safari`,st=`BlackBerry`,ct=`Samsung`,lt=ct+`Browser`,ut=ct+` Internet`,dt=`Chrome`,ft=dt+` OS`,pt=dt+` `+$e,mt=`Internet Explorer`,ht=mt+` `+Qe,gt=`Opera`,_t=gt+` Mini`,vt=`Edge`,yt=`Microsoft `+vt,bt=`Firefox`,xt=bt+` `+$e,St=`Nintendo`,Ct=`PlayStation`,wt=`Xbox`,Tt=et+` `+Qe,Et=Qe+` `+ot,Dt=`Windows`,Ot=Dt+` Phone`,kt=`Nokia`,At=`Ouya`,jt=`Generic`,Mt=jt+` `+Qe.toLowerCase(),Nt=jt+` `+tt.toLowerCase(),Pt=`Konqueror`,Ft=`Oculus Browser`,It=`Vivaldi`,Lt=`Yandex`,Rt=`Whale`,zt=`DuckDuckGo`,Bt=`Pale Moon`,Vt=`Waterfox`,Ht=`Brave`,Ut=`Google Search App`,z=`(\\d+(\\.\\d+)?)`,Wt=RegExp(`Version/`+z),Gt=new RegExp(wt,`i`),Kt=RegExp(Ct+` \\w+`,`i`),qt=RegExp(St+` \\w+`,`i`),Jt=RegExp(st+`|PlayBook|BB10`,`i`),Yt={"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`},Xt=function(e,t,n,r){return t=t||``,function(e){return e!=null&&e.brave?Ht:null}(n)||(r!=null&&r.detectGoogleSearchApp&&M(e,`GSA/`)?Ut:M(e,` OPR/`)&&M(e,`Mini`)?_t:M(e,` OPR/`)?gt:Jt.test(e)?st:M(e,`IE`+Qe)||M(e,`WPDesktop`)?ht:M(e,`OculusBrowser`)?Ft:M(e,lt)?ut:M(e,vt)||M(e,`Edg/`)?yt:M(e,It+`/`)?It:M(e,`YaBrowser/`)?Lt:M(e,Rt+`/`)?Rt:M(e,zt+`/`)||M(e,`Ddg/`)?zt:M(e,`FBIOS`)?`Facebook `+Qe:M(e,`UCWEB`)||M(e,`UCBrowser`)?`UC Browser`:M(e,`CriOS`)?pt:M(e,`CrMo`)||M(e,dt)?dt:M(e,et)&&M(e,ot)?Tt:M(e,`FxiOS`)?xt:M(e.toLowerCase(),Pt.toLowerCase())?Pt:M(e,Ht+`/`)?Ht:((e,t)=>t&&M(t,it)||function(e){return M(e,ot)&&!M(e,dt)&&!M(e,et)}(e))(e,t)?M(e,Qe)?Et:ot:M(e,`PaleMoon/`)?Bt:M(e,Vt+`/`)?Vt:M(e,bt)?bt:M(e,`MSIE`)||M(e,`Trident/`)?mt:M(e,`Gecko`)?bt:``)},Zt={[ht]:[RegExp(`rv:`+z)],[yt]:[RegExp(vt+`?\\/`+z)],[dt]:[RegExp(`(`+dt+`|CrMo)\\/`+z)],[pt]:[RegExp(`CriOS\\/`+z)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+z)],[ot]:[Wt],[Et]:[Wt],[gt]:[RegExp(`(Opera|OPR)\\/`+z)],[bt]:[RegExp(bt+`\\/`+z)],[xt]:[RegExp(`FxiOS\\/`+z)],[Pt]:[RegExp(`Konqueror[:/]?`+z,`i`)],[st]:[RegExp(st+` `+z),Wt],[Tt]:[RegExp(`android\\s`+z,`i`)],[ut]:[RegExp(lt+`\\/`+z)],[Ft]:[RegExp(`OculusBrowser\\/`+z)],[It]:[RegExp(It+`\\/`+z)],[Lt]:[RegExp(`YaBrowser\\/`+z)],[Rt]:[RegExp(Rt+`\\/`+z)],[Ht]:[RegExp(Ht+`\\/`+z)],[zt]:[RegExp(`(DuckDuckGo|Ddg)\\/`+z)],[Bt]:[RegExp(`PaleMoon\\/`+z)],[Vt]:[RegExp(Vt+`\\/`+z)],[Ut]:[RegExp(`GSA\\/`+z)],[mt]:[RegExp(`(rv:|MSIE )`+z)],Mozilla:[RegExp(`rv:`+z)]},Qt=function(e,t,n,r){var i=Zt[Xt(e,t,n,r)];if(F(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},$t=[[RegExp(wt+`; `+wt+` (.*?)[);]`,`i`),e=>[wt,e&&e[1]||``]],[new RegExp(St,`i`),[St,``]],[new RegExp(Ct,`i`),[Ct,``]],[Jt,[st,``]],[new RegExp(Dt,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ot,``];if(new RegExp(Qe).test(t)&&!/IEMobile\b/.test(t))return[Dt+` `+Qe,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=Yt[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[Dt,r]}return[Dt,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[$e,[e[3],e[4],e[5]||`0`].join(`.`)]:[$e,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=F(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+et+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+et+`)`,`i`),e=>e&&e[2]?[et,[e[2],e[3],e[4]||`0`].join(`.`)]:[et,``]],[/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/,[ft,``]],[/Linux|debian/i,[`Linux`,``]]],en=function(e){return qt.test(e)?St:Kt.test(e)?Ct:Gt.test(e)?wt:new RegExp(At,`i`).test(e)?At:Reg
1Exp(`(`+Ot+`|WPDesktop)`,`i`).test(e)?Ot:/iPad/.test(e)?rt:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?at:Jt.test(e)?st:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(kt,`i`).test(e)?kt:/(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(Qe).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)?et:nt:RegExp(`(pda|`+Qe+`)`,`i`).test(e)?Mt:new RegExp(tt,`i`).test(e)&&!RegExp(tt+` pc`,`i`).test(e)?Nt:``},tn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function nn(e,t){return typeof(n=e)==`string`&&tn.test(n)?e:t();var n}function rn(e){return e&&e.split(`#`)[0]}function an(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}function on(e,t,n){return sn.apply(this,arguments)}function sn(){return(sn=k((function*(e,t,n){var r;try{return yield Promise.race([e,new Promise(((e,i)=>{r=an((()=>{try{n==null||n(),e()}catch(e){i(e)}}),t)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var cn={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}},ln=cn.info,un=0x8000000000000000,dn={}.propertyIsEnumerable;function fn(e,t){try{return hn(e,t,{ancestors:new WeakSet,remainingNodes:ye},0)}catch{return[]}}function pn(e,t,n,r){if(0>=n.remainingNodes)return{stringValue:xe};if(n.remainingNodes--,Re(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>=un||-un>e?(t==null||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:we(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:be};if(r>=_e)return{stringValue:xe};if(e instanceof Date){var a=e.getTime(),o=Number.isFinite(a)?e.toISOString():String(e);return{stringValue:typeof o==`string`?we(o):String(o)}}n.ancestors.add(e);try{try{var s=e.toJSON;if(typeof s==`function`)return pn(s.call(e),t,n,r+1)}catch{}return N(e)?{arrayValue:{values:mn(e,t,n,r+1)}}:{kvlistValue:{values:hn(e,t,n,r+1)}}}finally{n.ancestors.delete(e)}}return{stringValue:we(String(e))}}function mn(e,t,n,r){for(var i=[],a=Math.min(e.length,ve),o=0;a>o&&n.remainingNodes>0;o++)try{var s=o in e?e[o]:void 0;if(L(s))continue;i.push(pn(s,t,n,r))}catch{i.push({stringValue:Se})}return e.length>o&&i.push({stringValue:xe}),i}function hn(e,t,n,r){var i=[];for(var a in e)if(dn.call(e,a)){if(i.length>=ve||0>=n.remainingNodes){t==null||t.debug(`Attributes truncated: the value exceeds the OTLP encoder budget`);break}try{var o=e[a];if(Ie(o)||F(o))continue;i.push({key:we(a),value:pn(o,t,n,r)})}catch{i.push({key:we(a),value:{stringValue:Se}})}}return i}function gn(e){try{return we(String(e))}catch{return Se}}function _n(e,t,n){var r=cn[e.level||`info`]||ln,i=r.text,a=r.number,o=String(Date.now())+`000000`,s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s[`window.id`]=t.windowId),L(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),L(t.lastActivityTimestamp)||(s.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(s[`url.full`]=t.currentUrl),t.screenName&&(s[`screen.name`]=t.screenName),t.appState&&(s[`app.state`]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(s.feature_flags=t.activeFeatureFlags);var c=A({},s),l=e.attributes;if(l){var u=[];try{u=Object.keys(l)}catch{u=[]}for(var d of u){var f=void 0;try{f=l[d]}catch{f=Se}Object.defineProperty(c,d,{value:f,enumerable:!0,writable:!0,configurable:!0})}}var p={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:gn(e.body)},attributes:fn(c,n)};return e.trace_id&&(p.traceId=e.trace_id),e.span_id&&(p.spanId=e.span_id),F(e.trace_flags)||(p.flags=e.trace_flags),p}
1function vn(e,t,n){return A({},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 yn(e,t,n,r){return{resourceLogs:[{resource:{attributes:fn(t)},scopeLogs:[{scope:{name:n,version:r},logRecords:e}]}]}}var bn=class{constructor(e,t,n,r,i,a,o){var s;a===void 0&&(a=()=>Promise.resolve()),this._instance=e,this.Oi=t,this.I=n,this.Ji=r,this.Ki=i,this.Xi=a,this.tn=o,this.en=null,this.rn=0,this.nn=0,this.sn=0,this.an=0,this.ln=!1,this.un=t.maxBufferSize,this.hn=Math.max((s=t.maxQueueSize)==null?t.maxBufferSize:s,t.maxBufferSize),this.dn=t.flushIntervalMs,this.vn=t.maxBatchRecordsPerPost,this.cn=t.rateCapWindowMs,this.fn=t.maxLogsPerInterval}reset(){this.pn(),this.en=null,this.sn=0,this.an=0,this.ln=!1,this.rn=0,this.nn=0,this.vn=this.Oi.maxBatchRecordsPerPost}onReconnect(){this.nn=0,this.gn()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.mn(e);if(t!==null){if(t.body){if(this.yn()){var n={record:_n(t,this.Ji(),this.I)};this.Ki((()=>this.bn(n)))}}else this.I.info(`Log was rejected in beforeSend function`)}}}mn(e){var t=this.Oi.beforeSend;if(!t)return e;var n=N(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}yn(){if(this.fn===void 0)return!0;var e=Date.now(),t=e-this.sn;return this.cn>t&&t>=0||(this.sn=e,this.an=0,this.ln=!1),this.fn>this.an?(this.an++,!0):(this.ln||(this.I.warn(`captureLog dropping logs: exceeded `+this.fn+` logs per `+this.cn+`ms`),this.ln=!0),!1)}flush(){var e=this;return k((function*(){if(!e._instance.isDisabled)return e.en||(e.en=e._n().finally((()=>{e.en=null}))),e.en}))()}_n(){var e=this;return k((function*(){var t;e.pn();var n=(t=e._instance.getPersistedProperty(oe.LogsQueue))==null?[]:t;if(n.length!==0)for(var r=n.length,i=0;n.length>0&&r>i;){var a,o;e.rn=0;var s=Math.min(n.length,e.vn),c=n.slice(0,s),l=yn(c.map((e=>e.record)),e.wn(),(a=e.tn)==null?e._instance.getLibraryId():a,e._instance.getLibraryVersion()),u=yield e._instance.kn(l);if(u.kind===`too-large`&&c.length>1)e.vn=Math.max(1,Math.floor(c.length/2)),e.I.warn(`Received 413 when sending logs batch of size `+c.length+`, reducing batch size to `+e.vn);else if(u.kind===`retry-later`||(u.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.`):u.kind===`ok`&&e.Oi.maxBatchRecordsPerPost>e.vn&&(e.vn=Math.min(e.Oi.maxBatchRecordsPerPost,e.vn+1)),yield e.Sn(c.length),n=(o=e._instance.getPersistedProperty(oe.LogsQueue))==null?[]:o,i+=c.length,u.kind===`fatal`))throw u.error}}))()}Sn(e){var t=this;return k((function*(){var n,r=Math.max(0,e-t.rn),i=(n=t._instance.getPersistedProperty(oe.LogsQueue))==null?[]:n;t._instance.setPersistedProperty(oe.LogsQueue,i.slice(r)),yield t.Xi()}))()}wn(){return vn(this.Oi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}bn(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(oe.LogsQueue))==null?[]:t;this.hn>n.length||(n.shift(),this.rn++,this.I.info(`Logs queue is full, dropping oldest record.`)),n.push(e),this._instance.setPersistedProperty(oe.LogsQueue,n),this.un>n.length?this.xn():this.gn()}}xn(e){e===void 0&&(e=this.dn),this.Cn||(this.Cn=an((()=>{this.Cn=void 0,this.gn()}),e))}Tn(){var e=Math.min(Math.max(0,this.nn-1),6);return this.dn*2**e}Mn(){var e=this._instance.getPersistedProperty(oe.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return k((function*(){t.pn();var n=t.flush().catch((()=>{}));e===void 0?yield n:yield on(n,e)}))()}flushWithTimeout(e){var t=this;return k((function*(){var n=t.flush();yield on(n,e,(()=>{n.catch((()=>{}))}))}))()}gn(){this.flush().then((()=>{this.nn=0}),(e=>{this.nn++,this.I.error(`PostHog logs flush failed:`,e)})).finally((()=>{!this._instance.isDisabled&&this.Mn()&&this.xn(this.Tn())}))}pn(){this.Cn&&(clearTimeout(this.Cn),this.Cn=void 0)}},xn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Sn(e){return String(e)+`000000`}function Cn(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==null?``:n)+`\0`+i}
1var wn=class{constructor(e,t,n){this._instance=e,this.Oi=t,this.I=n,this.En=new Map,this.en=null,this.In=!1,this.Rn=new Map,this.Pn=new Set,this.An=0}count(e,t,n){t===void 0&&(t=1),this.Fn({name:e,type:`count`,value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Fn({name:e,type:`gauge`,value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Fn({name:e,type:`histogram`,value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.en,n=function(){var n=k((function*(){t&&(yield t.catch((()=>{}))),yield e.On()}));return function(){return n.apply(this,arguments)}}()().finally((()=>{this.en===n&&(this.en=null)}));return this.en=n,n}drainWindow(){if(this.En.size===0)return null;var e=this.En;return this.En=new Map,this.In=!1,this.Rn=new Map,this.Pn=new Set,this.Ln(e)}reset(){this.An++,this.pn(),this.En=new Map,this.en=null,this.In=!1,this.Rn=new Map,this.Pn=new Set}Fn(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.mn(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?A({},t.attributes):void 0,r=Cn(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.En.get(r);if(!i){if(!this.$n())return;i={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.En.set(r,i)}var a=this.Rn.get(t.name);a===void 0?this.Rn.set(t.name,t.type):a===t.type||this.Pn.has(t.name)||(this.Pn.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.Dn(i,t.value),this.xn()}}else this.I.warn(`Dropping metric '`+t.name+`': value must be a finite number`)}else this.I.warn(`Dropping metric with empty name`)}}}$n(){return this.Oi.maxSeriesPerFlush>this.En.size||(this.In||(this.In=!0,this.I.warn(`Metric series cap reached (`+this.Oi.maxSeriesPerFlush+` per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Dn(e,t){var n;switch(e.type){case`count`:e.total=((n=e.total)==null?0:n)+t;break;case`gauge`:e.last=t;break;case`histogram`:e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(xn.length+1).fill(0)});var r=e.hist;r.count+=1,r.sum+=t,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.bucketCounts[function(e,t){for(var n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}(t,xn)]+=1}}mn(e){var t=this.Oi.beforeSend;if(!t)return e;var n=N(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}xn(){this.Cn||(this.Cn=an((()=>{this.Cn=void 0,this.flush().catch((e=>{this.I.error(`Metrics flush failed:`,e)}))}),this.Oi.flushIntervalMs))}pn(){this.Cn&&(clearTimeout(this.Cn),this.Cn=void 0)}On(){var e=this;return k((function*(){if(e.En.size!==0){var t=e.En;e.En=new Map,e.In=!1,e.Rn=new Map,e.Pn=new Set;var n=e.An,r=yield e._instance.Nn(e.Ln(t));if(n===e.An)switch(r.kind){case`ok`:return;case`retry-later`:e.qn(t),e.xn();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}}}))()}Ln(e){return t=this.jn(e),n=function(e,t,n){return A({},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.Oi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:fn(n)},scopeMetrics:[{scope:{name:r,version:i},metrics:t}]}]};var t,n,r,i}jn(e){var t=Sn(Date.now()),n=new Map;for(var r of e.values()){var i,a=Cn(r.type,r.name,r.unit,void 0),o=n.get(a);o||(o=A({name:r.name},r.unit&&{unit:r.unit}),r.type===`count`?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:r.type===`gauge`?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},n.set(a,o));var s=fn((i=r.attributes)==null?{}:i,this.I),c=Sn(r.windowStartMs);if(r.type===`count`){var l,u={attributes:s,startTimeUnixNano:c,timeUnixNano:t,asDouble:(l=r.total)==null?0:l};o.sum.dataPoints.push(u)}else if(r.type===`gauge`){var d,f={attributes:s,timeUnixNano:t,asDouble:(d=r.last)==null?0:d};o.gauge.dataPoints.push(f)}else r.hist&&o.histogram.dataPoints.push({attributes:s,startTimeUnixNano:c,timeUnixNano:t,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:xn})}return Array.from(n.values())}qn(e){var t,n;for(var r of e){var i=r[0],a=r[1],o=this.En.get(i);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,a.windowStartMs),o.type){case`count`:o.total=((t=o.total)==null?0:t)+((n=a.total)==null?0:n);break;case`gauge`:break;case`histogram`:if(a.hist){if(o.hist){o.hist.count+=a.hist.count,o.hist.sum+=a.hist.sum,o.hist.min=Math.min(o.hist.min,a.hist.min),o.hist.max=Math.max(o.hist.max,a.hist.max);for(var s=0;o.hist.bucketCounts.length>s;s++)o.hist.bucketCounts[s]+=a.hist.bucketCounts[s]}else o.hist=a.hist}}else this.$n()&&this.En.set(i,a)}}},Tn,En,Dn;function On(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return Dn&&n.length===En||(En=n.length,Dn=n.reduce(((n,r)=>{Tn||(Tn={});var i=Tn[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],c=s==null?void 0:s.filename,l=t[r];if(c&&l){n[c]=l,Tn[r]=[c,l];break}}return n}),{})),Dn}}var kn=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 k((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&N(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:`Error`,value:`Unknown error`,stack:(t=e.syntheticException)==null?void 0:t.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.ski
1pFirstLines:0),t.chunkIdMap)),A({},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 k((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i,a={type:e.type,value:e.value,mechanism:{type:(n=t.type)==null?`generic`:n,handled:(r=t.handled)==null||r,synthetic:(i=e.synthetic)!=null&&i}};e.stack&&(a.stacktrace={type:`raw`,frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,A({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:On(this.stackParser),skipFirstLines:(t=e.skipFirstLines)==null?1:t}}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 A({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},An=`?`;function jn(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?An:n,in_app:!(t!=null&&t.startsWith(`webkit-masked-url://`))&&t!==`<anonymous>`};return F(r)||(a.lineno=r),F(i)||(a.colno=i),a}var Mn=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?An:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},Nn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Pn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fn=/\((\S*)(?::(\d+))(?::(\d+))\)/,In=(e,t)=>{var n=Nn.exec(e);if(n)return jn(t,n[1],An,+n[2],+n[3]);var r=Pn.exec(e);if(r){if(r[2]&&r[2].indexOf(`eval`)===0){var i=Fn.exec(r[2]);i&&(r[2]=i[1],r[3]=i[2],r[4]=i[3])}var a=Mn(r[1]||An,r[2]);return jn(t,a[1],a[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ln=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zn=(e,t)=>{var n=Ln.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=Rn.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]||An,o=Mn(a,i);return jn(t,i=o[1],a=o[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Bn=/\(error: (.*)\)/,Vn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=I(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 Ue(e,`DOMException`)}isDOMError(e){return Ue(e,`DOMError`)}},Hn=class{match(e){return We(e)}coerce(e,t){var n,r=this.getStack(e),i=r===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:r==null?(n=t.syntheticException)==null?void 0:n.stack:r,cause:e.cause?t.next(e.cause):void 0,synthetic:i}}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}},Un=class{constructor(){}match(e){return!!Ue(e,`ErrorEvent`)&&(e.error!=null||this.li(e))}coerce(e,t){var n;if(e.error!=null)return t.apply(e.error);var r=t.apply(e.message);return A({},r,{stack:(n=this.hi(e))==null?r.stack:n,synthetic:!0})}li(e){return I(e.message)&&e.message.length>0}hi(e){var t,n,r=e,i=(t=r.lineno)==null?0:t,a=(n=r.colno)==null?0:n;if(I(r.filename)&&r.filename.length!==0&&i!==0)return`Error
2    at `+r.filename+`:`+i+`:`+a}},Wn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Gn=class{match(e){return typeof e==`string`}coerce(e,t){var n,r=this.getInfos(e),i=r[0],a=r[1];return{type:i==null?`Error`:i,value:a==null?e:a,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Wn);return r&&(t=r[1],n=r[2]),[t,n]}},Kn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];
2function qn(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 Jn=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n,r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(n=this.getStack(e))==null?(r=t.syntheticException)==null?void 0:r.stack:n,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){if(Ge(e))return e.constructor.name;var t=`name`in e?e.name:void 0;return I(t)&&!Fe(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: `+qn(e)}isSeverityLevel(e){return I(e)&&!Fe(e)&&Kn.indexOf(e)>=0}getStack(e){try{return I(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:I(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(We(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Yn=class{match(e){return Ge(e)}coerce(e,t){var n,r=e.constructor.name;return{type:r,value:r+` captured as exception with keys: `+qn(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Xn=class{match(e){return He(e)}coerce(e,t){var n;return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Zn=class{match(e){return Ue(e,`PromiseRejectionEvent`)||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ge(e))return!1;try{var t=e.detail;return typeof t==`object`&&!!t&&`reason`in t}catch{return!1}}coerce(e,t){var n,r=this.getUnhandledRejectionReason(e);return He(r)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(r),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}:t.apply(r)}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}},Qn=`$message`,$n=`$timestamp`,er=new Set([Qn,$n]),tr={enabled:!0,max_bytes:32768};function nr(e){var t;return e?{enabled:(t=e.enabled)==null?tr.enabled:t,max_bytes:ir(e.max_bytes,tr.max_bytes)}:A({},tr)}
2var rr=class{constructor(e){this.Bn=[],this.Hn=0,this.Oi=nr(e)}setConfig(e){this.Oi=nr(e),this.zn()}add(e){var t=function(e){var t;try{t=ke(e)}catch{return}try{var n=JSON.parse(t);if(!P(n))return;var r=n,i=r[Qn],a=r[$n];return!I(i)||i.trim().length===0||!I(a)&&!R(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.Oi.max_bytes||(this.Bn.push({step:t.step,bytes:n}),this.Hn+=n,this.zn())}}getAttachable(){return this.Bn.map((e=>e.step))}clear(){this.Bn=[],this.Hn=0}size(){return this.Bn.length}zn(){for(;this.Hn>this.Oi.max_bytes&&this.Bn.length>0;){var e=this.Bn.shift();e&&(this.Hn-=e.bytes)}}};function ir(e,t){if(!R(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var ar=function(e,t){var n=(t===void 0?{}:t).debugEnabled,r={F(t){if(h&&(O.DEBUG||h.POSTHOG_DEBUG||n)&&!F(h.console)&&h.console){for(var r=(`__rrweb_original__`in h.console[t])?h.console[t].__rrweb_original__:h.console[t],i=arguments.length,a=Array(i>1?i-1:0),o=1;i>o;o++)a[o-1]=arguments[o];r(e,...a)}},debug(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.F(`debug`,...t)},info(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.F(`log`,...t)},warn(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.F(`warn`,...t)},error(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];r.F(`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)=>ar(e+` `+t,n)};return r},B=ar(`[PostHog.js]`),V=B.createLogger,or=V(`[ExternalScriptsLoader]`),sr=e=>{var t=v==null?void 0:v.querySelectorAll(`script`);if(t){for(var n=0;t.length>n;n++)if(t[n].src===e)return t[n]}},cr=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return or.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=sr(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(!v)return n(`document not found`);if(sr(t))return cr(e,t,n);var r=v.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`)v.head.appendChild(r);else{var i,a=v.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):v.body.appendChild(r)}};v!=null&&v.body?a():v==null||v.addEventListener(`DOMContentLoaded`,a)},lr={},ur=(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)};D.__PosthogExtensions__=D.__PosthogExtensions__||{},D.__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=lr[i];if(r===`fallback`&&a){if(sr(a))return void cr(e,a,n);delete lr[i]}cr(e,i,r===`fallback`?(r,a)=>{if(r){if(typeof r==`string`)n(r);else{var o,s=ur(e,t);lr[i]=s;var c=sr(i);c==null||(o=c.parentNode)==null||o.removeChild(c),cr(e,s,n)}}else n(void 0,a)}:n)}else cr(e,ur(e,t),n)}else cr(e,e.requestRouter.endpointFor(`assets`,`/array/`+e.config.token+`/config.js`),n)},D.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{cr(e,e.requestRouter.endpointFor(`api`,t),n)},O.DEBUG=!1,O.LIB_VERSION=`1.418.10`,O.LIB_NAME=`web`;var dr=`$people_distinct_id`,fr=`distinct_id`,pr=`$device_id`,mr=`$device_model`,hr=`__alias`,gr=`__timers`,_r=`$autocapture_disabled_server_side`,vr=`$heatmaps_enabled_server_side`,yr=`$exception_capture_enabled_server_side`,br=`$error_tracking_suppression_rules`,xr=`$error_tracking_capture_extension_exceptions`,Sr=`$web_vitals_enabled_server_side`,Cr=`$dead_clicks_enabled_server_side`,wr=`$product_tours_enabled_server_side`,Tr=`$web_vitals_allowed_metrics`,Er=`$session_recording_remote_config`,Dr=`$replay_sample_rate`,Or=`$replay_override_sampling`,kr=`$replay_override_linked_flag`,Ar=`$replay_override_url_trigger`,jr=`$replay_override_event_trigger`,Mr=`$sesid`,Nr=`$session_is_sampled`,Pr=`$enabled_feature_flags`,Fr=`$active_feature_flags`,Ir=`$early_access_features`,Lr=`$feature_flag_details`,Rr=`$feature_flag_payloads`,zr=`$feature_flag_request_id`,Br=`$minimal_flag_called_events`,Vr=`$override_feature_flags`,Hr=`$override_feature_flag_payloads`,Ur=`$stored_person_properties`,Wr=`$stored_group_properties`,Gr=`$groups`,Kr=`$surveys`,qr=`$surveys_loaded_at`,Jr=`$surveys_activated`,Yr=`$surveys_activated_session`,Xr=`$surveys_activated_timestamps`,Zr=`ph_product_tours`,Qr=`$flag_call_reported`,$r=`$flag_call_reported_session_id`,ei=`$feature_flag_errors`,ti=`$feature_flag_evaluated_at`,H=`$user_state`,ni=`$client_session_props`,ri=`$capture_rate_limit`,ii=`$initial_campaign_params`,ai=`$initial_referrer_info`,oi=`$initial_person_info`,si=`$epp`,ci=`$posthog_cookieless`,li=`$cookieless_mode`,ui=`$sdk_debug_extensions_init_method`,di=`$s
2dk_debug_extensions_init_time_ms`,fi=`$sdk_debug_recording_script_not_loaded`,pi=`PostHog loadExternalDependency extension not found.`,mi=`on_reject`,hi=`always`,U=`anonymous`,gi=`identified`,_i=`identified_only`,vi=`visibilitychange`,yi=`beforeunload`,bi=`$pageview`,xi=`$pageleave`,Si=`$identify`,Ci=`$groupidentify`;function wi(e,t){N(e)&&e.forEach(t)}function W(e,t){if(!L(e)){if(N(e))e.forEach(t);else if(ze(e))e.forEach(((e,n)=>t(e,n)));else for(var n in e)je.call(e,n)&&t(e[n],n)}}var G=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 Ti(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Ei=function(e){try{return e()}catch{return}},Di=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)}}},Oi=function(e){var t={};return W(e,(function(e,n){(I(e)&&e.length>0||R(e))&&(t[n]=e)})),t},ki=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Ai(e){var t=e==null?void 0:e.hostname;if(!I(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of ki)if(n===r)return!1;return!0}function K(e,t,n,r){var i=r==null?{}:r,a=i.capture,o=i.passive;e==null||e.addEventListener(t,n,{capture:a!==void 0&&a,passive:o===void 0||o})}function ji(e){return e.name===`ph_toolbar_internal`}var Mi=e=>{if(v){try{for(var t=e+`=`,n=v.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 R(e)&&isFinite(e)&&Math.floor(e)===e});var Ni=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+=`-`);if(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}},Pi=class{generate(){var e=this.generateOrAbort();if(!F(e))return e;this.Tr=0;var t=this.generateOrAbort();if(F(t))throw Error(`Could not generate UUID after timestamp reset`);return t}generateOrAbort(){var e=Date.now();if(e>this.Tr)this.Tr=e,this.Ir();else{if(this.Tr>=e+1e4)return;this.Er++,this.Er>4398046511103&&(this.Tr++,this.Ir())}return Ni.fromFieldsV7(this.Tr,Math.trunc(this.Er/2**30),this.Er&2**30-1,this.Rr.nextUint32())}Ir(){this.Er=1024*this.Rr.nextUint32()+(1023&this.Rr.nextUint32())}constructor(){this.Tr=0,this.Er=0,this.Rr=new Li}},Fi,Ii=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};h&&!F(h.crypto)&&crypto.getRandomValues&&(Ii=e=>crypto.getRandomValues(e));var Li=class{nextUint32(){return this.ft.length>this.Ar||(Ii(this.ft),this.Ar=0),this.ft[this.Ar++]}constructor(){this.ft=new Uint32Array(8),this.Ar=1/0}},Ri=()=>zi().toString(),zi=()=>(Fi||(Fi=new Pi)).generate(),Bi=``,Vi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,q={Lr:()=>!!v,Nr(e){B.error(`cookieStore error: `+e)},Fr:Mi,Pr(e){var t;try{t=JSON.parse(q.Fr(e))||{}}catch{}return t},Or(e,t,n,r,i){if(!v)return!1;try{var a=``,o=``,s=function(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=v),Bi)return Bi;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Ri();!Bi&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;
2t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,Bi=a)}return Bi}(e);if(!n){var r=(e=>{var t=e.match(Vi);return t?t[0]:``})(e);r!==n&&B.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}(v.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+864e5*n),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&B.warn(`cookieStore warning: large cookie, len=`+l.length),v.cookie=l,!0}catch{return!1}},Dr(e,t){if(v!=null&&v.cookie)try{q.Or(e,``,-1,t)}catch{return}}},Hi=null,J={Lr(){if(!Ie(Hi))return Hi;var e=!0;if(F(h))e=!1;else try{var t=`__mplssupport__`;J.Or(t,`xyz`),J.Fr(t)!==`"xyz"`&&(e=!1),J.Dr(t)}catch{e=!1}return e||B.error(`localStorage unsupported; falling back to cookie store`),Hi=e,e},Nr(e){B.error(`localStorage error: `+e)},Fr(e){try{return h==null?void 0:h.localStorage.getItem(e)}catch(e){J.Nr(e)}return null},Pr(e){try{return JSON.parse(J.Fr(e))||{}}catch{}return null},Or(e,t){try{return h==null||h.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){J.Nr(e)}return!1},Dr(e){try{h==null||h.localStorage.removeItem(e)}catch(e){J.Nr(e)}}},Ui=[Ur,Fr,Pr,Lr,Rr,zr,ti,ei,Qr],Wi=[pr,fr,Mr,Nr,si,oi,H],Gi=e=>e+`_cpm`,Ki=[`__proto__`,`constructor`,`prototype`],qi=e=>{if(!P(e))return{};var t={};return Object.keys(e).forEach((n=>{Ki.indexOf(n)===-1&&(t[n]=e[n])})),t},Ji=function(e,t){t===void 0&&(t=[]);var n={};return[...Wi,...t].forEach((t=>{var r=e[t];F(r)||Ie(r)||r===``||(n[t]=r)})),n},Yi=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)},Xi=(e,t)=>({p:t,f:Yi(JSON.stringify(e))}),Zi=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var n=q.Pr(Gi(e)),r=(n==null?void 0:n.f)===Yi(t)&&N(n.p);return{properties:r?n.p:[],isValid:r}}catch{return{properties:[],isValid:!1}}},Qi=(e,t)=>t+`|`+(q.Fr(Gi(e))||``),$i={},ea={Lr:()=>!0,Nr(e){B.error(`memoryStorage error: `+e)},Fr:e=>$i[e]||null,Pr:e=>$i[e]||null,Or:(e,t)=>($i[e]=t,!0),Dr(e){delete $i[e]}},ta=null,Y={Lr(){if(!Ie(ta))return ta;if(ta=!0,F(h))ta=!1;else try{var e=`__support__`;Y.Or(e,`xyz`),Y.Fr(e)!==`"xyz"`&&(ta=!1),Y.Dr(e)}catch{ta=!1}return ta},Nr(e){B.error(`sessionStorage error: `,e)},Fr(e){try{return h==null?void 0:h.sessionStorage.getItem(e)}catch(e){Y.Nr(e)}return null},Pr(e){try{return JSON.parse(Y.Fr(e))||null}catch{}return null},Or(e,t){try{return h==null||h.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Y.Nr(e)}return!1},Dr(e){try{h==null||h.sessionStorage.removeItem(e)}catch(e){Y.Nr(e)}}},na=class{constructor(e){this._instance=e}get Oi(){return this._instance.config}get consent(){return this.Un()?0:this.Wn}isOptedOut(){return this.Oi.cookieless_mode===hi||this.isRejected()||this.consent===-1&&this.Oi.cookieless_mode===mi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Oi.opt_out_capturing_by_default}optInOut(e){this.Vn.Or(this.Gn,+!!e,this.Oi.cookie_expiration,this.Oi.cross_subdomain_cookie,this.Oi.secure_cookie)}reset(){this.Vn.Dr(this.Gn,this.Oi.cross_subdomain_cookie)}get Gn(){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 Wn(){var e=this.Vn.Fr(this.Gn);return Je(e)?1:M(Ye,e)?0:-1}get Vn(){var e=this.Oi.opt_out_capturing_persistence_type,t=e===`localStorage`?J:q;if(!this.Zn||this.Zn!==t){this.Zn=t;var n=e===`localStorage`?q:J;n.Fr(this.Gn)&&(this.Zn.Fr(this.Gn)||this.optInOut(Je(n.Fr(this.Gn))),n.Dr(this.Gn,this.Oi.cross_subdomain_cookie))}return this.Zn}Un(){return!!this.Oi.respect_dnt&&[_==null?void 0:_.doNotTrack,_==null?void 0:_.msDoNotTrack,D.doNotTrack].some((e=>Je(e)))}};function ra(e,t){var n,r=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Ne(r))return t;try{var i=r(t);return I(i)&&i?i:t}catch(e){return B.error(`Error in get_current_url, falling back to window.location.href`,e),t}}var ia=`__POSTHOG_TOOLBAR__`,aa=1,oa=3,sa=11;function ca(e){return e instanceof Element&&(e.id===ia||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function la(e){return!!e&&e.nodeType===aa}function ua(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function da(e){return!!e&&e.nodeType===oa}function fa(e){return!!e&&e.nodeType===sa&&la(e.host)}var pa=1e3;function ma(e){return e?De(e).split(/\s+/):[]}function ha(e,t){var n=function(e){var t,n=h==null||(t=h.location)==null?void 0:t.href;return F(n)?void 0:ra(e,n)}(t);return!!(n&&e&&e.some((e=>n.match(e))))}function ga(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 ma(t)}function _a(e){return L(e)?null:De(e).split(/(\s+)/).filter((e=>Va(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function va(e){var t=``;return Ma(e)&&!Na(e)&&e.childNodes&&e.childNodes.length&&W(e.childNodes,(function(e){var n;da(e)&&e.textContent&&(t+=(n=_a(e.textContent))==null?``:n)})),De(t)}function ya(e){var t;return F(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var ba=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function xa(e,t){if(F(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 Sa(e){var t=e.parentNode;return!(!t||!la(t))&&t}var Ca=[`.ph-no-autocapture`,`[data-ph-no-autocapture]`],wa=[`next`,`previous`,`prev`,`>`,`<`],Ta=[...wa,`+`,`-`,`−`,`–`],Ea=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Da=[`.ph-no-rageclick`,`.ph-no-capture`],Oa=[``,`text`,`search`,`email`,`password`,`url`,`tel`,`number`];function ka(e,t){if(!h||Aa(e))return!1;var n,r,i,a,o;if(Re(t)?(n=!!t&&Da,r=void 0,i=!1):(n=(a=t==null?void 0:t.css_selector_ignorelist)==null?Da:a,r=t==null?void 0:t.content_ignorelist,i=(o=t==null?void 0:t.ignore_text_selection)!=null&&o),!1===n||i&&function(e){return!(!e||!la(e))&&(!!ua(e,`textarea`)||(ua(e,`input`)?M(Oa,(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=ja(e,!1).targetElementList;return!function(e,t){if(!1===e||F(e))return!1;var n;if(!0===e)n=wa;else{if(!N(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=>Ea(t,e)||Ea(r,e)))}))}(r,s.map((e=>{var t;return{safeText:va(e).toLowerCase(),ariaLabel:((t=e.getAttribute(`aria-label`))==null?void 0:t.toLowerCase().trim())||``}})))&&!xa(s,n)}var Aa=e=>!e||ua(e,`html`)||!la(e),ja=(e,t)=>{if(!h||Aa(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!ua(i,`body`);)if(fa(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var a=Sa(i);if(!a)break;if(t||ba.indexOf(a.tagName.toLowerCase())>-1)n=!0;else try{var o=h.getComputedStyle(a);o&&o.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}catch{}r.push(a),i=a}return{parentIsUsefulElement:n,targetElementList:r}};function Ma(e){for(var t=new Set,n=0,r=e;r.parentNode&&!ua(r,`body`);r=r.parentNode){if(n++>=pa||t.has(r))return!1;t.add(r);var i=ga(r);if(M(i,`ph-sensitive`)||M(i,`ph-no-capture`))return!1}if(M(ga(e),`ph-include`))return!0;var a=e.type||``;if(I(a))switch(a.toLowerCase()){case`hidden`:case`password`:return!1}
2var o=e.name||e.id||``;return!I(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 Na(e){return!!(ua(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||ua(e,`select`)||ua(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var Pa=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}))$`),Fa=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ia=[16,15,14,13],La=RegExp(`^(\\d{3}-?\\d{2}-?\\d{4})$`),Ra=RegExp(`(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))`,`g`),za=/[0-9A-Za-z_]/;function Ba(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 Va(e,t){return t===void 0&&(t=!0),!(L(e)||I(e)&&(e=De(e),(t?Pa.test((e||``).replace(/[- ]/g,``)):function(e){var t;for(Fa.lastIndex=0;t=Fa.exec(e);){var n=t[2];if(n)for(var r=n.replace(/[- ]/g,``),i=0;r.length>i;i++)for(var a of Ia){var o=i+a;if(r.length>=o){var s=r.slice(i,o);if(Pa.test(s)&&Ba(s))return!0}}}return!1}(e))||(t?La.test(e):function(e){var t;for(Ra.lastIndex=0;t=Ra.exec(e);){var n=t[1],r=t[3];if(!(n&&r&&za.test(n)&&za.test(r)))return!0}return!1}(e))))}function Ha(e){var t=va(e);return Va(t=(t+` `+Ua(e)).trim())?t:``}function Ua(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&W(e.childNodes,(function(e){var n;if(e&&((n=e.tagName)==null?void 0:n.toLowerCase())===`span`)try{var r=va(e);t=(t+` `+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+Ua(e)).trim())}catch(e){B.error(`[AutoCapture]`,e)}})),t}function Wa(e){return e.replace(/"|\\"/g,`\\"`)}function Ga(e){var t=e.attr__class;if(t)return N(t)?t:ma(t)}var Ka=V(`[Dead Clicks]`),qa=()=>!0,Ja=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(Cr)),r=e.instance.config.capture_dead_clicks;return Re(r)?r:!!P(r)||n},Ya=class{get lazyLoadedDeadClicksAutocapture(){return this.Qn}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({[Cr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Jn((()=>{this.Kn()})):this.stop()}Jn(e){var t,n;(t=D.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture?e():(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Ka.error(`failed to load script`,t):e()}))}Kn(){var e;if(v){if(!this.Qn&&(e=D.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=P(this.instance.config.capture_dead_clicks)?A({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Qn=D.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Qn.start(v),Ka.info(`starting...`)}}else Ka.error("`document` not found. Cannot start.")}stop(){this.Qn&&(this.Qn.stop(),this.Qn=void 0,Ka.info(`stopping...`))}},Xa=V(`[SegmentIntegration]`),Za=`posthog-js`;function Qa(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=>{var n,o,c,u,d;if(s!==`*`&&!s.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var f=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=f,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var p,m=((n=t.exception)==null?void 0:n.values)||[],h=m.map((e=>A({},e,{stacktrace:e.stacktrace?A({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>A({},e,{platform:`web:javascript`})))}):void 0}))),g={$exception_message:((o=m[0])==null?void 0:o.value)||t.message,$exception_type:(c=m[0])==null?void 0:c.type,$exception_level:t.level,$exception_list:h,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:((u=m[0])==null?void 0:u.value)||t.message,$sentry_exception_type:(d=m[0])==null?void 0:d.type,$sentry_tags:t.tags};return r&&i&&(g.$sentry_url=(a||`https://sentry.io/organizations/`)+r+`/issues/?project=`+i+`&query=`+t.event_id),l&&((p=e.exceptions)==null||p.sendExceptionEvent(g)),t}}var $a=class{constructor(e,t,n,r,i,a){this.name=Za,this.setupOnce=function(o){o(Qa(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},eo=class{constructor(e){this.Yn=(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.Xn=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ts()}ts(){var e;this.es=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Yn)}destroy(){var e;(e=this.es)==null||e.call(this),this.es=void 0}doPageView(e,t){var n,r=this.rs(e,t);return this.Xn={pathname:(n=h==null?void 0:h.location.pathname)==null?``:n,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;
2return this.rs(e,(t=this.Xn)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Xn)==null?void 0:e.pageViewId}}rs(e,t){var n=this.Xn;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(!(F(a)||F(o)||F(s)||F(c)||F(l)||F(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?Xe(o/a,0,1,B):1,f=a>1?Xe(s/a,0,1,B):1,p=c>1?Xe(l/c,0,1,B):1,m=c>1?Xe(u/c,0,1,B):1;r=G(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}},to=[`flags`,`surveys`],no={[dr]:{exposure:`hidden`},[hr]:{exposure:`hidden`},__cmpns:{exposure:`hidden`},[gr]:{exposure:`hidden`},[_r]:{exposure:`event`},[vr]:{exposure:`hidden`},[yr]:{exposure:`event`},[br]:{exposure:`hidden`},[xr]:{exposure:`event`},[Sr]:{exposure:`event`},[Cr]:{exposure:`event`},[wr]:{exposure:`hidden`},[Tr]:{exposure:`event`},[Er]:{exposure:`hidden`},$session_recording_enabled_server_side:{exposure:`hidden`},[Mr]:{exposure:`hidden`},[Nr]:{exposure:`event`},[Dr]:{exposure:`event`,shouldSkipFromEventProperties:e=>Ie(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`},[Pr]:{exposure:`hidden`,storageGroup:`flags`},[Fr]:{exposure:`hidden`,storageGroup:`flags`},[Ir]:{exposure:`hidden`},[Lr]:{exposure:`hidden`,storageGroup:`flags`},[Rr]:{exposure:`hidden`,storageGroup:`flags`},[zr]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[Br]:{exposure:`hidden`,storageGroup:`flags`},[Vr]:{exposure:`hidden`},[Hr]:{exposure:`hidden`},[Ur]:{exposure:`hidden`},[Wr]:{exposure:`hidden`},[Kr]:{exposure:`hidden`,storageGroup:`surveys`},[qr]:{exposure:`hidden`,storageGroup:`surveys`,volatile:!0},[Jr]:{exposure:`event`},[Yr]:{exposure:`hidden`},[Xr]:{exposure:`hidden`},[Zr]:{exposure:`hidden`},$product_tours_activated:{exposure:`hidden`},$product_tours_activated_session:{exposure:`hidden`},$conversations_widget_session_id:{exposure:`event`},$conversations_ticket_id:{exposure:`event`},$conversations_widget_state:{exposure:`event`},$conversations_user_traits:{exposure:`event`},[Qr]:{exposure:`hidden`},[$r]:{exposure:`hidden`},[Gr]:{exposure:`event`},[ei]:{exposure:`hidden`},[ti]:{exposure:`hidden`,storageGroup:`flags`,volatile:!0},[H]:{exposure:`hidden`},[ni]:{exposure:`hidden`},[ri]:{exposure:`hidden`},[ii]:{exposure:`hidden`},[ai]:{exposure:`hidden`},[oi]:{exposure:`hidden`},[si]:{exposure:`hidden`},[Or]:{exposure:`event`},[kr]:{exposure:`event`},[Ar]:{exposure:`event`},[jr]:{exposure:`event`},[ui]:{exposure:`event`},[di]:{exposure:`event`},[fi]:{exposure:`event`},$sdk_debug_replay_event_trigger_status:{exposure:`event`},$sdk_debug_replay_linked_flag_trigger_status:{exposure:`event`},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:`event`},$sdk_debug_replay_remote_trigger_matching_config:{exposure:`event`},$sdk_debug_replay_trigger_groups_count:{exposure:`event`},$sdk_debug_replay_url_trigger_status:{exposure:`event`},$session_recording_start_reason:{exposure:`event`}},ro=[[`$posthog_sr_group_event_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_url_trigger_`,{exposure:`hidden`}],[`$posthog_sr_group_sampling_`,{exposure:`hidden`}]],io=e=>{var t=no[e];if(t)return t;for(var n of ro){var r=n[1];if(e.indexOf(n[0])===0)return r}},ao=(e,t)=>{try{return JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t)}catch{return ke(e)}},oo=e=>{var t=v==null?void 0:v.createElement(`a`);return F(t)?null:(t.href=e,t)},so=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(!N(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,` `)},co=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(`=`);N(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},lo=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},uo=(e,t)=>e>=t&&T(),fo=(e,t,n,r)=>{if(e===0){if(T()){var i=t+1;return i===n&&r(),i}return t}return 0},po=`https?://(.*)`,mo=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],ho=[`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`,...mo],go=`<masked>`,_o=[`li_fat_id`];function vo(e,t,n){if(!v)return{};var r,i=t?[...mo,...n||[]]:[],a=yo(co(v.URL,i,go),e);return G((r={},W(_o,(function(e){var t=Mi(e);r[e]=t||null})),r),a)}function yo(e,t){var n=ho.concat(t||[]),r={};return W(n,(function(t){r[t]=so(e,t)||null})),r}function bo(e){var t=function(e){return e?e.search(po+`google.([^/?]*)`)===0?`google`:e.search(po+`bing.com`)===0?`bing`:e.search(po+`yahoo.com`)===0?`yahoo`:e.search(po+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!Ie(t)){r.$search_engine=t;var i=v?so(v.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function xo(){return navigator.language||navigator.userLanguage}var So=`$direct`;function Co(){return(v==null?void 0:v.referrer)||So}function wo(e,t,n){n===void 0&&(n=!1);var r=e?[...mo,...t||[]]:[],i=n?rn(y==null?void 0:y.href):y==null?void 0:y.href,a=i==null?void 0:i.substring(0,1e3);return{r:Co().substring(0,1e3),u:a?co(a,r,go):void 0}}function To(e,t){var n;t===void 0&&(t=!1);var r=e.r,i=e.u,a=t?rn(i):i,o={$referrer:r,$referring_domain:r==null?void 0:r==So?So:(n=oo(r))==null?void 0:n.host};
2if(a){o.$current_url=a;var s=oo(a);o.$host=s==null?void 0:s.host,o.$pathname=s==null?void 0:s.pathname,G(o,yo(a))}return r&&G(o,bo(r)),o}function Eo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Do(){try{return new Date().getTimezoneOffset()}catch{return}}var Oo={flags:ti,surveys:qr},ko=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],Ao=e=>e+`_cookie_identity_change_pending`,jo=`main`,Mo=(e,t)=>{W(e,((n,r)=>{var i=io(r);i&&i.exposure!==`event`||{}.hasOwnProperty.call(t,r)||delete e[r]}))},No=class{constructor(e,t,n){if(n===void 0&&(n=!0),this.ns={},this.ss=!1,this.os=!1,this.ls=!1,this.us=!1,this.Oi=e,this.hs=n,this.props={},this.ds=void 0,this.vs=(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.Vn=this.cs(e),this.os=this.fs(e),this.load(),e.debug&&B.info(`Persistence loaded`,e.persistence,A({},this.props)),this.update_config(e,e,t),this.save(),h){var r=()=>this.flush();K(h,`beforeunload`,r,{capture:!1}),K(h,`pagehide`,r,{capture:!1})}}ps(){var e,t=(e=this.Oi)==null?void 0:e.persistence_save_debounce_ms;return R(t)&&t>0?t:0}gs(e){if(this.Oi.cookieWinsOnConflict&&this.Oi.persistence.toLowerCase()===`localstorage+cookie`){if(e)try{var t=Ji(e,this.O
2i.cookie_persisted_properties||[]),n=Xi(t,this.Oi.cookie_persisted_properties||[]),r=JSON.stringify(t)+`|`+JSON.stringify(n),i=q.Fr(this.vs)||void 0;i&&Qi(this.vs,i)===r&&(this.ys=r,this.bs=i)}catch{}else try{var a=q.Fr(this.vs)||void 0;this.ys=a?Qi(this.vs,a):void 0,this.bs=a}catch{}}}syncCookieProperties(){return this._s(this.Oi)}_s(e,t){if(t===void 0&&(t=!1),this.ws&&!t||this.us||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!==`localstorage+cookie`)return!1;var n;try{n=q.Fr(this.vs)||void 0}catch{}if(!n||n===this.bs)return!1;var r,i=Qi(this.vs,n);try{r=qi(JSON.parse(n))}catch{return!1}if((q.Fr(this.vs)||void 0)!==n)return!1;this.ys=i,this.bs=n;var a=Zi(this.vs,n),o=[...Wi,...a.properties],s={};if(Object.keys(r).forEach((e=>{var t=r[e];(F(t)||Ie(t)||t===``||e===H&&t!==U&&t!==gi)&&(s[e]=!0,delete r[e])})),Pe(r))return!1;var c=fr in r||r[H]===U||r[H]===gi,l=this.props[fr],u=this.props[H],d=G({},this.props);[...Wi,...e.cookie_persisted_properties||[]].forEach((e=>{if(o.indexOf(e)!==-1&&!(e in r)&&!s[e]&&(c||e!==fr&&e!==H)){var t=d[e];!a.isValid&&Wi.indexOf(e)!==-1&&(!1===t||t===0)||delete d[e]}})),this.props=G(d,r),!c||H in r||H in this.props||this.ks(H,U);var f=this.props[fr],p=this.props[H];return!c||f===l&&p===u||(this.ls=!0,Y.Or(Ao(this.vs),!0),this.Ss(Ur),this.Ss(Fr),this.Ss(Pr),this.Ss(Lr),this.Ss(Rr),this.Ss(zr),this.Ss(ti),this.Ss(ei),this.Ss(Qr),p===U&&(u===gi||r[H]===U||!F(l)&&f!==l)&&(Mo(this.props,r),this.Ss(Wr)),p===gi?this.props.$user_id=f:delete this.props.$user_id,this.Ss(hr)),!0}
2consumeCookieIdentityChange(){var e=Ao(this.vs),t=this.ls||!!Y.Fr(e);return this.ls=!1,t&&Y.Dr(e),t}xs(e){return e===void 0&&(e=!1),!(this.us||this.ws&&!e||!this.Oi.cookieWinsOnConflict||this.Oi.persistence.toLowerCase()!==`localstorage+cookie`||(this.us=!0,0))}Cs(){this.us&&(F(this.Ts)||(clearTimeout(this.Ts),this.Ts=void 0),delete this.ns[jo],this.Ms(!0))}Es(e){if(e===void 0&&(e=!0),this.us)try{e?this.Cs():F(this.Ts)||(clearTimeout(this.Ts),this.Ts=void 0)}finally{this.us=!1}}isDisabled(){return!!this.ws}cs(e){ko.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=[...Wi,...e];return A({},J,{Pr(e){try{var r,i={};try{r=q.Fr(e)||void 0,i=r?qi(JSON.parse(r)):{}}catch{}var a,o=JSON.parse(J.Fr(e)||`{}`);if(t){var s=Zi(e,r),c=[...Wi,...s.properties],l={};Object.keys(i).forEach((e=>{var t=i[e];Ie(t)||t===``||e===H&&t!==U&&t!==gi||(l[e]=t)}));var u=fr in l||l[H]===U||l[H]===gi;if(Object.keys(l).length>0){var d,f=o[fr],p=(d=o[H])==null?U:d;n.forEach((e=>{if(c.indexOf(e)!==-1&&!(e in i)&&(u||e!==fr&&e!==H)){var t=o[e];!s.isValid&&Wi.indexOf(e)!==-1&&(!1===t||t===0)||delete o[e]}})),!u||H in i||H in o||(o[H]=U),!u||(fr in l?l[fr]:o[fr])===f&&(H in l?l[H]:o[H])===p||(Ui.forEach((e=>delete o[e])),l[H]===gi&&fr in l?o.$user_id=l[fr]:delete o.$user_id,l[H]!==gi&&(delete o[Gr],delete o[Wr]),delete o.__al
2ias)}a=G(o,l)}else a=G(i,o);return J.Or(e,a),a}catch{}return null},Or(n,r,i,a,o,s){var c=J.Or(n,r,void 0,void 0,s);try{var l=Ji(r,e);if(Object.keys(l).length){if(t){var u=Gi(n),d=Xi(l,e);if(q.Or(u,d,i,a,o,s),q.Fr(u)!==JSON.stringify(d)){q.Dr(u,a);var f=Ji(r);return q.Or(n,f,i,a,o,s),c}}q.Or(n,l,i,a,o,s)}}catch(e){J.Nr(e)}return c},Dr(e,t){try{h==null||h.localStorage.removeItem(e),q.Dr(e,t),q.Dr(Gi(e),t)}catch(e){J.Nr(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,i=e.persistence.toLowerCase();return i===`localstorage`&&J.Lr()?(t=J,r=!0):i===`localstorage+cookie`&&n.Lr()?(t=n,r=!0):i===`sessionstorage`&&Y.Lr()?t=Y:i===`memory`?t=ea:i===`cookie`?t=q:n.Lr()?(t=n,r=!0):t=q,this.ss=r,t}Is(e){return this.vs+`__`+e}fs(e){return this.ss&&!!e.split_storage}properties(){var e={};return W(this.props,((t,n)=>{var r=io(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.ws||e){var t=this.Oi.cookieWinsOnConflict&&this.Oi.persistence.toLowerCase()===`localstorage+cookie`,n=t?J.Pr(this.vs):null,r={};if(t)try{W(r=qi(q.Pr(this.vs)),((e,t)=>{(F(e)||Ie(e)||e===``)&&delete r[t]}))}catch{}var i=this.Vn.Pr(this.vs);if(i&&(this.props=G({},i)),this.os&&this.Rs(),t&&i){var a,o,s=n==null?void 0:n[fr],c=(a=n==null?void 0:n[H])==null?U:a,l=i[fr],u=(o=i[H])==null?U:o;if(l!==s||u!==c){this.ls=!0,Y.Or(Ao(this.vs),!0);var d=G({},this.props);Ui.forEach((e=>delete d[e])),u===U&&(c===gi||r[H]===U||!F(s)&&l!==s)&&(Mo(d,r),delete d[Wr]),this.props=d;var f=new Set;Ui.forEach((e=>{var t,n=(t=io(e))==null?void 0:t.storageGroup;n&&f.add(n)})),f.forEach((e=>{var t={};W(this.props,((n,r)=>{var i;((i=io(r))==null?void 0:i.storageGroup)===e&&(t[r]=n)})),Pe(t)?(J.Dr(this.Is(e)),this.ns[e]={}):J.Or(this.Is(e),t)&&(this.ns[e]={persisted:!0,fingerprint:this.Ps(t,e)})}))}}Y.Fr(Ao(this.vs))&&(this.ls=!0)}}Rs(){for(var e of to){var t=J.Pr(this.Is(e));if(t&&!Pe(t)){var n=this.As(e);n.persisted=!0,this.Fs(e)||(n.fingerprint=this.Ps(t,e)),this.Os(e,t)||G(this.props,t)}}}Fs(e){return Object.keys(this.props).some((t=>{var n;return((n=io(t))==null?void 0:n.storageGroup)===e}))}Os(e,t){var n=Oo[e];if(!n)return!1;var r=t[n],i=this.props[n];return R(r)&&R(i)&&i>r}refreshKey(e){var t;if(!this.ws){var n=this.os?(t=io(e))==null?void 0:t.storageGroup:void 0,r=n?J.Pr(this.Is(n)):this.Vn.Pr(this.vs);if(r&&e in r)this.ks(e,r[e]);else{if(n){var i=this.Vn.Pr(this.vs);if(i&&e in i)return void this.ks(e,i[e])}this.Ss(e)}}}save(){if(!this.ws){var e=this.ps();e>0?F(this.Ts)&&(this.Ts=setTimeout((()=>{this.Ts=void 0,this.Ms()}),e)):this.Ms()}}flush(){F(this.Ts)||(clearTimeout(this.Ts),this.Ts=void 0,this.Ms())}Ms(e){e===void 0&&(e=!1),this.ws||this.us&&!e||(e||this.syncCookieProperties(),this.os?this.Ls():this.$s(this.Vn,this.vs,this.props,jo)&&this.gs(this.props))}Ls(){var e=this.Ds(),t=e.main,n=e.groups;for(var r of(this.$s(this.Vn,this.vs,t,jo)&&this.gs(t),to)){var i,a=n[r];(!Pe(a)||(i=this.ns[r])!=null&&i.persisted)&&this.$s(J,this.Is(r),a,r)}}Ds(){var e={},t={flags:{},surveys:{}};return W(this.props,((n,r)=>{var i,a=(i=io(r))==null?void 0:i.storageGroup;a?t[a][r]=n:e[r]=n})),{main:e,groups:t}}Ps(e,t){if(t===jo)return JSON.stringify(e)+`|`+this.Ns+`|`+this.qs+`|`+this.js;var n={};return W(e,((e,t)=>{var r;n[t]=(r=io(t))!=null&&r.volatile?`__volatile__`:e})),JSON.stringify(n)}$s(e,t,n,r){var i,a=this.As(r);if(r!==jo&&!a.dirty&&!F(a.fingerprint))return!1;try{if((i=this.Ps(n,r))===a.fingerprint)return a.dirty=!1,!1}catch{i=void 0}return e.Or(t,n,this.Ns,this.qs,this.js,this.Oi.debug)?(a.dirty=!1,r!==jo&&(a.persisted=!0),F(i)||(a.fingerprint=i),!0):(this.Oi.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(F(this.Ts)||(clearTimeout(this.Ts),this.Ts=void 0),this.Vn.Dr(this.vs,!1),this.Vn.Dr(this.vs,!0),!n&&this.hs)for(var r of to)J.Dr(this.Is(r));n?delete this.ns[jo]:this.ns={},this.ys=void 0,this.bs=void 0}clear(){this.remove(),this.props={}}register_once(e,t,n){if(P(e)){this.syncCookieProperties(),F(t)&&(t=`None`),this.Ns=F(n)?this.Bs:n;var r=!1;if(W(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.ks(n,e),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(P(e)){this.syncCookieProperties(),this.Ns=F(t)?this.Bs:t;var n=!1;if(W(e,((t,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==t||P(t)||N(t))&&(this.ks(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.Ss(r),n=!0);n&&this.save()}update_campaign_params(){var e=v==null?void 0:v.URL;if(e!==this.ds){var t=vo(this.Oi.custom_campaign_params,this.Oi.mask_personal_data_properties,this.Oi.custom_personal_data_properties);Pe(Oi(t))||this.register(t),this.ds=e}}update_search_keyword(){var e;this.register((e=v==null?void 0:v.referrer)?bo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Co(),$referring_domain:v!=null&&v.referrer&&((e=oo(v.referrer))==null?void 0:e.host)||So},void 0)}set_initial_person_info(){this.props[ii]||this.props[ai]||this.register_once({[oi]:wo(this.Oi.mask_personal_data_properties,this.Oi.custom_personal_data_properties,this.Oi.disable_capture_url_hashes
2)},void 0)}get_initial_props(){var e={};W([ai,ii],(t=>{var n=this.props[t];n&&W(n,(function(t,n){e[`$initial_`+Oe(n)]=t}))}));var t=this.props[oi];return t&&G(e,function(e,t){t===void 0&&(t=!1);var n=To(e,t),r={};return W(n,(function(e,t){r[`$initial_`+Oe(t)]=e})),r}(t,this.Oi.disable_capture_url_hashes)),e}safe_merge(e){return W(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.ws&&!s;s||this._s(t,c),this.Oi=e,!s&&(r||i||o)&&(this.ys=void 0,this.bs=void 0,this._s(A({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),c));var l=a||o?this.cs(e):this.Vn,u=this.fs(e),d=a||u!==this.os,f=!s&&(d||e.cross_subdomain_cookie!==this.qs||e.secure_cookie!==this.js)&&this.xs(c);try{if(this.Bs=this.Ns=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.Vn=l,this.os=u,this.props=p,this.save()}else o&&(this.Vn=l,s||(delete this.ns[jo],this.Ms()))}finally{f&&this.Es()}}set_disabled(e){this.ws=e,this.ws?this.remove():this.save()}set_cross_subdomain(e){e!==this.qs&&(this.qs=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.js&&(this.js=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var n=this.props[gr]||{};n[e]=t,this.ks(gr,n),this.save()}remove_event_timer(e){var t=this.props[gr]||{},n=t[e];return F(n)||(delete t[e],this.ks(gr,t),this.save()),n}get_property(e){return this.props[e]}set_property(e,t){this.ks(e,t),this.save()}ks(e,t){var n;this.props[e]=t,(n=io(e))!=null&&n.volatile||this.Hs(e)}Ss(e){delete this.props[e],this.Hs(e)}Hs(e){var t,n=(t=io(e))==null?void 0:t.storageGroup;n&&(this.As(n).dirty=!0)}As(e){return this.ns[e]||(this.ns[e]={})}};function Po(e){var t=!0;return{dispose(){if(t){t=!1;var n=e();n&&Ne(n.then)&&n.then(void 0,(()=>{}))}}}}var Fo={GZipJS:`gzip-js`,Base64:`base64`},Io={Activation:`events`,Cancellation:`cancelEvents`},Lo={Popover:`popover`,API:`api`,Widget:`widget`,ExternalSurvey:`external_survey`},Ro={SHOWN:`survey shown`,DISMISSED:`survey dismissed`,SENT:`survey sent`,ABANDONED:`survey abandoned`},zo={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`},Bo={Popover:`popover`,Inline:`inline`},Vo={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`},Ho={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`},Uo=V(`[RateLimiter]`),Wo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
2if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{Uo.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){Uo.warn(`could not rate limit - continuing. Error: "`+(e==null?void 0:e.message)+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,n,r;e===void 0&&(e=!1);var i=this.captureEventsBurstLimit,a=this.captureEventsPerSecond,o=new Date().getTime(),s=(t=(n=this.instance.persistence)==null?void 0:n.get_property(ri))==null?{tokens:i,last:o}:t;s.tokens+=(o-s.last)/1e3*a,s.last=o,s.tokens>i&&(s.tokens=i);var c=1>s.tokens;if(c||e||(s.tokens=Math.max(0,s.tokens-1)),c&&!e){var l=(R(s.dropped)?s.dropped:0)+1;s.dropped=l,!this.lastEventRateLimited&&this.zs(l)&&(s.dropped=0)}return this.lastEventRateLimited=c,(r=this.instance.persistence)==null||r.set_property(ri,s),{isRateLimited:c,remainingTokens:s.tokens}}Us(e){var t=this.instance.config.property_denylist;return!N(t)||!t.includes(e)}Ws(){var e;if(this.Us(`$current_url`)&&this.Us(`$pathname`)&&y!=null&&y.pathname)return``+((e=y.origin)==null?``:e)+y.pathname}zs(e){var t,n,r=this.captureEventsBurstLimit,i=this.captureEventsPerSecond,a=this.Ws(),o=this.Us(`$session_id`)?(t=(n=this.instance).get_session_id)==null?void 0:t.call(n):void 0,s=[e+` event(s) dropped since the last warning`,a?`triggered on `+a:void 0,o?`session `+o:void 0].filter(Boolean).join(`, `);return!!this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited: `+s+`. Config is set to `+i+` events per second and `+r+` events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},Go=V(`[RemoteConfig]`),Ko=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=D._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Vs(e){var t,n;(t=D.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Gs(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 Go.info(`Using preloaded remote config`,this.remoteConfig),this.Zs(this.remoteConfig),void this.Qs();if(this._instance.Js())return void Go.warn(`Remote config is disabled. Falling back to local config.`);this.Vs((e=>{if(!e)return Go.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Gs((e=>{this.Zs(e.json,e),this.Qs()}));this.Zs(e),this.Qs()}))}catch(e){Go.error(`Error loading remote config`,e),this.Zs()}}stop(){this.Ks&&(clearInterval(this.Ks),this.Ks=void 0)}refresh(){!this._instance.Js()&&v&&v.visibilityState!==`hidden`&&this._instance.reloadFeatureFlags()}Qs(){var e;if(!this.Ks){var t=(e=this._instance.config.remote_config_refresh_interval_ms)==null?3e5:e;t!==0&&(this.Ks=setInterval((()=>{this.refresh()}),t))}}Zs(e,t){!e&&t&&(t.statusCode===0?t.error||Go.warn(`Failed to fetch remote config from PostHog.`):Go.error(`Failed to fetch remote config from PostHog.`));try{this._instance.Zs(e?{ok:!0,config:e}:{ok:!1})}catch(e){Go.error(`Error applying remote config`,e)}if(!1!==(e==null?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var n;(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded()}catch(e){Go.error(`Error loading feature flags`,e)}}},qo=Uint8Array,Jo=Uint16Array,Yo=Uint32Array,Xo=new qo([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]),Zo=new qo([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]),Qo=new qo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$o=function(e,t){for(var n=new Jo(31),r=0;31>r;++r)n[r]=t+=1<<e[r-1];var i=new Yo(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]},es=$o(Xo,2),ts=es[1];es[0][28]=258,ts[258]=28;for(var ns=$o(Zo,0)[1],rs=new Jo(32768),X=0;32768>X;++X){var is=(43690&X)>>>1|(21845&X)<<1;rs[X]=((65280&(is=(61680&(is=(52428&is)>>>2|(13107&is)<<2))>>>4|(3855&is)<<4))>>>8|(255&is)<<8)>>>1}var as=function(e,t,n){for(var r=e.length,i=0,a=new Jo(t);r>i;++i)++a[e[i]-1];var o,s=new Jo(t);for(i=0;t>i;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new Jo(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[rs[d]>>>c]=l}else for(o=new Jo(r),i=0;r>i;++i)o[i]=rs[s[e[i]-1]++]>>>15-e[i];return o},os=new qo(288);for(X=0;144>X;++X)os[X]=8;for(X=144;256>X;++X)os[X]=9;for(X=256;280>X;++X)os[X]=7;for(X=280;288>X;++X)os[X]=8;var ss=new qo(32);for(X=0;32>X;++X)ss[X]=5;var cs=as(os,9,0),ls=as(ss,5,0),us=function(e){return(e/8>>0)+(7&e&&1)},ds=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Jo?Jo:e instanceof Yo?Yo:qo)(n-t);return r.set(e.subarray(t,n)),r},fs=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8},ps=function(e,t,n){var r=t/8>>0;e[r]|=n<<=7&t,e[r+1]|=n>>>8,e[r+2]|=n>>>16},ms=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 qo(0),0];if(i==1){var o=new qo(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 Jo(f+1),m=hs(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 qo(p),m]},hs=function(e,t,n){return e.s==-1?Math.max(hs(e.l,t,n+1),hs(e.r,t,n+1)):t[e.s]=n},gs=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Jo(++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]},_s=function(e,t){for(var n=0,r=0;t.length>r;++r)n+=e[r]*t[r];return n},vs=function(e,t,n){var r=n.length,i=us(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)},ys=function(e,t,n,r,i,a,o,s,c,l,u){fs(t,u++,n),++i[256];for(var d=ms(i,15),f=d[0],p=d[1],m=ms(a,15),h=m[0],g=m[1],_=gs(f),v=_[0],y=_[1],b=gs(h),x=b[0],S=b[1],C=new Jo(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=ms(C,7),E=T[0],D=T[1],O=19;O>4&&!E[Qo[O-1]];--O);var ee,k,A,j,te=l+5<<3,ne=_s(i,os)+_s(a,ss)+o,re=_s(i,f)+_s(a,h)+o+14+3*O+_s(C,E)+(2*C[16]+3*C[17]+7*C[18]);if(ne>=te&&re>=te)return vs(t,u,e.subarray(c,c+l));if(fs(t,u,1+(ne>re)),u+=2,ne>re){ee=as(f,p,0),k=f,A=as(h,g,0),j=h;var ie=as(E,D,0);for(fs(t,u,y-257),fs(t,u+5,S-1),fs(t,u+10,O-4),u+=14,w=0;O>w;++w)fs(t,u+3*w,E[Qo[w]]);u+=3*O;for(var ae=[v,x],oe=0;2>oe;++oe){var se=ae[oe];for(w=0;se.length>w;++w)fs(t,u,ie[ce=31&se[w]]),u+=E[ce],ce>15&&(fs(t,u,se[w]>>>5&127),u+=se[w]>>>12)}}else ee=cs,k=os,A=ls,j=ss;for(w=0;s>w;++w)if(r[w]>255){var ce;ps(t,u,ee[257+(ce=r[w]>>>18&31)]),u+=k[ce+257],ce>7&&(fs(t,u,r[w]>>>23&31),u+=Xo[ce]);var le=31&r[w];ps(t,u,A[le]),u+=j[le],le>3&&(ps(t,u,r[w]>>>5&8191),u+=Zo[le])}else ps(t,u,ee[r[w]]),u+=k[r[w]];return ps(t,u,ee[256]),u+k[256]},bs=new Yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),xs=function(){for(var e=new Yo(256),t=0;256>t;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Ss=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Cs(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=xs[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 qo(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=vs(c,l,e.subarray(u,d)):(c[u]=!0,l=vs(c,l,e.subarray(u,o)))}else{for(var f=bs[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new Jo(32768),_=new Jo(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 Yo(25e3),S=new Jo(288),C=new Jo(32),w=0,T=0,E=(u=0,0),D=0,O=0;o>u;++u){var ee=b(u),k=32767&u,A=_[ee];if(g[k]=A,_[ee]=k,u>=D){var j=o-u;if((w>7e3||E>24576)&&j>423){l=ys(e,c,0,x,S,C,T,E,O,u-O,l),E=w=T=0,O=u;for(var te=0;286>te;++te)S[te]=0;for(te=0;30>te;++te)C[te]=0}var ne=2,re=0,ie=m,ae=k-A&32767;if(j>2&&ee==b(u-ae))for(var oe=Math.min(p,j)-1,se=Math.min(32767,u),ce=Math.min(258,j);se>=ae&&--ie&&k!=A;){if(e[u+ne]==e[u+ne-ae]){for(var le=0;ce>le&&e[u+le]==e[u+le-ae];++le);if(le>ne){if(ne=le,re=ae,le>oe)break;var ue=Math.min(ae,le-2),de=0;for(te=0;ue>te;++te){var fe=u-ae+te+32768&32767,pe=fe-g[fe]+32768&32767;pe>de&&(de=pe,A=fe)}}}ae+=(k=A)-(A=g[k])+32768&32767}if(re){x[E++]=268435456|ts[ne]<<18|ns[re];var me=31&ts[ne],he=31&ns[re];T+=Xo[me]+Zo[he],++S[257+me],++C[he],D=u+ne,++w}else x[E++]=e[u],++S[e[u]]}}l=ys(e,c,!0,x,S,C,T,E,O,u-O,l)}return ds(s,0,r+us(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&&Ss(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),Ss(l,u-8,n.d()),Ss(l,u-4,r),l}var ws=!!x||!!b,Ts=`text/plain`,Es=!1,Ds=(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:``)},Os=function(e,t,n){var r;n===void 0&&(n=!0);var i=e.split(`?`),a=i[0],o=i[1],s=A({},t),c=(r=o==null?void 0:o.split(`&`).map((e=>{var t,r=e.split(`=`),i=r[0],a=n&&(t=s[i])!=null?t:r[1];return delete s[i],i+`=`+a})))==null?[]:r,l=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return W(e,(function(e,t){F(e)||F(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)}(s);return l&&c.push(l),c.length>0?a+`?`+c.join(`&`):a},ks=e=>{if(e.Ys)return e.Ys;var t=e.data,n=e.compression;if(t){if(n===Fo.GZipJS){var r=Cs(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new qo(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 qo(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 ds(r,0,i)}(ao(t)),{mtime:0});return{contentType:Ts,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Fo.Base64){var i=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:ao(e)))(function(e){return e&&btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>
2String.fromCharCode(parseInt(t,16)))))}(ao(t)));return{contentType:`application/x-www-form-urlencoded`,body:i,estimatedSize:new Blob([i]).size}}var a=ao(t);return{contentType:`application/json`,body:a,estimatedSize:new Blob([a]).size}}},As=e=>{var t,n,r=()=>e.transport===`sendBeacon`?{url:Os(e.url,{compression:Fo.Base64}),encodedBody:ks(A({},e,{compression:Fo.Base64,Ys:void 0}))}:{url:Ds(e.url,`compression`),encodedBody:ks(A({},e,{compression:void 0,Ys:void 0}))};try{t=ks(e)}catch(t){if(fe(e.compression,so(e.url,`compression`)))return B.error(`Failed to gzip request body, sending uncompressed payload`,t),r();throw t}return t&&fe(e.compression,so(e.url,`compression`))&&!((n=t.body)instanceof ArrayBuffer?de(new Uint8Array(n)):ArrayBuffer.isView(n)&&de(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Es=!0,r()):{url:e.url,encodedBody:t}},js=e=>{try{return As(e)}catch(t){B.error(t),e.callback==null||e.callback({statusCode:0,error:t});return}},Ms=function(){var e=k((function*(e){var t=yield function(e,t,n){return ge.apply(this,arguments)}(ao(e.data),O.DEBUG,{rethrow:!0});if(!t)return e;var n=yield t.arrayBuffer();return A({},e,{Ys:{contentType:Ts,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Ns=/Failed to fetch|NetworkError|Load failed/i,Ps=e=>(e==null?void 0:e.name)===`TypeError`&&Ns.test((e==null?void 0:e.message)||``),Fs=e=>{var t=js(e);if(t){var n=t.url,r=t.encodedBody,i=r==null?{}:r,a=i.contentType,o=i.body,s=i.estimatedSize,c=new Headers;W(e.headers,(function(e,t){c.append(t,e)})),a&&c.append(`Content-Type`,a);var l=null,u=!1;if(S){var d=new S;l={signal:d.signal,timeout:setTimeout((()=>{var t,n;u=!0,d.abort((t=e.timeout,(n=Error(`PostHog request timed out`+(t?` after `+t+`ms`:``))).name=`AbortError`,n))}),e.timeout)}}var f=t=>{u&&(t==null?void 0:t.name)===`AbortError`||Ps(t)?B.warn(t):B.error(t),e.callback==null||e.callback({statusCode:0,error:t})};try{var p;b(n,A({method:(e==null?void 0:e.method)||`GET`,headers:c,keepalive:e.method===`POST`&&!e.Xs&&52428.8>(s||0),body:o,signal:(p=l)==null?void 0:p.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(f).finally((()=>l?clearTimeout(l.timeout):null))}catch(e){l&&clearTimeout(l.timeout),f(e)}}},Is=e=>{try{var t,n=As(e),r=n.url,i=n.encodedBody,a=i==null?{}:i,o=a.body,s=a.estimatedSize;if(!o)return;var c=o instanceof Blob?o:new Blob([o],{type:a.contentType});if(_.sendBeacon(r,c))return;var l=N(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(N(l)&&l.length>1&&(s==null?0:s)>16384){var u=Math.ceil(l.length/2),d=t=>N(e.data)?t:A({},e.data,{batch:t});Is(A({},e,{data:d(l.slice(0,u))})),Is(A({},e,{data:d(l.slice(u))}));return}B.warn(`Beacon of ~`+(s==null?0:s)+` bytes was rejected by the browser, falling back to fetch`),Fs(A({},e,{Xs:!0}))}catch(e){B.warn(`Beacon send failed`,e)}},Ls=(e,t,n,r)=>{var i=r===`query`?t===`POST`?`sent_at`:`_`:void 0;return Os(n===Fo.GZipJS?Ds(e,`compression`):e,A({},i?{[i]:Date.now().toString()}:{},n===Fo.GZipJS?{}:{compression:n}))},Rs=[];b&&Rs.push({transport:`fetch`,method:Fs}),x&&Rs.push({transport:`XHR`,method(e){var t=js(e);if(t){var n=new x,r=t.encodedBody;n.open(e.method||`GET`,t.url,!0);var i=r==null?{}:r,a=i.contentType,o=i.body;W(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)}}}),_!=null&&_.sendBeacon&&Rs.push({transport:`sendBeacon`,method:Is});var zs=3e3,Bs=class{constructor(e,t){this.ta=!0,this.ea=[],this.ia=Xe((t==null?void 0:t.flush_interval_ms)||zs,250,5e3,B.createLogger(`flush interval`),zs),this.ra=e}enqueue(e){this.ea.push(e),this.na||this.sa()}unload(){this.aa();var e=this.ea.length>0?this.oa():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.la(A({},e,{transport:`sendBeacon`}))}))}enable(){this.ta=!1,this.sa()}sa(){var e=this;this.ta||(this.na=setTimeout((()=>
2{if(this.aa(),this.ea.length>0){var t=this.oa(),n=function(){var n=t[r],i=new Date().getTime();n.data&&N(n.data)&&W(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.la(n)};for(var r in t)n()}}),this.ia))}la(e){try{this.ra(e)}catch(e){B.error(e)}}aa(){clearTimeout(this.na),this.na=void 0}oa(){var e={};return W(this.ea,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;F(e[i])&&(e[i]=A({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.ea=[],e}},Vs=[`retriesPerformedSoFar`],Hs=class{constructor(e){this.ua=!1,this.ha=3e3,this.ea=[],this._instance=e,this.ea=[],this.da=!0,!F(h)&&`onLine`in h.navigator&&(this.da=h.navigator.onLine,this.va=()=>{this.da=!0,this.ca()},this.fa=()=>{this.da=!1},K(h,`online`,this.va),K(h,`offline`,this.fa))}get length(){return this.ea.length}retriableRequest(e){var t=e.retriesPerformedSoFar,n=j(e,Vs);Le(t)&&(n.url=Os(n.url,{retry_count:t})),this._instance._send_request(A({},n,{callback:e=>{if(e.statusCode!==200&&(400>e.statusCode||e.statusCode>=500)){if((e.statusCode===0?3:10)>(t==null?0:t))return void this.bn(A({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==null?0:t)+` retries.`)}n.callback==null||n.callback(e)}}))}bn(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.ea.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),B.warn(i),this.ua||(this.ua=!0,this.pa())}pa(){if(this.ga&&clearTimeout(this.ga),this.ea.length===0)return this.ua=!1,void(this.ga=void 0);this.ga=setTimeout((()=>{this.da&&this.ea.length>0&&this.ca(),this.pa()}),this.ha)}ca(){var e=Date.now(),t=[],n=this.ea.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.ea=t,n.length>0)for(var r of n)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.ga&&(clearTimeout(this.ga),this.ga=void 0),this.ua=!1,F(h)||(this.va&&(h.removeEventListener(`online`,this.va),this.va=void 0),this.fa&&(h.removeEventListener(`offline`,this.fa),this.fa=void 0)),this.ea)){var t=e.requestOptions;try{this._instance._send_request(A({},t,{transport:`sendBeacon`}))}catch(e){B.error(e)}}this.ea=[]}},Us=class{constructor(e){this.ma=()=>{var e,t,n,r;this.ya||(this.ya={});var i=this.scrollElement(),a=this.scrollY(),o=i?Math.max(0,i.scrollHeight-i.clientHeight):0,s=a+((i==null?void 0:i.clientHeight)||0),c=(i==null?void 0:i.scrollHeight)||0;this.ya.lastScrollY=Math.ceil(a),this.ya.maxScrollY=Math.max(a,(e=this.ya.maxScrollY)==null?0:e),this.ya.maxScrollHeight=Math.max(o,(t=this.ya.maxScrollHeight)==null?0:t),this.ya.lastContentY=s,this.ya.maxContentY=Math.max(s,(n=this.ya.maxContentY)==null?0:n),this.ya.maxContentHeight=Math.max(c,(r=this.ya.maxContentHeight)==null?0:r)},this._instance=e}get ba(){return this._instance.config.scroll_root_selector}getContext(){return this.ya}resetContext(){var e=this.ya;return setTimeout(this.ma,0),e}startMeasuringScrollPosition(){K(h,`scroll`,this.ma,{capture:!0}),K(h,`scrollend`,this.ma,{capture:!0}),K(h,`resize`,this.ma)}scrollElement(){if(!this.ba)return h==null?void 0:h.document.documentElement;for(var e of N(this.ba)?this.ba:[this.ba]){var t=h==null?void 0:h.document.querySelector(e);if(t)return t}}_a(e){var t=e===`y`?`scrollTop`:`scrollLeft`;if(this.ba){var n=this.scrollElement();return n&&n[t]||0}return h?e===`y`?h.scrollY||h.pageYOffset||h.document.documentElement.scrollTop||0:h.scrollX||h.pageXOffset||h.document.documentElement.scrollLeft||0:0}scrollY(){return this._a(`y`)}scrollX(){return this._a(`x`)}},Ws=e=>wo(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes),Gs=class{constructor(e,t,n,r){this.ot=e=>{var t=this.wa();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.ka(this._instance)};this.Sa.register({[ni]:n})}},this._instance=e,this.xa=t,this.Sa=n,this.ka=r||Ws,this.xa.onSessionId(this.ot)}wa(){return this.Sa.props[ni]}getSetOnceProps(){var e,t=(e=this.wa())==null?void 0:e.props;return t?`r`in t?To(t,this._instance.config.disable_capture_url_hashes
2):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return W(Oi(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+Oe(n)]=t})),e}},Ks=class{on(e,t){return this.Ca[e]||(this.Ca[e]=[]),this.Ca[e].push(t),()=>{this.Ca[e]=this.Ca[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.Ca[e]||[])n(t);for(var r of this.Ca[`*`]||[])r(e,t)}constructor(){this.Ca={}}},qs=V(`[SessionId]`),Js=864e5,Ys=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,n){var r;if(this.Ma=null,this.Ea=null,this.Ia=[],this.Ra=void 0,this.Pa=!1,this.Ta=new Ks,this.Aa=(e,t)=>!(!Le(e)||!Le(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===hi)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.Oi=e.config,this.Sa=e.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||Ri,this.La=n||Ri;var i=this.Oi.persistence_name||this.Oi.token;if(this._sessionTimeoutMs=1e3*Xe(this.Oi.session_idle_timeout_seconds||1800,60,36e3,qs.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.$a(),this.Da=`ph_`+i+`_window_id`,this.Na=`ph_`+i+`_primary_window_exists`,this.qa()){var a=Y.Pr(this.Da),o=Y.Pr(this.Na);a&&!o?this.st=a:Y.Dr(this.Da),Y.Or(this.Na,!0)}(r=this.Oi.bootstrap)!=null&&r.sessionID&&this.setBootstrapSessionId(this.Oi.bootstrap.sessionID),this.ja()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return F(this.Ia)&&(this.Ia=[]),this.Ia.push(e),this._e&&e(this._e,this.st),()=>{this.Ia=this.Ia.filter((t=>t!==e))}}qa(){return this.Oi.persistence!==`memory`&&!this.Sa.ws&&Y.Lr()}Ba(e){e!==this.st&&(this.st=e,this.qa()&&Y.Or(this.Da,e))}Ha(){return this.st?this.st:this.qa()?Y.Pr(this.Da):null}za(e){var t=this.Ma;return!Ie(t)&&!Ie(e)&&5e3>Math.abs(e-t)}
2Ua(e,t,n){var r=t!==this._sessionActivityTimestamp,i=e===this._e&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this._e=e,i&&!r||i&&this.za(t)||(this.Ma=t,this.Sa.register({[Mr]:[t,e,n]}))}Wa(){var e,t=(e=this.Oi)==null?void 0:e.persistence_save_debounce_ms;return Le(t)&&t>0}Va(){this.Wa()?this.Sa.refreshKey(Mr):(this.Sa.flush(),this.Sa.load())}Ga(){var e;if(!Ie(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ma){this.Va();var t=this.Za();t[1]===this._e&&t[2]===this._sessionStartTimestamp&&(this.Ma=this._sessionActivityTimestamp,this.Sa.register({[Mr]:[this._sessionActivityTimestamp,(e=this._e)==null?null:e,this._sessionStartTimestamp]}),this.Sa.flush())}}Qa(){var e=this.Za()[0],t=Le(e)?e:0,n=Le(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,n)}Ja(e){return this.Va(),this.Aa(e,this.Qa())}Za(){var e=this.Sa.props[Mr];return N(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ma=null,this.Fa=void 0,clearTimeout(this.Ka),this.Ka=void 0,this.Ua(null,null,null)}setBootstrapSessionId(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 qs.error(`Bootstrap sessionID cannot be in the future`):n}catch(e){qs.error(`Invalid sessionID in bootstrap`,e);return}}(e);return!F(n)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:n}:this.Ua(e,new Date().getTime(),n),!0)}destroy(){this.Pa=!0,this.Ga(),clearTimeout(this.Ka),this.Ka=void 0,this.Ra&&h&&(h.removeEventListener(yi,this.Ra,{capture:!1}),this.Ra=void 0),this.Ia=[]}ja(){this.Ra=()=>{this.Ga(),this.qa()&&Y.Dr(this.Na)},K(h,yi,this.Ra,{capture:!1})}checkAndGetSessionAndWindowId(e,t,n){if(e===void 0&&(e=!1),t===void 0&&(t=null),n===void 0&&(n=!1),this.Oi.cookieless_mode===hi)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var r=t||new Date().getTime(),i=this._e;if(n)this.Ea=r;else if(Ie(this.Ea)||this.Ea>r||r-this.Ea>=1e3){var a,o;(a=(o=this.Sa).syncCookieProperties)==null||a.call(o),this.Ea=r}var s=this.Za(),c=s[1],l=s[2],u=!F(i)&&c!==i,d=this.Qa(),f=this.Ha(),p=this.Fa,m=!!p&&(p.sessionStartTimestamp>r+6e4||r-p.sessionStartTimestamp>Js),h=p?m:Le(l)&&Math.abs(r-l)>Js,g=!1,_=u,v=!c||!!p,y=c,b=!v&&!e&&this.Aa(r,d);if(b){(b=this.Ja(r))||qs.info(`cross-tab refresh kept the session alive`,{sessionId:c});var x=this.Za();c=x[1],l=x[2]}if(v||b||h){_=!1;var S=p&&!m;c=S?p.sessionId:this.Oa(),f=this.La(),qs.info(`new session ID assigned`,{sessionId:c,windowId:f,bootstrapped:!!S,changeReason:{noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h}}),l=S?p.sessionStartTimestamp:r,this.Fa=void 0,g=!0}else f||(f=this.La(),g=!0),(_=_||c!==y)&&(qs.info(`adopted cross-tab session id`,{sessionId:c,windowId:f}),g=!0);var C=Le(d)&&e&&!h?d:r,w=Le(l)?l:new Date().getTime();this.Ba(f),this.Ua(c,C,w),e||this.$a();var T={noSessionId:v,activityTimeout:b,sessionPastMaximumLength:h,crossTabAdoption:_};return g&&this.Ia.forEach((e=>e(c,f,T))),{sessionId:c,windowId:f,sessionStartTimestamp:w,changeReason:g?T:void 0,lastActivityTimestamp:d}}$a(){this.Pa||(clearTimeout(this.Ka),this.Ka=setTimeout((()=>{if(!this.Pa){if(this.Ja(new Date().getTime())){var e=this._e;this.resetSessionId(),this.Ta.emit(`forcedIdleReset`,{idleSessionId:e})}else this.$a()}}),1.1*this.sessionTimeoutMs))}},Xs=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Ee(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>Ee(e==null?void 0:e.brand,t))))return!0}catch{}return!!e.webdriver};function Zs(){return(Zs=k((function*(){var e=_==null?void 0:_.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues([`model`]),n=t==null?void 0:t.model;return I(n)&&n.length>0?n:void 0}catch(e){B.info(`Unable to resolve $device_model from userAgentData.getHighEntropyValues`,e);return}}))).apply(this,arguments)}var Qs=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function $s(e,t,n){return ao({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var ec={exact:(e,t)=>
2t.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=>Qs(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Qs(t,e))))),icontains:(e,t)=>t.map(tc).some((t=>e.map(tc).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(tc).every((t=>e.map(tc).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)))}))},tc=e=>e.toLowerCase();function nc(e,t){return!e||Object.entries(e).every((e=>{var n=e[1],r=t==null?void 0:t[e[0]];if(F(r)||Ie(r))return!1;var i=[String(r)],a=ec[n.operator];return!!a&&a(n.values,i)}))}var rc=`custom`,ic=`i.posthog.com`,ac=/^\/static\//,oc=[`/s/`,`/e/`,`/i/`],sc=class{constructor(e){this.Ya={},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,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,``);return t||(t=this.apiHost.replace(`.`+ic,`.posthog.com`)),t===`https://app.posthog.com`?`https://us.posthog.com`:t}get region(){return this.Ya[this.apiHost]||(this.Ya[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`:rc),this.Ya[this.apiHost]}Xa(e){if(ac.test(e)){var t=this.instance.config.asset_host;if(typeof t==`string`)return t.trim().replace(/\/$/,``)||void 0}}eo(e){var t=oo(e);return t?t.protocol+`//`+t.host+t.pathname:void 0}io(e,t,n){if(e===`ui`)return n;var r=n,i=this.instance.config.rewriteRequestPath;if(i){var a,o=((a=oo(n))==null?void 0:a.href)||n;r=i(new URL(o)).toString()}if(i&&e===`api`&&oc.some((e=>t.indexOf(e)===0))){var s=this.eo(r);if(s){var c,l=this.apiHost,u=this.ro;((c=u)==null?void 0:c.apiHost)===l&&u.rewriteRequestPath===i||(u={apiHost:l,rewriteRequestPath:i,urls:new Set},this.ro=u),u.urls.add(s)}}return r}isIngestionEndpoint(e){var t=this.ro,n=this.eo(e);return(t==null?void 0: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=t[0]===`/`?t:`/`+t),e===`ui`)return this.io(e,t,this.uiHost+t);if(e===`flags`)return this.io(e,t,this.flagsApiHost+t);if(e===`assets`){var n=this.Xa(t);if(n)return this.io(e,t,``+n+t)}if(this.region===rc)return this.io(e,t,this.apiHost+t);var r=ic+t;switch(e){case`assets`:return this.io(e,t,`https://`+this.region+`-assets.`+r);case`api`:return this.io(e,t,`https://`+this.region+`.`+r)}}};function cc(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Z=V(`[Surveys]`),lc=`seenSurvey_`,uc=e=>{try{var t=(e=>((e,t)=>``+lc+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){Z.error(`Failed to persist survey seen state`,e)}},dc=[Lo.Popover,Lo.Widget,Lo.API],fc={ignoreConditions:!1,ignoreDelay:!1,displayType:Bo.Popover},pc=V(`[PostHog ExternalIntegrations]`),mc={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},hc=class{constructor(e){this._instance=e}Jn(e,t){var n;(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return pc.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=D.__PosthogExtensions__)!=null&&(t=t.integrations)!=null&&t[a]||e.Jn(mc[a],(()=>{var t;(t=D.__PosthogExtensions__)==null||(t=t.integrations)==null||(t=t[a])==null||t.start(e._instance)})),!o&&(r=D.__PosthogExtensions__)!=null&&(r=r.integrations)!=null&&r[a]&&((i=D.__PosthogExtensions__)==null||(i=i.integrations)==null||(i=i[a])==null||i.stop())};for(var n of Object.entries((r=this._instance.config.integrations)==null?{}:r)){var r;t()}}},gc=class{constructor(e,t){this.I=e,this.no=t,this.so=new Map,this.ao=!1}add(e){var t=this;return k((function*(){if(t.ao)throw Error(`Cannot add an extension to a disposed ExtensionRuntime`);if(t.so.has(e.name))throw Error(`Browser extension "`+e.name+`" is already registered`);t.so.set(e.name,e);try{var n=e.setup(t.no);n&&(yield n)}catch(n){var r=t.so.get(e.name)===e;r&&t.so.delete(e.name),t.I.error(`Failed to set up browser extension "`+e.name+`"`,n),r&&t.oo(e)}}))()}dispose(){if(!this.ao){this.ao=!0;var e=Array.from(this.so.values()).reverse();for(var t of(this.so.clear(),e))this.oo(t)}}
2oo(e){try{var t=e.dispose==null?void 0:e.dispose();t&&Ne(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)}}},_c=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if(typeof e==`string`)return t==null?void 0:t.get_property(e);var n={};for(var r of e){var i=t==null?void 0:t.get_property(r);F(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)}},vc=`extensionsRemoteConfig`,yc=class{constructor(e){this.ao=!1,this.instance=e,this.I=B,this.lo=e.uo,this.kv=new _c(e),this.onEvent=e=>Po(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.ao)return Po((()=>{}));var t=t=>{try{e(t)}catch(e){this.I.error(`Browser extension remote config listener failed`,e)}},n=this.instance.ho.on(vc,t);return this.lo&&t(this.lo),Po(n)},this.do=new gc(B.createLogger(`[BrowserExtensions]`),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property(pr))==null?this.distinctId:e}get deviceId(){var e=this.instance.get_property(pr);return typeof e==`string`?e:void 0}get library(){return{name:O.LIB_NAME,version:O.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)==null?void 0:t.get_initial_props())==null?{}:e}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,r,i=(e=this.instance.sessionManager)==null?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=i==null?void 0:i.sessionId)==null?``:t,windowId:(n=i==null?void 0:i.windowId)==null?``:n,sessionStartTimestamp:(r=i==null?void 0:i.sessionStartTimestamp)==null?0:r}}catch{return{sessionId:``,windowId:``,sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.do.add(e)}capture(e,t,n){var r=this;return k((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 Po(this.instance.vo(e))}handleRemoteConfig(e){this.ao||(this.lo=e,this.instance.ho.emit(vc,e))}sendRequest(e,t){var n=this;return k((function*(){var r;t===void 0&&(t={});var i=n.instance.requestRouter.endpointFor((r=t.target)==null?`api`:r,e),a={method:t.method,url:t.query?Os(i,t.query):i,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt};return t.transport===`sendBeacon`?(n.instance._send_request(a),{statusCode:202}):new Promise((e=>{a.callback=e,n.instance._send_request(a)}))}))()}dispose(){this.ao||(this.ao=!0,this.do.dispose())}},bc={},xc=0,Sc=()=>{},Cc=`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`,wc=`Surveys module not available`,Tc=`sanitize_properties is deprecated. Use before_send instead`,Ec=`Invalid value for property_denylist config: `,Dc=[`token`,`distinct_id`,li],Oc=`posthog`,kc=!ws&&(w==null?void 0:w.indexOf(`MSIE`))===-1&&(w==null?void 0:w.indexOf(`Mozilla`))===-1,Ac=e=>{var t;return A({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,asset_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Ai(v==null?void 0:v.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:Sc,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e==null?`unset`:e,__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:y&&I(y==null?void 0:y.search)&&y.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:(h==null||(t=h.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:_i,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:zs},error_tracking:{},_onCapture:Sc},(e=>({rageclick:e&&e>=`2026-05-30`?{content_ignorelist:Ta,ignore_text_selection:!0}
2:!e||`2025-11-30`>e||{content_ignorelist:!0},capture_pageview:!e||`2025-05-24`>e||`history_change`,session_recording:e&&e>=`2026-06-25`?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>=`2026-05-30`?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>=`2026-05-30`?250:0,split_storage:!(!e||`2026-05-30`>e),detect_google_search_app:!(!e||`2026-05-30`>e),disable_capture_url_hashes:!(!e||`2026-06-25`>e),cookieWinsOnConflict:!(!e||e===`unset`||`2026-08-29`>e)}))(e))},jc=[[`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`]],Mc=e=>{var t={};for(var n of jc){var r=n[0],i=n[1];F(e[r])||(t[i]=e[r])}var a=G({},t,e),o=e.__preview_external_dependency_versioned_paths;return F(o)||(F(e.strict_script_versioning)&&(a.strict_script_versioning=!!o),I(o)&&F(e.asset_host)&&(a.asset_host=o)),N(e.property_blacklist)&&(F(e.property_denylist)?a.property_denylist=e.property_blacklist:N(e.property_denylist)?a.property_denylist=[...e.property_blacklist,...e.property_denylist]:B.error(Ec+e.property_denylist)),a},Nc=class{constructor(){this.__forceAllowLocalhost=!1}get co(){return this.__forceAllowLocalhost}set co(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Pc=class e{fo(e,t){if(e){var n=this.so.indexOf(e);n!==-1&&this.so.splice(n,1)}return this.so.push(t),t.initialize==null||t.initialize(),t}po(){return this.config.cookieless_mode===hi||this.config.cookieless_mode===mi&&this.consent.isRejected()}mo(){if(!this.po()&&this.get_distinct_id()===ci){var e=this.persistence;if(e){this.yo()||e.load(!0);var t=this.get_distinct_id();if(!t||t===ci){var n=this.config.get_device_id(Ri());this.register({distinct_id:n,$device_id:n}),e.set_property(H,U)}this.bo()}}}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!=null&&e}constructor(){var t;this.webPerformance=new Nc,this._o=!1,this.version=O.LIB_VERSION,this.wo=new Set,this.ko=``,this.ho=new Ks,this.so=[],this.So=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ac(),this.SentryIntegration=$a,this.sentryIntegration=e=>function(e,t){var n=Qa(e,t);return{name:Za,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.xo=!1,this.Co=null,this.To=null,this.Mo=null,this.scrollManager=new Us(this),this.pageViewManager=new eo(this),this.rateLimiter=new Wo(this),this.requestRouter=new sc(this),this.consent=new na(this),this.externalIntegrations=new hc(this);var n=(t=e.__defaultExtensionClasses)==null?{}:t;this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(e,t,n)=>{var r=I(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=I(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on(`eventCaptured`,(e=>B.info(`send "`+(e==null?void 0:e.event)+`"`,e)))}init(t,n,r){if(r&&r!==Oc){var i,a=(i=bc[r])==null?new e:i;return a._init(t,n,r),bc[r]=a,bc[Oc][r]=a,a}return this._init(t,n,r)}_init(e,t,n){var r,i;t===void 0&&(t={});var a,o=I(e)?e.trim():``;if(!o)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 o===((a=this.config)==null?void 0:a.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('`+o+`', { ... }, 'project2')`),this;this.__loaded=!0,this.config=Ac(t.defaults),t.debug=this.Eo(t.debug),this.Io=t,this.Ro=[],t.person_profiles?this.To=t.person_profiles:t.process_person&&(this.To=t.process_person);var s=Ac(t.defaults),c=Mc(t),l=G({},s,c,{name:n,token:o});P(s.rageclick)&&P(c.rageclick)&&(l.rageclick=G({},s.rageclick,c.rageclick)),P(s.session_recording)&&P(c.session_recording)&&(l.session_recording=G({},s.session_recording,c.session_recording)),this.set_config(l),this.config.on_xhr_error&&B.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:Fo.GZipJS;var u=this.yo();if(this.persistence=new No(this.config,u),this.sessionPersistence=this.config.persistence===`
2sessionStorage`||this.config.persistence===`memory`?this.persistence:new No(A({},this.config,{persistence:`sessionStorage`}),u,!1),this.ko=`ph_`+(this.config.persistence_name||this.config.token)+`_session_registered_properties`,this.config.persistence!==`memory`&&!u&&Y.Lr()){var d=Y.Pr(this.ko);N(d)&&d.forEach((e=>{I(e)&&this.wo.add(e)}))}else Y.Dr(this.ko);var f=A({},this.persistence.props),p=A({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Po=new Bs((e=>this.Ao(e)),this.config.request_queue_config),this.Fo=new Hs(this),this.__request_queue=[];var m=this.po();if(m||(this.sessionManager=new Ys(this),this.sessionPropsManager=new Gs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((e,t,n)=>{(n!=null&&n.activityTimeout||n!=null&&n.sessionPastMaximumLength||n!=null&&n.crossTabAdoption)&&this.Oo()}))),this.Lo(),this.config.__preview_deferred_init_extensions?(B.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.$o(m)}),0)):(B.info(`Initializing extensions synchronously`),this.$o(m)),O.DEBUG=O.DEBUG||this.config.debug,O.DEBUG&&B.info(`Starting in debug mode`,{this:this,config:t,thisC:A({},this.config),p:f,s:p}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=A({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((i=t.bootstrap)==null?void 0:i.distinctID)!==void 0){var g=t.bootstrap.distinctID,_=this.get_distinct_id(),v=this.persistence.get_property(H);if(t.bootstrap.isIdentifiedID&&_!=null&&_!==g&&v===U)this.identify(g);else if(t.bootstrap.isIdentifiedID&&_!=null&&_!==g&&v===gi)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 y=this.config.get_device_id(Ri()),b=t.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(H,t.bootstrap.isIdentifiedID?gi:U),this.register({distinct_id:g,$device_id:b})}}if(m)this.register_once({distinct_id:ci,$device_id:null},``);else if(!this.get_distinct_id()){var x=this.config.get_device_id(Ri());this.register_once({distinct_id:x,$device_id:x},``),this.persistence.set_property(H,U)}return K(h,`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()||Ri();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(H,gi)),t()},i=n.user();`then`in i&&Ne(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{typeof Promise<`u`&&Promise.resolve||Xa.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()||(Xa.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Xa.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,bi),identify:e=>t(e,Si),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}(this,(()=>this.Do())):this.Do(),Ne(this.config._onCapture)&&this.config._onCapture!==Sc&&(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 Zs.apply(this,arguments)}().then((e=>{e&&this.register({[mr]:e})})).catch(Sc),this}Lo(){var t,n,r,i,a,o,s=(t=(n=this.config.__extensionClasses)==null?void 0:n.featureFlags)==null?(r=e.__defaultExtensionClasses)==null?void 0:r.featureFlags:t;s&&(this.featureFlags&&this.featureFlags instanceof s||((i=this.No)==null||i.call(this),this.No=void 0,this.featureFlags=new s(this)),Ne(this.featureFlags.onReloading)&&Ne(this.featureFlags.setup)?this.No||(this.No=this.featureFlags.onReloading((()=>{this.ho.emit(`featureFlagsReloading`,!0)})),this.qo().add(this.featureFlags)):(a=(o=this.featureFlags).initialize)==null||a.call(o))}$o(t){var n,r,i,a,o,s,c,l=performance.now(),u=A({},e.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.so.push(this.exceptions=(n=this.exceptions)==null?new u.exceptions(this):n),u.historyAutocapture&&this.so.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.so.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.so.push(this.siteApps=new u.
2siteApps(this)),u.sessionRecording&&!t&&this.so.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.so.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.so.push(this.surveys=(r=this.surveys)==null?new u.surveys(this):r),u.logs&&this.so.push(this.logs=(i=this.logs)==null?new u.logs(this):i),u.metrics&&this.so.push(this.metrics=(a=this.metrics)==null?new u.metrics(this):a),u.conversations&&this.so.push(this.conversations=(o=this.conversations)==null?new u.conversations(this):o),u.productTours&&this.so.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.so.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.so.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.so.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.so.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ja)),u.toolbar&&this.so.push(this.toolbar=(s=this.toolbar)==null?new u.toolbar(this):s),u.experiments&&this.so.push(this.experiments=(c=this.experiments)==null?new u.experiments(this):c),this.so.forEach((e=>{e.initialize&&d.push((()=>{e.initialize==null||e.initialize()}))})),d.push((()=>{if(this.jo){var e=this.jo;this.jo=void 0,this.so.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}})),this.Bo(d,l)}Bo(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.Bo(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({[ui]:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,[di]:r}),this.config.__preview_deferred_init_extensions&&B.info(`PostHog extensions initialized (`+r+`ms)`)}Zs(e){var t;if(!v||!v.body)return B.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Zs(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this.jo=e),this.uo=e,this.compression=void 0,e.ok){var n,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=M(r.supportedCompression,Fo.GZipJS)?Fo.GZipJS:M(r.supportedCompression,Fo.Base64)?Fo.Base64:void 0),(n=r.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.To?this.To:_i}),(t=this.Ho)==null||t.handleRemoteConfig(e),this.so.forEach((t=>t.onRemoteConfig==null?void 0:t.onRemoteConfig(e)))}Do(){try{this.config.loaded(this)}catch(e){B.critical("`loaded` function failed",e)}if(this.zo(),this.config.internal_or_test_user_hostname&&y!=null&&y.hostname){var e=y.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.po())&&this.Uo()}),1),this.Wo=new Ko(this),this.Wo.load()}zo(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Po)==null||e.enable())}_dom_loaded(){this.is_capturing()&&wi(this.__request_queue,(e=>this.Ao(e))),this.__request_queue=[],this.zo()}_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.Vo()&&this.capture(xi),(n=this.logs)==null||n.flushLogs(`sendBeacon`),(r=this.Po)==null||r.unload(),(i=this.Fo)==null||i.unload()):this.Vo()&&this.capture(xi,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded?kc?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=A({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression:e.compression,(F(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,
2(e=>{var t,n,r,i=A({},e);i.timeout=i.timeout||6e4;var a,o,s,c,l,u=(t=i.transport)==null?`fetch`:t;u===`sendBeacon`&&F(i.compression)&&i.data&&(i.compression=Fo.Base64),i.method===`POST`&&i.data&&(i.timestampMode===`capture-body`?i.data={api_key:(o=(l=(c=(N(a=i.data)?a:[a]).map((e=>A({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{}))))[0])==null||(s=l.properties)==null?void 0:s.token)==null?l==null?void 0:l.token:o,batch:c,sent_at:new Date().toISOString()}:i.timestampMode===`body`&&(i.data=function(e,t){return t===void 0&&(t=new Date().toISOString()),N(e)?e.map((e=>A({},e,{sent_at:t}))):A({},e,{sent_at:t})}(i.data))),i.url=Ls(i.url,i.method,i.compression,i.timestampMode);var d=Rs.filter((e=>!i.disableTransport||!e.transport||!i.disableTransport.includes(e.transport))),f=(n=(r=function(e,t){for(var n=0;e.length>n;n++)if(e[n].transport===u)return e[n]}(d))==null?void 0:r.method)==null?d[0].method:n;if(!f)throw Error(`No available transport method`);var p=e=>{try{f(e)}catch(e){Ps(e)?B.warn(e):B.error(e),i.callback==null||i.callback({statusCode:0,error:e})}};u!==`sendBeacon`&&i.data&&i.compression===Fo.GZipJS&&C&&typeof Promise<`u`&&!Es?Ms(i).then((e=>{p(e)})).catch((t=>{if(pe(t))return Es=!0,void p(A({},i,{compression:void 0,url:Ls(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 pe(e)||t===ue})(t)&&(Es=!0),p(i)})):f(i)})(A({},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}))}
2Ao(e){this.Fo?this.Fo.retriableRequest(e):this._send_request(e)}_execute_array(e){xc++;try{var t,n=[],r=[],i=[];wi(e,(e=>{if(e){if(N(t=e[0]))i.push(e);else if(Ne(e))try{e.call(this)}catch(t){B.error(`Error executing queued PostHog call`,e,t)}else N(e)&&t===`alias`?n.push(e):N(e)&&t.indexOf(`capture`)!==-1&&Ne(this[t])?i.push(e):r.push(e)}}));var a=function(e,t){wi(e,(function(e){try{if(N(e[0])){var n=t;W(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{xc--}}push(t){if(xc>0&&N(t)&&I(t[0])){var n=e.prototype[t[0]];Ne(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,n){var r,i,a,o,s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Po){if(this.is_capturing()){if(!F(e)&&I(e)){this.mo();var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var l=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(l==null||!l.isRateLimited){t!=null&&t.$current_url&&!I(t==null?void 0: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.Go||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 u=new Date,d=(n==null?void 0:n.timestamp)||u,f=nn(n==null?void 0:n.uuid,Ri),p={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},d,f)};e===bi&&this.config.__preview_capture_bot_pageviews&&c&&(p.event=`$bot_pageview`,p.properties.$browser_type=`bot`),l&&(p.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var m=e===`$feature_flag_called`&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property(Br);n!=null&&n.$set&&!m&&(p.$set=n==null?void 0:n.$set);var h=n==null?void 0:n.$unset;h&&(p.$unset=h);var g,_,v,y=m?void 0:this.Zo(n==null?void 0:n.$set_once,e!==Ci,e===Si);if(y&&(p.$set_once=y),n!=null&&n._noTruncate||(i=this.config.properties_string_max_length,a=p,o=e=>I(e)?e.slice(0,i):e,s=new Set,p=function e(t,n){if(t!==Object(t))return o?o(t):t;if(!s.has(t)){var r;if(s.add(t),N(t))r=[],wi(t,(t=>{r.push(e(t))}));else{var i={};W(t,((t,n)=>{s.has(t)||(i[n]=e(t,n))})),r=i}return r}}(a)),p.timestamp=d,F(n==null?void 0:n.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=u),m&&(p.properties=function(e,t){t===void 0&&(t=[]);var n={},r=t=>{e[t]!==void 0&&(n[t]=e[t])};return ae.forEach(r),t.forEach(r),n}(p.properties,Dc)),e===Ro.DISMISSED||e===Ro.SENT){var b=t==null?void 0:t[zo.SURVEY_ID],x=t==null?void 0:t[zo.SURVEY_ITERATION];uc({id:b,current_iteration:x}),p.$set=A({},p.$set,{[(g={id:b,current_iteration:x},_=e===Ro.SENT?`responded`:`dismissed`,v=`$survey_`+_+`/`+g.id,g.current_iteration&&g.current_iteration>0&&(v=`$survey_`+_+`/`+g.id+`/`+g.current_iteration),v)]:!0})}else e===Ro.SHOWN&&(p.$set=A({},p.$set,{[zo.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Vo.SHOWN){var S=t==null?void 0:t[Ho.TOUR_TYPE];S&&(p.$set=A({},p.$set,{[Ho.TOUR_LAST_SEEN_DATE+`/`+S]:new Date().toISOString()}))}var C=A({},p.properties.$set,p.$set);if(Pe(C)||this.setPersonPropertiesForFlags(C),!L(this.config.before_send)){var w=this.mn(p);if(!w)return;(p=w).uuid=nn(p.uuid,Ri)}this.ho.emit(`eventCaptured`,p);var T=(r=n==null?void 0:n._url)==null?this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint):r,E={method:`POST`,url:T,data:p,compression:`best-available`,timestampMode:(n==null?void 0:n._batchKey)===`recordings`||/\/s\/(?:\?|$)/.test(T)?`body`:`capture-body`,batchKey:n==null?void 0:n._batchKey,transport:n==null?void 0:n.transport};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Ao(E):this.Po.enqueue(E),p}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)))}qo(){var e;return(e=this.Ho)==null?this.Ho=new yc(this):e}vo(e){this.So.push(e);var t=!0;return()=>{if(t){t=!1;var n=this.So.indexOf(e);n!==-1&&this.So.splice(n,1)}}}Qo(e){var t,n,r;return e===void 0&&(e=!0),!((t=this.persistence)==null||!t.consumeCookieIdentityChange())&&(this.Mo=null,this.persistence.get_property(H)===U&&((r=this.sessionPersistence)==null||r.clear(),this.wo.clear(),this.Jo()),(n=this.featureFlags)==null||n.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,n,r,i){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.Qo();var a=i?void 0:this.persistence.remove_event_timer(e),o=A({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.po()&&(o[li]=!0),e===`$snapshot`){var s=A({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!I(o.distinct_id)&&!R(o.distinct_id)||Fe(o.distinct_id))&&B.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}var c,l=function(e,t,n,r){var i,a,o,s;if(r===void 0&&(r=!1),!w)return{};var c,l=e?[...mo,...t||[]]:[],u=function(e){for(var t=0;$t.length>t;t++){var n=$t[t],r=n[1],i=n[0].exec(e),a=i&&(Ne(r)?r(i,e):r);if(a)return a}return[``,``]}(w),d=u[0],f=u[1],p=(c=typeof navigator<`u`?navigator:void 0)!=null&&c.brave?{brave:!0}:{},m={};F(n)||(m.detectGoogleSearchApp=n);var g={},_=(i=navigator)==null||(i=i.userAgentData)==null?void 0:i.platform,v=(a=navigator)==null?void 0:a.maxTouchPoints,b=h==null||(o=h.screen)==null?void 0:o.width,x=h==null||(s=h.screen)==null?void 0:s.height,S=h==null?void 0:h.devicePixelRatio;F(_)||(g.userAgentDataPlatform=_),F(v)||(g.maxTouchPoints=v),F(b)||(g.screenWidth=b),F(x)||(g.screenHeight=x),F(S)||(g.devicePixelRatio=S);
2var C,T,E,D,ee,k,A,j,te=G(Oi({$os:d,$os_version:f,$browser:Xt(w,navigator.vendor,p,m),$device:en(w),$device_type:(T=w,E=g,j=en(T),j===rt||j===nt||j===`Kobo`||j===`Kindle Fire`||j===Nt?tt:j===St||j===wt||j===Ct||j===At?`Console`:j===at?`Wearable`:j?Qe:(E==null?void 0:E.userAgentDataPlatform)===`Android`&&((D=E==null?void 0:E.maxTouchPoints)==null?0:D)>0?600>Math.min((ee=E==null?void 0:E.screenWidth)==null?0:ee,(k=E==null?void 0:E.screenHeight)==null?0:k)/((A=E==null?void 0:E.devicePixelRatio)==null?1:A)?Qe:tt:`Desktop`),$timezone:Eo(),$timezone_offset:Do()}),{$current_url:co(r?rn(y==null?void 0:y.href):y==null?void 0:y.href,l,go),$host:y==null?void 0:y.host,$pathname:y==null?void 0:y.pathname,$raw_user_agent:w.length>1e3?w.substring(0,997)+`...`:w,$browser_version:Qt(w,navigator.vendor,p,m),$browser_language:xo(),$browser_language_prefix:(C=xo(),typeof C==`string`?C.split(`-`)[0]:void 0),$screen_height:h==null?void 0:h.screen.height,$screen_width:h==null?void 0:h.screen.width,$viewport_height:h==null?void 0:h.innerHeight,$viewport_width:h==null?void 0:h.innerWidth,$lib:O.LIB_NAME,$lib_version:O.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return O.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=O.SDK_DIST_CHANNEL),te}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var u=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime(),!0),d=u.windowId;o.$session_id=u.sessionId,o.$window_id=d}this.sessionPropsManager&&G(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&G(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(f=this.Fo)==null?void 0:f.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===rc&&(o.$lib_custom_api_host=this.config.api_host),c=e!==bi||i?e!==xi||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=G(o,c),e===bi&&v&&(o.title=v.title),!F(a)){var p=n.getTime()-a;o.$duration=parseFloat((p/1e3).toFixed(3))}w&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`);var m=this.persistence.properties(),g=this.sessionPersistence.properties();W([`$referrer`,`$referring_domain`],(e=>{e in m&&delete g[e]}));var _={};if(this.So.length>0)for(var b of this.So.slice())try{G(_,b())}catch(e){B.error(`Failed to produce browser extension event properties`,e)}(o=G({},l,m,g,A({},_,o))).$is_identified=this._isIdentified(),N(this.config.property_denylist)?W(this.config.property_denylist,(function(e){delete o[e]})):B.error(Ec+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(B.error(Tc),o=x(o,e));var S=this.Ko();return o.$process_person_profile=S,S&&!i&&this.Yo(`_calculate_event_properties`),o}Zo(e,t,n){var r;if(t===void 0&&(t=!0),n===void 0&&(n=!1),!this.persistence||!this.Ko()||this._o&&!n)return e;var i=G({},this.persistence.get_initial_props(),((r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps())||{},e||{}),a=this.config.sanitize_properties;return a&&(B.error(Tc),i=a(i,`$set_once`)),t&&(this._o=!0),Pe(i)?void 0:i}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.Qo(),(n=this.sessionPersistence)==null||n.register(e),Object.keys(e).forEach((e=>this.wo.add(e))),this.Jo()}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.wo.delete(e),this.Jo()}Xo(e,t){this.register({[e]:t})}Oo(){this.wo.forEach((e=>{var t;(t=this.sessionPersistence)==null||t.unregister(e)})),this.wo.clear(),this.Jo()}Jo(){var e;if(this.ko){if(this.config.persistence===`memory`||(e=this.sessionPersistence)!=null&&e.ws||!Y.Lr())Y.Dr(this.ko);else{var t=[];
2this.wo.forEach((e=>t.push(e))),t.length>0?Y.Or(this.ko,t):Y.Dr(this.ko)}}}getFeatureFlag(e,t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.getAllFeatureFlags())==null?[]:e}isFeatureEnabled(e,t){var n,r;return(n=(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t))==null?t==null?void 0:t.defaultValue:n}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){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.ho.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:wc}),()=>{})}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))==null?()=>{}:t}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:wc})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:wc})}renderSurvey(e,t){var n;(n=this.surveys)==null||n.renderSurvey(e,t)}displaySurvey(e,t){var n;t===void 0&&(t=fc),(n=this.surveys)==null||n.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,n;return(t=(n=this.surveys)==null?void 0:n.canRenderSurvey(e))==null?{visible:!1,disabledReason:wc}:t}canRenderSurveyAsync(e,t){var n,r;return t===void 0&&(t=!1),(n=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))==null?Promise.resolve({visible:!1,disabledReason:wc}):n}tl(e){return!e||Fe(e)?(B.critical(`Unique user id has not been set in posthog.identify`),!1):e===ci?(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 not a hardcoded string.`),!1)}identify(e,t,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning(`posthog.identify`);if(R(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.tl(e)&&this.Yo(`posthog.identify`)){this.mo();var r=this.get_distinct_id(),i=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,a=this.Qo(!1),o=this.persistence.xs(),s=!1;try{var c=this.get_distinct_id();this.register({$user_id:e}),this.get_property(pr)||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},``),e!==c&&e!==this.get_property(hr)&&(this.unregister(hr),this.register({distinct_id:e}));var l,u=(this.persistence.get_property(H)||U)===U,d=e!==c,f=!d&&u;if(d&&u)this.persistence.set_property(H,gi),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Cs(),this.capture(Si,{distinct_id:e,$anon_distinct_id:c},{$set:t||{},$set_once:n||{}}),this.Mo=$s(e,t,n),(l=this.featureFlags)==null||l.setAnonymousDistinctId(c);else if(f){this.persistence.set_property(H,gi);var p=t||{},m=n||{};this.setPersonPropertiesForFlags({$set:p,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Cs(),this.capture(`$set`,{$set:p,$set_once:m}),this.Mo=$s(e,t,n)}else(t||n)&&this.setPersonProperties(t,n);d||i||a?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Qr)):f&&(t||n)&&this.reloadFeatureFlags(),s=!0}finally{o&&this.persistence.Es(s)}}}setPersonProperties(e,t){if((e||t)&&this.Yo(`posthog.setPersonProperties`)){var n=$s(this.get_distinct_id(),e,t);this.Mo===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.Mo=n)}}unsetPersonProperties(e){var t,n=(N(e)?e:[e]).filter((e=>I(e)&&e.length>0));n.length!==0&&this.Yo(`posthog.unsetPersonProperties`)&&((t=this.featureFlags)==null||t.unsetPersonPropertiesForFlags(n,!0),this.capture(`$set`,{$unset:n}),this.Mo=null)}group(e,t,n){var r;if(e&&t){(r=this.persistence)==null||r.syncCookieProperties(),this.Qo();var i=this.getGroups(),a=i[e]!==t;if(a&&this.resetGroupPropertiesForFlags(e),this.register({$groups:A({},i,{[e]:t})}),a||n){var o={$group_type:e,$group_key:t};n&&(o.$group_set=n),this.capture(Ci,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.Yo(`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=Re(e)?e:e==null?void 0:e.resetDeviceID,n=Re(e)||e==null?void 0:e.bootstrap;this.el(t,!1,n)}el(e,t,n){var r,i,a;if(t===void 0&&(t=!1),B.info(`reset`),!this.__loaded)return B.uninitializedWarning(`posthog.reset`);var o=n==null?void 0:n.sessionID;this.config.bootstrap=n||((r=this.Io)==null?void 0:r.bootstrap)||{},(i=this.featureFlags)==null||i.updateConfig==null||i.updateConfig(this.config,this.Js());var s=this.get_property(pr),c=this.get_property(mr),l=this.get_property(Er),u=this.is_capturing();this.consent.reset(),t||!u||this.is_capturing()||console.warn(`[PostHog.js]`,"reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=(a=this.persistence)==null||a.xs==null?void 0:a.xs(),f=!1;try{var p,m,h,g,_,v,y,b,x,S,C,w,T,E;
2if((p=this.persistence)==null||p.clear(),(m=this.sessionPersistence)==null||m.clear(),this.wo.clear(),this.Jo(),F(l)||(C=this.persistence)==null||C.register({[Er]:l}),(h=this.surveys)==null||h.reset(),(g=this.Wo)==null||g.stop(),(_=this.featureFlags)==null||_.reset(),(v=this.conversations)==null||v.reset(),(y=this.logs)==null||y.reset(),(b=this.metrics)==null||b.reset(),(x=this.persistence)==null||x.set_property(H,U),(S=this.sessionManager)==null||S.resetSessionId(),this.Mo=null,this.config.cookieless_mode===hi)this.register_once({distinct_id:ci,$device_id:null},``);else{var D=this.config.get_device_id(Ri());this.register_once({distinct_id:D,$device_id:e?D:s},``),e||F(c)||this.register({[mr]:c})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID===void 0||this.po()||((E=this.persistence)==null||E.set_property(H,n.isIdentifiedID?gi:U),this.register({distinct_id:n.distinctID})),(w=this.featureFlags)==null||w.initialize(),!(F(o)||(T=this.sessionManager)!=null&&T.setBootstrapSessionId(o,!0)))){var O=A({},n);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,f=!0}finally{var ee;d&&((ee=this.persistence)==null||ee.Es==null||ee.Es(f))}this.reloadFeatureFlags()}shutdown(e){var t=this;return k((function*(){var e,n,r,i,a,o,s;if(t.__loaded){(e=t.Wo)==null||e.stop(),(n=t.Ho)==null||n.dispose(),(r=t.sessionRecording)==null||r.dispose(),(i=t.logs)==null||i.flushLogs(`sendBeacon`),(a=t.metrics)==null||a.flush(`sendBeacon`),(o=t.Po)==null||o.unload(),(s=t.Fo)==null||s.unload();try{var c;(c=t.featureFlags)==null||c.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.il()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.rl()}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)==null?``:e}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,a=(i=e.timestampLookBack)==null?10:i;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(dr)?(B.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.Yo(`posthog.alias`)?(F(t)&&(t=this.get_distinct_id()),e===t?(B.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.Xo(hr,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=A({},this.config);if(P(e)){var n,r,i,a,o,s,c,l,u,d,f,p;G(this.config,Mc(e));var m=this.yo();(n=this.persistence)==null||n.update_config(this.config,t,m),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new No(A({},this.config,{persistence:`sessionStorage`}),m,!1);var h=this.Eo(this.config.debug);Re(h)&&(this.config.debug=h),Re(this.config.debug)&&(this.config.debug?(O.DEBUG=!0,J.Lr()&&J.Or(`ph_debug`,!0),B.info(`set_config`,{config:e,oldConfig:t,newConfig:A({},this.config)})):(O.DEBUG=!1,J.Lr()&&J.Dr(`ph_debug`))),(r=this.featureFlags)==null||r.updateConfig==null||r.updateConfig(this.config,this.Js()),(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(),(u=this.exceptionObserver)==null||u.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)==null||d.startIfEnabledOrStop(),(f=this.surveys)==null||f.loadIfEnabled(),this.bo(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){O.LIB_NAME=e,O.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(A({},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(){var t,n;return(t=(n=this.logs)==null?void 0:n.logger)==null?e.nl:t}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,n;return(t=(n=this.toolbar)==null?void 0:n.loadToolbar(e))!=null&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)==null?Oc:e;return t!==Oc&&(t=Oc+`.`+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(H))===gi||((t=this.sessionPersistence)==null?void 0:t.get_property(H))===gi}Ko(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===_i&&!this._isIdentified()&&Pe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[hr])&&((t=this.persistence)==null||(t=t.props)==null||!t[si]))}Vo(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.Ko()||this.Yo(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Yo(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}Yo(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.Xo(si,!0),!0)}yo(){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!==mi)}bo(){var e,t,n,r,i=this.yo();return((e=this.persistence)==null?void 0:e.ws)!==i&&((n=this.persistence)==null||n.set_disabled(i)),((t=this.sessionPersistence)==null?void 0:t.ws)!==i&&((r=this.sessionPersistence)==null||r.set_disabled(i)),i&&(this.wo.clear(),this.Jo()),i}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==hi){if(this.po()){var r,i,a,o,s;this.el(!0,!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewM
2anager)==null||i.destroy(),this.sessionManager=new Ys(this),this.pageViewManager=new eo(this),this.persistence&&(this.sessionPropsManager=new Gs(this,this.sessionManager,this.persistence));var c,l=(a=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)==null?(s=e.__defaultExtensionClasses)==null?void 0:s.sessionRecording:a;l&&(this.sessionRecording=this.fo(this.sessionRecording,new l(this)),this.uo&&((c=this.sessionRecording)==null||c.onRemoteConfig==null||c.onRemoteConfig(this.uo)))}var u,d;this.consent.optInOut(!0),this.bo(),this.zo(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==mi&&((u=this.surveys)==null||u.loadIfEnabled()),(F(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((d=t==null?void 0:t.captureEventName)==null?`$opt_in`:d,t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Uo()}else B.warn(Cc)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===hi?B.warn(Cc):(this.config.cookieless_mode===mi&&this.consent.isOptedIn()&&this.el(!0,!0),this.consent.optInOut(!1),this.bo(),this.config.cookieless_mode===mi&&(this.register({distinct_id:ci,$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.Uo(),this.zo()))}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===hi||(this.config.cookieless_mode===mi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.bo()}_is_bot(){return _?Xs(_,this.config.custom_blocked_useragents):void 0}Uo(){v&&(v.visibilityState===`visible`?this.xo||(this.xo=!0,this.capture(bi,{title:v.title},{send_instantly:!0}),this.Co&&(v.removeEventListener(vi,this.Co),this.Co=null)):this.Co||(this.Co=this.Uo.bind(this),K(v,vi,this.Co)))}debug(e){!1===e?(h==null||h.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(h==null||h.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}))}Js(){var e=this.Io||{};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&&!L(e[t]),o=n in e&&!L(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}mn(e){var t;if(L(this.config.before_send))return e;var n=Object.keys((t=e.properties)==null?{}:t).filter(Ve),r=N(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var a of r)try{if(i=a(i),L(i)){var o=`Event '`+e.event+`' was rejected in beforeSend function`;return Be(e.event)?B.warn(o+`. This can cause unexpected behavior.`):B.info(o),null}i.properties&&!Pe(i.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 s of n)if(i.properties&&L(i.properties[s]))return B.warn(`Event '`+e.event+`' had its '`+s+`' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return i}getPageViewId(){var e;return(e=this.pageViewManager.Xn)==null?void 0:e.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)})}Eo(e){var t=Re(e)&&!e,n=J.Lr()&&J.Fr(`ph_debug`)===`true`;return!t&&(!!n||e)}};Pc.__defaultExtensionClasses={},Pc.nl=(()=>{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]]=Di(e.prototype[t[n]])}(Pc,[`identify`]);var Fc=class{constructor(e){this.disabled=!1===e;var t=P(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}},Ic=`$copy_autocapture`,Lc=V(`[AutoCapture]`);function Rc(e,t){return t.length>e?t.slice(0,e)+`...`:t}function zc(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!la(t));return t}function Bc(e,t){var n,r,i=t.e,a=t.maskAllElementAttributes,o=t.maskAllText,s=t.elementAttributeIgnoreList,c=t.elementsC
2hainAsString,l=t.disableCaptureUrlHashes;if(!la(e))return{props:{}};for(var u=[e],d=new Set([e]),f=e;f.parentNode&&!ua(f,`body`)&&pa>u.length;)if(fa(f.parentNode)){var p=f.parentNode.host;if(d.has(p))break;d.add(p),u.push(p),f=p}else{if(!la(f.parentNode)||d.has(f.parentNode))break;d.add(f.parentNode),u.push(f.parentNode),f=f.parentNode}var m,g,_=[],v={},y=!1,b=!1;if(W(u,(e=>{var t=Ma(e);if(ua(e,`a`)){var n=e.getAttribute(`href`);y=!!(t&&n&&Va(n))&&(l?rn(n):n)}M(ga(e),`ph-no-capture`)&&(b=!0),_.push(function(e,t,n,r,i){i===void 0&&(i=!1);var a=e.tagName.toLowerCase(),o={tag_name:a};ba.indexOf(a)>-1&&!n&&(o.$el_text=a.toLowerCase()===`a`||a.toLowerCase()===`button`?Rc(1024,Ha(e)):Rc(1024,va(e)));var s=ga(e);s.length>0&&(o.classes=s.filter((function(e){return e!==``}))),W(e.attributes,(function(n){var a;if((!Na(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&Va(n.value)&&(!I(a=n.name)||a.substring(0,10)!==`_ngcontent`&&a.substring(0,7)!==`_nghost`)){var s=n.value;n.name===`class`&&(s=ma(s).join(` `)),o[`attr__`+n.name]=Rc(1024,n.name===`href`&&i?rn(s):s)}}));for(var c=1,l=1,u=e;u=zc(u);)c++,u.tagName===e.tagName&&l++;return o.nth_child=c,o.nth_of_type=l,o}(e,a,o,s,l)),G(v,function(e){if(!Ma(e))return{};var t={};return W(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&&Va(r)&&(t[n]=r)}})),t}(e))})),b)return{props:{},explicitNoCapture:b};if(o||(_[0].$el_text=ua(e,`a`)||ua(e,`button`)?Ha(e):va(e)),y){var x,S;_[0].attr__href=y;var C=(x=oo(y))==null?void 0:x.host,w=h==null||(S=h.location)==null?void 0:S.host;C&&w&&C!==w&&(m=y)}return{props:G({$event_type:i.type,$ce_version:1},c?{}:{$elements:_},{$elements_chain:(g=_,function(e){return e.map((e=>{var t,n,r=``;if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var i of(e.attr_class.sort(),e.attr_class))r+=`.`+i.replace(/"/g,``);var a=A({},e.text?{text:e.text}:{},{"nth-child":(t=e.nth_child)==null?0:t,"nth-of-type":(n=e.nth_of_type)==null?0:n},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Ti(a).sort(((e,t)=>e[0].localeCompare(t[0]))).forEach((e=>{var t=e[1];return o[Wa(e[0].toString())]=Wa(t.toString())})),(r+=`:`)+Ti(o).map((e=>e[0]+`="`+e[1]+`"`)).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t,n,r={text:(t=e.$el_text)==null?void 0:t.slice(0,400),tag_name:e.tag_name,href:(n=e.attr__href)==null?void 0:n.slice(0,2048),attr_class:Ga(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ti(e).filter((e=>e[0].indexOf(`attr__`)===0)).forEach((e=>r.attributes[e[0]]=e[1])),r}))}(g)))},(n=_[0])!=null&&n.$el_text?{$el_text:(r=_[0])==null?void 0:r.$el_text}:{},m&&i.type===`click`?{$external_click_url:m}:{},v)}}var Vc=V(`[ExceptionAutocapture]`),Hc=()=>{},Uc=V(`[TracingHeaders]`),Wc=V(`[Web Vitals]`),Gc=9e5,Kc=`disabled`,qc=`lazy_loading`,Jc=`awaiting_config`,Yc=`missing_config`;V(`[SessionRecording]`),V(`[SessionRecording]`);var Xc=`[SessionRecording]`,Zc=V(Xc),Qc=V(`[Heatmaps]`);function $c(e){return P(e)&&`clientX`in e&&`clientY`in e&&R(e.clientX)&&R(e.clientY)}var el=V(`[Product Tours]`),tl=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(wr))},nl=[`$set_once`,`$set`],rl=V(`[SiteApps]`),il=`Error while initializing PostHog app with config id `;function al(e,t,n){if(L(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 ol=class{constructor(e){this.sl=new Ks,this.al=(e,t)=>this.ol(e,t)&&this.ll(e,t)&&this.ul(e,t)&&this.hl(e,t),this.ol=(e,t)=>t==null||!t.event||(e==null?void 0:e.event)===(t==null?void 0:t.event),this._instance=e,this.dl=new Set,this.vl=new Set}init(){var e,t;F((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}register(e){var t,n;if(!F((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,n;
2(t=this.vl)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.dl)==null||t.add((e==null?void 0:e.event)||``)}))})),(n=this._instance)!=null&&n.autocapture)){var r,i=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&i.add(e==null?void 0:e.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(i)}}on(e,t){var n;t!=null&&e.length!=0&&(this.dl.has(e)||this.dl.has(t.event))&&this.vl&&((n=this.vl)==null?void 0:n.size)>0&&this.vl.forEach((e=>{this.cl(t,e)&&this.sl.emit(`actionCaptured`,e.name)}))}fl(e){this.onAction(`actionCaptured`,(t=>e(t)))}cl(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.al(e,n))return!0;return!1}onAction(e,t){return this.sl.on(e,t)}ll(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`||!al(r,t.url,t.url_matching||`contains`))return!1}return!0}ul(e,t){return!!this.pl(e,t)&&!!this.gl(e,t)&&!!this.ml(e,t)}pl(e,t){var n;if(t==null||!t.href)return!0;var r=this.yl(e);if(r.length>0)return r.some((e=>al(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&al((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}gl(e,t){var n;if(t==null||!t.text)return!0;var r=this.yl(e);if(r.length>0)return r.some((e=>al(e.text,t.text,t.text_matching||`exact`)||al(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;!L(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=>al(e,a,o))))}ml(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}yl(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}hl(e,t){return t==null||!t.properties||t.properties.length===0||nc(t.properties.reduce(((e,t)=>{var n=N(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e==null?void 0:e.properties)}},sl=class{constructor(e){var t;this.bl=[],this._instance=e,this._l=new Map,this.wl=new Map,this.kl=new Map,(t=this._instance)==null||t.onSessionId==null||t.onSessionId((e=>this.Sl(e)))}xl(e){return!1}Cl(){return null}Tl(e){}Ml(){}El(e,t){return!!e&&nc(e.propertyFilters,t==null?void 0:t.properties)}Il(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}Rl(e,t,n){var r=(n===Io.Activation?this._l:this.wl).get(e),i=[];return this.Pl((e=>{i=e.filter((e=>r==null?void 0: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.El(a,t)}))}register(e){var t;F((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Al(e),this.Fl(e))}Fl(e){var t=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.actions)&&((n=e.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Ol==null&&(this.Ol=new ol(this._instance),this.Ol.init(),this.Ol.fl((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.Ol)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.kl.get(t.name);n&&n.push(e.id),this.kl.set(t.name,n||[e.id])}})))})))}Al(e){var t,n=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.events)&&((n=e.conditions)==null||(n=n.events)==null||(n=n.values)==null?void 0:n.length)>0})),r=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.cancelEvents)&&((n=e.conditions)==null||(n=n.cancelEvents)==null||(n=n.values)==null?void 0:n.length)>0}));n.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this._l=this.Il(e,Io.Activation),this.wl=this.Il(e,Io.Cancellation))}onEvent(e,t){var n,r,i=this.Ll(),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.$l(e,a);if(o===`consume`)return i.info(`event consumed activated item, remov
2ing it`,{event:e,itemId:a}),void this.Dl([a]);if(o===`persist`)return i.info(`shown item promoted to persisted activation`,{event:e,itemId:a}),this.Nl(a),void this.ql([a])}if(this.wl.has(e)){var s=this.Rl(e,t,Io.Cancellation);s.length>0&&(i.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:s.map((e=>e.id))}),this.Dl(s.map((e=>e.id))),s.forEach((e=>this.jl(e.id))))}if(this._l.has(e)){i.info(`event name matched`,{event:e,eventPayload:t,items:this._l.get(e)});var c=this.Rl(e,t,Io.Activation);this.Bl(c.map((e=>e.id)))}}onAction(e){this.kl.has(e)&&this.Bl(this.kl.get(e)||[])}Bl(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.xl(i)?this.Nl(i)&&this.Hl(i):r.push(i);r.length>0&&(this.bl=[...new Set([...this.bl,...r])]),this.Ll().info(`updating activated items`,{activatedItems:this.getActivatedIds()})}}Nl(e){this.bl=this.bl.filter((t=>t!==e));var t=this.zl();return!t.includes(e)&&(this.Ul([...t,e]),this.Wl(),!0)}Dl(e){var t=new Set(e);this.bl=this.bl.filter((e=>!t.has(e)));var n=this.Vl(),r=n.filter((e=>!t.has(e)));r.length!==n.length&&(this.Ul(r),r.length===0&&this.Gl()),this.ql(e)}Zl(){var e,t=this.Cl();if(!t)return{};var n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return n&&typeof n==`object`?n:{}}Hl(e){if(this.Cl()){var t=this.Zl();this.Tl(A({},t,{[e]:Date.now()}))}}ql(e){if(this.Cl()){var t=this.Zl(),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&&(Pe(n)?this.Ml():this.Tl(n))}}Ql(){this.Cl()&&this.Ml()}getActivationTimestamp(e){if(this.zl().includes(e)){var t=this.Zl()[e];return R(t)?t:void 0}}Vl(){var e,t=this.Jl();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}zl(){var e,t,n=this.Vl();if(n.length===0)return[];var r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[this.Kl()],i=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();return i&&r===i?n:[]}Wl(){var e,t=(e=this._instance)==null||e.get_session_id==null?void 0:e.get_session_id();t&&this.Yl(t)}Gl(){this.Xl()}Sl(e){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this.Kl()];if(n&&n!==e){var r=this.Vl(),i=this.Zl();r.length>0&&(this.Ul([]),r.filter((e=>R(i[e]))).forEach((e=>this.jl(e)))),this.Gl(),this.Ql()}}getActivatedIds(){return[...new Set([...this.zl(),...this.bl])].filter((e=>!this.tu(e)))}reset(){this.bl=[],this.Vl().length>0&&this.Ul([]),this.Gl(),this.Ql()}getEventToItemsMap(){return this._l}eu(){return this.Ol}},cl=class extends sl{constructor(e){super(e)}Jl(){return Jr}Kl(){return Yr}Cl(){return Xr}Tl(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Xr]:e})}Ml(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Xr)}xl(e){var t,n;this.Pl((t=>{n=t.find((t=>t.id===e))}));var r=(t=n)==null||(t=t.appearance)==null?void 0:t.surveyPopupDelaySeconds;return R(r)&&r>0}iu(){return Ro.SHOWN}Pl(e){var t;(t=this._instance)==null||t.getSurveys(e)}jl(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}Ll(){return Z}Ul(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Jr]:e})}Yl(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Yr]:e})}Xl(){var e;(e=this._instance)==null||(e=e.persistence)==null||e.unregister(Yr)}tu(){return!1}$l(e,t){var n;return this.Pl((e=>{n=e.find((e=>e.id===t))})),!n||function(e){var t;return cc(e)&&!((t=e.conditions)==null||(t=t.events)==null||!t.repeatedActivation)||e.schedule===`always`}(n)?e===Ro.SHOWN?`consume`:`ignore`:e===Ro.SHOWN?`persist`:e===Ro.DISMISSED||e===Ro.SENT?`consume`:`ignore`}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},ll=`SDK is not enabled or survey functionality is not yet loaded`,ul=`Disabled. Not loading surveys.`,dl=h!=null&&h.location?lo(h.location.hash,`__posthog`)||lo(location.hash,`state`):null,fl=`_postHogToolbarParams`,pl=V(`[Toolbar]`),ml=V(`[FeatureFlags]`),hl=class{constructor(e,t){t===void 0&&(t=!1),this.ru=!1,this.update(e,t)}update(e,t){this.nu=((e,t)=>{var n,r,i,a;return{bootstrap:{featureFlags:(n=e.bootstrap)==null?void 0:n.featureFlags,featureFlagPayloads:(r=e.bootstrap)==null?void 0:r.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?`none`:`base64`,evaluationContexts:(i=(a=e.evaluation_contexts)==null?e.evaluation_environments:a)==null?[]:i,flagKeys:N(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.ru||(ml.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.ru=!0),F(e.flag_keys)||N(e.flag_keys)||ml.error(`Invalid flag_keys found:`,e.flag_keys,`Expected array of non-empty strings`)}get(){return this.nu}},gl=V(`[FeatureFlags]`),_l=V(`[FeatureFlags]`,{debugEnabled:!0}),vl=`" failed. Feature flags didn't load in time.`,yl=`connection_error`,bl=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},xl=e=>{var t={};for(var n of Ti(e||{})){var r=n[1];r&&(t[n[0]]=r)}return t},Sl=V(`[Error tracking]`),Cl=[`chrome-extension://`,`moz-extension://`,`safari-extension:`,`safari-web-extension:`],wl=`Refusing to render web experiment since the viewer is a likely bot`,Tl={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Qs(t,e),not_regex:(e,t)=>!Qs(t,e),exact:(e,t)=>
2t===e,is_not:(e,t)=>t!==e},El=class e{get Oi(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.su(`retrieved web experiments from the server`),n.au=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.au&&(e.su(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.au)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);I(i)&&t.variants[i]&&n.ou(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.lu(o,n._instance)&&n.ou(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())e.su(wl);else if(!this.Oi.disable_web_experiments){if(L(this.au))return this.au=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.su(`applying feature flags`,t),t.forEach((e=>{var t;if(this.au&&(t=this.au)!=null&&t.has(e)){var n,r=this._instance.getFeatureFlag(e),i=(n=this.au)==null?void 0:n.get(e);r&&i!=null&&i.variants[r]&&this.ou(i.name,r,i.variants[r].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=so(t==null?void 0:t.search,`__experiment_id`),r=so(t==null?void 0:t.search,`__experiment_variant`);n&&r&&(e.su(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.uu(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this.Oi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this.Oi.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.Oi.token),method:`GET`,timestampMode:`query`,callback:t=>e(t.statusCode===200&&t.json&&t.json.experiments||[])})}uu(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.su(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.ou(i[0].name,n,i[0].variants[n].transforms))}static lu(t,n){return!L(t.conditions)&&e.hu(t,n)&&e.du(t)}static hu(t,n){var r;if(L(t.conditions)||L((r=t.conditions)==null?void 0:r.url))return!0;var i=e.getWindowLocation();if(i){var a,o,s,c=ra(n,i.href);return(a=t.conditions)==null||!a.url||Tl[(o=(s=t.conditions)==null?void 0:s.urlMatchType)==null?`icontains`:o](t.conditions.url,c)}return!1}
2static getWindowLocation(){return h==null?void 0:h.location}static du(e){var t;if(L(e.conditions)||L((t=e.conditions)==null?void 0:t.utm))return!0;var n=vo();if(n.utm_source){var r,i,a,o,s,c,l,u,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==n.utm_campaign,f=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==n.utm_source,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,m=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_term||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_term)==n.utm_term;return d&&p&&m&&f}return!1}static su(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)}ou(t,n,r){this._is_bot()?e.su(wl):n===`control`?e.su(`Control variants leave the page unmodified.`):r.forEach((r=>{if(r.selector){var i;e.su(`applying transform of variant `+n+` for experiment `+t+` `,r);var a=(i=document)==null?void 0:i.querySelectorAll(r.selector);a==null||a.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)}))}}))}_is_bot(){return _&&this._instance?Xs(_,this.Oi.custom_blocked_useragents):void 0}},Dl=V(`[Conversations]`),Ol=`Conversations not available yet.`,kl=`console`,Al=`__posthogHandledLogsRequestError`,jl=(e,t)=>{var n=e instanceof Error?e:Error(t);return n[Al]=!0,n},Ml=e=>!!e&&typeof e==`object`&&!0===e[Al],Nl={featureFlags:class{constructor(e){this.name=`featureFlags`,this.vu=!1,this.featureFlagEventHandlers=[],this.I=gl,this.cu={},this.fu={},this.pu=[],this.gu=!1,this.mu=!1,this.yu=0,this.bu=!1,this._u=!1,this.wu=!1,this.ku=!1,this.Su=0,this.Tt=()=>{var e=this.xu();this.Su=0,e&&this.reloadFeatureFlags()},`get`in e?this.Cu=e:(this.Tu=new hl(e.config,e.Js()),this.Cu=this.Tu)}updateConfig(e,t){var n;(n=this.Tu)==null||n.update(e,t)}setup(e){return this.Mu=e,this.I=e.logger.createLogger(`[FeatureFlags]`),n=()=>{this.Mu===e&&(this.Mu=void 0,this.no=e,this.Eu(e))},(t=e.kv.initialize())!=null&&t.then?t.then(n):n();var t,n}Eu(e){if(this.no===e)return h&&K(h,`online`,this.Tt),this.Iu=e.registerDynamicEventProperties((()=>this.Ru()?this.cu:this.fu)),this.Pu(),this.initialize()}destroy(){h==null||h.removeEventListener(`online`,this.Tt)}dispose(){var e;this.yu++,this._u=!1,this.Mu=void 0,this.no&&(this.Au(),(e=this.Iu)==null||e.dispose(),this.Iu=void 0,this.pu=[],h==null||h.removeEventListener(`online`,this.Tt),this.no=void 0)}get Oi(){return this.Cu.get()}Fu(e){var t;return(t=this.no)==null?void 0:t.kv.get(e)}Or(e){this.Ou((()=>{var t;return(t=this.no)==null?void 0:t.kv.set(e)}))}Dr(e){this.Ou((()=>{var t;return(t=this.no)==null?void 0:t.kv.remove(e)}))}Ou(e){try{e()}catch(e){this.I.error(`Failed to update feature flag persistence`,e)}}Pu(){var e={};for(var t of[Fr,Rr,zr,Vr]){var n=this.Fu(t);F(n)||(e[t]=n)}this.cu=e;var r=A({},e),i=this.Fu(Pr);if(i)for(var a of Object.entries(i))r[`$feature/`+a[0]]=a[1];this.fu=r}Ru(){var e=this.Oi.cacheTtlMs;if(!e||0>=e)return!1;var t=this.Fu(ti);return typeof t!=`number`||Date.now()-t>e}Lu(){return!!this.Ru()&&(this.ku||this.mu||(this.ku=!0,this.I.warn(`Feature flag cache is stale, triggering refresh...`),this.reloadFeatureFlags()),!0)}$u(){var e=this.Oi.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})):[]}Du(){var e=this.Oi.flagKeys;if(!F(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,t,n=this.Oi,r=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)==null?{}:e;if(Object.keys(r).length){var i,a,o=(i=(a=n.bootstrap)==null?void 0:a.featureFlagPayloads)==null?{}:i,s=Object.keys(r).filter((e=>!!r[e])).reduce(((e,t)=>(e[t]=r[t]||!1,e)),{}),c=Object.keys(o).filter((e=>s[e])).reduce(((e,t)=>(e[t]=o[t],e)),{});return this.Nu({featureFlags:s,featureFlagPayloads:c})}}
2updateFlags(e,t,n){var r,i,a=n!=null&&n.merge&&(r=this.Fu(Pr))!=null?r:{},o=n!=null&&n.merge&&(i=this.Fu(Rr))!=null?i:{},s=A({},a,e),c=A({},o,t),l={};for(var u of Object.entries(s)){var d=u[0],f=u[1];l[d]={key:d,enabled:ne(f),variant:re(f),reason:void 0,metadata:F(c==null?void 0:c[d])?void 0:{id:0,version:void 0,description:void 0,payload:c[d]}}}this.Nu({flags:l})}get hasLoadedFlags(){return this.gu}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Fu(Lr),t=this.Fu(Vr),n=this.Fu(Hr);if(!n&&!t)return e||{};var r=G({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t==null?void 0:t[i],l=F(c)?(a=s==null?void 0:s.enabled)!=null&&a:!!c,u=F(c)?s==null?void 0:s.variant:typeof c==`string`?c:void 0,d=n==null?void 0:n[i],f=A({},s,{enabled:l,variant:l?u==null?s==null?void 0:s.variant:u:void 0});l!==(s==null?void 0:s.enabled)&&(f.original_enabled=s==null?void 0:s.enabled),u!==(s==null?void 0:s.variant)&&(f.original_variant=s==null?void 0:s.variant),d&&(f.metadata=A({},s==null?void 0:s.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.vu||(this.I.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.vu=!0),r}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var r=e[n];return{key:n,enabled:ne(r),variant:re(r),payload:te(t[n])}}))}getFlagVariants(){var e=this.Fu(Pr),t=this.Fu(Vr);if(!t)return e||{};for(var n=G({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.vu||(this.I.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.vu=!0),n}getFlagPayloads(){var e=this.Fu(Rr),t=this.Fu(Hr);if(!t)return e||{};for(var n=G({},e||{}),r=Object.keys(t),i=0;r.length>i;i++)n[r[i]]=t[r[i]];return this.vu||(this.I.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.vu=!0),n}reloadFeatureFlags(){this.bu||this.Oi.featureFlagsDisabled||this.xu()||this.qu||(this.pu.slice().forEach((e=>{try{e()}catch(e){this.I.error(`Error while running feature flags reloading callback`,e)}})),this.qu=setTimeout((()=>{this.ju()}),5))}Au(){clearTimeout(this.qu),this.qu=void 0}onReloading(e){return this.pu.push(e),()=>{this.pu=this.pu.filter((t=>t!==e))}}ensureFlagsLoaded(){this.gu||this.mu||this.qu||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.bu=e}resetFlagCallReported(){this.Dr(Qr)}ju(e){this.Au();var t=this.no;if(t&&!this.Oi.remoteRequestsDisabled&&!this.xu()){if(this.mu)this._u=!0;else{var n={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:A({},t.initialPersonProperties,this.Fu(Ur)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fu(Wr),timezone:Eo()};F(t.deviceId)||(n.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Oi.featureFlagsDisabled)&&(n.disable_flags=!0);var r=this.$u();r.length&&(n.evaluation_contexts=r);var i=this.Du();F(i)||(n.flag_keys=i);var a=this.Oi.onlyEvaluateSurveyFeatureFlags,o=`/flags/?v=2`+(a?`&only_evaluate_survey_feature_flags=true`:``),s=this.yu;this.mu=!0;var c=()=>{this._u&&(this._u=!1,this.ju())},l=e=>{this.mu=!1,s===this.yu?(this.Or({[ei]:[yl]}),this.I.error(`Feature flag request failed`,e),c()):c()};try{t.sendRequest(o,{target:`flags`,method:`POST`,body:n,compression:this.Oi.compression===`base64`?Fo.Base64:void 0,sentAt:`body`,timeoutMs:this.Oi.requestTimeoutMs}).then((e=>{var t,r,i=(t=e.json)==null?{}:t,o=e.statusCode!==200;if(this.mu=!1,s===this.yu){if(this.Bu(e.statusCode),o||this._u||(this.$anon_distinct_id=void 0),!n.disable_flags||this._u){this.wu=!o;var l=[];e.error?l.push(e.error instanceof Error&&e.error.name===`AbortError`?`timeout`:e.error instanceof Error?yl:`unknown_error`):e.statusCode!==200&&l.push(`api_error_`+e.statusCode),i.errorsWhileComputingFlags&&l.push(`errors_while_computing_flags`);var u=!((r=i.quotaLimited)==null||!r.includes(`feature_flags`));u&&l.push(`quota_limited`),this.Or({[ei]:l}),u?this.I.warn(`You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more.`):n.disable_flags||this.Nu(i,o,{partialResponse:a}),c()}}else c()})).catch(l)}catch(e){l(e)}}}}xu(){return uo(this.Su,3)}Bu(e){this.Su=fo(e,this.Su,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){var n;if(t===void 0&&(t={}),!t.fresh||this.wu){if(this.gu||this.getFlags()&&this.getFlags().length>0){if(!this.Lu()){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)==null?r==null?void 0:r.enabled:n}}else this.I.warn(`getFeatureFlag for key "`+e+vl)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.wu){if(this.gu||this.getFlags()&&this.getFlags().length>0){if(!this.Lu()){var n,r=this.getFlagVariants(),i=e in r,a=r[e],o=this.getFlagPayloads()[e],s=String(a),c=this.Fu(zr)||void 0,l=this.Fu(ti)||void 0,u=this.Fu(Qr)||{};if(this.Oi.deduplicateCallsPerSession){var d,f=(d=this.no)==null?void 0:d.session.sessionId,p=this.Fu($r);
2f&&f!==p&&(u={},n=f)}if(t.send_event||!(`send_event`in t)){if(e in u&&u[e].includes(s))n&&this.Or({[Qr]:u,[$r]:n});else{var m,h,g,_,v,y,b,x,S,C,w,T;N(u[e])?u[e].push(s):u[e]=[s],this.Or(A({[Qr]:u},n?{[$r]:n}:{}));var E=this.getFeatureFlagDetails(e),D=[...(m=this.Fu(ei))==null?[]:m];F(a)&&D.push(`flag_missing`);var O={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o==null?null:o,$feature_flag_request_id:c,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(h=(g=this.Oi.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])==null?null:h,$feature_flag_bootstrapped_payload:(_=(v=this.Oi.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])==null?null:_,$used_bootstrap_value:!this.wu};F(E==null||(y=E.metadata)==null?void 0:y.has_experiment)||(O.$feature_flag_has_experiment=E.metadata.has_experiment),F(E==null||(b=E.metadata)==null?void 0:b.version)||(O.$feature_flag_version=E.metadata.version);var ee,k=(x=E==null||(S=E.reason)==null?void 0:S.description)==null?E==null||(C=E.reason)==null?void 0:C.code:x;k&&(O.$feature_flag_reason=k),E!=null&&(w=E.metadata)!=null&&w.id&&(O.$feature_flag_id=E.metadata.id),F(E==null?void 0:E.original_variant)&&F(E==null?void 0:E.original_enabled)||(O.$feature_flag_original_response=F(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(T=E.metadata)!=null&&T.original_payload&&(O.$feature_flag_original_payload=E==null||(ee=E.metadata)==null?void 0:ee.original_payload),D.length&&(O.$feature_flag_error=D.join(`,`)),this.Hu(O)}}else n&&this.Or({[Qr]:u,[$r]:n});if(i)return{key:e,enabled:!!a,variant:typeof a==`string`?a:void 0,payload:te(o)}}}else this.I.warn(`getFeatureFlagResult for key "`+e+vl)}}Hu(e){try{var t;(t=this.no)==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.zu(e,t)}zu(e,t){var n=this;return k((function*(){var r=n.no;if(r){var i={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},a=n.$u();a.length&&(i.evaluation_contexts=a);var o,s=n.Du();F(s)||(i.flag_keys=s);try{var c,l=(c=(yield r.sendRequest(`/flags/?v=2`,{target:`flags`,method:`POST`,body:i,compression:n.Oi.compression===`base64`?Fo.Base64:void 0,sentAt:`body`,timeoutMs:n.Oi.requestTimeoutMs})).json)==null?void 0:c.featureFlagPayloads;o=(l==null?void 0:l[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.wu)return t.defaultValue;if(!(this.gu||this.getFlags()&&this.getFlags().length>0))return this.I.warn(`isFeatureEnabled for key "`+e+vl),t.defaultValue;var n=this.getFeatureFlag(e,t);return F(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.Nu(e,t,n)}Nu(e,t,n){if(this.no){this.gu=!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=gl);var o=((e,t)=>{var n=e.flags;return n?A({},e,{featureFlags:Object.fromEntries(Object.keys(n).map((e=>{var t;return[e,(t=n[e].variant)==null?n[e].enabled:t]}))),featureFlagPayloads:Object.fromEntries(Object.keys(n).filter((e=>n[e].enabled)).filter((e=>{var t;return(t=n[e].metadata)==null?void 0:t.payload})).map((e=>{var t;return[e,(t=n[e].metadata)==null?void 0:t.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(N(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{[Fr]:c,[Pr]:f,[Br]:!1}}var m=c,h=l,g=s;if(i!=null&&i.partialResponse)m=A({},t,m),h=A({},n,h),g=A({},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=A({},t,Object.fromEntries(Object.entries(m).filter((e=>_.has(e[0]))))),h=A({},n,Object.fromEntries(Object.entries(h||{}).filter((e=>_.has(e[0]))))),g=A({},r,Object.fromEntries(Object.entries(g||{}).filter((e=>_.has(e[0])))))}else m=A({},t,m),h=A({},n,h),g=A({},r,g)}return A({[Fr]:Object.keys(xl(m)),[Pr]:m||{},[Rr]:h||{},[Lr]:g||{},[Br]:!0===e.minimalFlagCalledEvents},u?{[zr]:u}:{},d?{[ti]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.I);r&&this.Or(r),t||(this.ku=!1),this.Uu(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.Wu(e)}Wu(e){if(this.no){if(!1===e)return this.Dr([Vr,Hr]),this.Uu(),void _l.info(`All overrides cleared`);if(N(e))return this.Or({[Vr]:bl(e)}),this.Uu(),void _l.info(`Flag overrides set`,{flags:e});if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;this.vu=!!((t=n.suppressWarning)!=null&&t);var r={},i=n.flags,a=n.payloads;i&&(r[Vr]=N(i)?bl(i):i),a&&(r[Hr]=a),Object.keys(r).length&&this.Or(r),!1===i&&!1===a?this.Dr([Vr,Hr]):!1===i?this.Dr(Vr):!1===a&&this.Dr(Hr),this.Uu(),!1===i?_l.info(`Flag overrides cleared`):i&&_l.
2info(`Flag overrides set`,{flags:i}),!1===a?_l.info(`Payload overrides cleared`):a&&_l.info(`Payload overrides set`,{payloads:a});return}if(e&&typeof e==`object`)return this.Or({[Vr]:e}),this.Uu(),void _l.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.gu){var t=this.Vu(),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.Fu(Ir)||[]).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=A({},this.getFlagVariants(),{[e]:t});this.Or({[Fr]:Object.keys(xl(o)),[Pr]:o,[Ur]:A({},this.Fu(Ur)||{},i)}),this.Uu();try{var s;(s=this.no)==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.Fu(Ir);!r||t?this.Gu(e,n):e(r)}Gu(e,t){var n=this;return k((function*(){var r=n.no;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.Or({[Ir]: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)}}}))()}Vu(){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)),{})}}Uu(e){this.Pu();var t=this.Vu(),n=t.flags,r=t.flagVariants;this.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.Zu(e,t)}Zu(e,t){t===void 0&&(t=!0);var n=this.Fu(Ur)||{},r=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),i=e==null?void 0:e.$set_once,a={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(a[o]=i[o]));this.Or({[Ur]:A({},n,a,r)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=A({},this.Fu(Ur)||{});e.forEach((e=>{delete n[e]})),this.Or({[Ur]:n}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this.Dr(Ur),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.Fu(Wr)||{},r=A({},n);for(var i of Object.keys(e))r[i]=A({},n[i],e[i]);this.Or({[Wr]:r}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Fu(Wr)||{};this.Or({[Wr]:A({},t,{[e]:{}})})}else this.Dr(Wr)}reset(){this.yu++,this._u=!1,this.cu={},this.fu={},this.gu=!1,this.bu=!1,this.wu=!1,this.$anon_distinct_id=void 0,this.Au(),this.vu=!1,this.Su=0}}},Pl={sessionRecording:class{get Oi(){return this._instance.config}get Sa(){return this._instance.persistence}get started(){var e;return!((e=this.Qu)==null||!e.isStarted)}get status(){var e,t;return this.Ju===Jc||this.Ju===Yc||(e=(t=this.Qu)==null?void 0:t.status)==null?this.Ju:e}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ju=Kc,this.Ku=void 0,this.Yu=!1,this.kt=(()=>{var e;if(v==null||!v.visibilityState||v.visibilityState===`visible`)return!0;var t=h==null||(e=h.performance)==null||e.getEntriesByType==null?void 0:e.getEntriesByType(`visibility-state`);return!(t!=null&&t.length)||t.some((e=>e.name===`visible`))})(),this.It=()=>{var e;(v==null?void 0:v.visibilityState)===`visible`&&(this.kt=!0,(e=this.Qu)==null||e.setDocumentWasEverVisible==null||e.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Zc.error(`started without valid sessionManager`),Error(Xc+` started without valid sessionManager. This is a bug.`);if(this.Oi.cookieless_mode===hi)throw Error(Xc+` cannot be used with cookieless_mode="always"`);v!=null&&v.addEventListener&&K(v,`visibilitychange`,this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Yu=!0,v==null||v.removeEventListener==null||v.removeEventListener(`visibilitychange`,this.It),this.stopRecording()}get Xu(){var e,t=!((e=this._instance.get_property(Er))==null||!e.enabled),n=!this.Oi.disable_session_recording,r=this.Oi.disable_session_recording||this._instance.consent.isOptedOut();return h&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!(this.Yu||this.Xu&&(t=this.Qu)!=null&&t.isStarted)){var n=!F(Object.assign)&&!F(Array.from);this.Xu&&n?(this.th(e),Zc.info(`starting`)):(this.Ju=Kc,this.stopRecording())}}th(e){var t,n,r;this.Xu&&(this.Ju!==Jc&&this.Ju!==Yc&&(this.Ju=qc),D!=null&&(t=D.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=D.__PosthogExtensions__)!=null&&n.initSessionRecording?this.eh(e):(r=D.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.ih,(t=>{if(t)return this._instance.register_for_session({[fi]:!0}),Zc.error(`could not load recorder`,t);this.eh(e)})))}stopRecording(){var e,t;(e=this.Ku)==null||e.call(this),this.Ku=void 0,(t=this.Qu)==null||t.stop()}rh(){var e,t;(e=this.Ku)==null||e.call(this),this.Ku=void 0,(t=this.Qu)==null||t.discard()}nh(){var e,t;(e=this.Sa)==null||e.unregister(Nr),(t=this.Sa)==null||t.unregister(Dr)}sh(e,t){if(L(e))return null;var n,r=R(e)?e:parseFloat(e);return typeof(n=r)!=`number`||!Number.isFinite(n)||0>n||n>1?(Zc.warn(t+` must be between 0 and 1. Ignoring invalid value:`,e),null):r}ah(e){if(this.Sa){var t,n,r=this.Sa,i=()=>{var t,n=!1===e.sessionRecording?void 0:e.sessionRecording,i=this.sh((t=this.Oi.session_recording)==null?void 0:t.sampleRate,`session_recording.sampleRate`),a=this.sh(n==null?void 0:n.sampleRate,`remote config sampleRate`),o=i==null?a:i;L(o)&&this.nh();var s=n==null?void 0:n.minimumDurationMilliseconds;r.register({[Er]:A({cache_timestamp:Date.now(),enabled:!!n},n,{networkPayloadCapture:A({capturePerformance:e.capturePerformance},n==null?void 0:n.networkPayloadCapture),canvasRecording:{enabled:n==null?void 0:n.recordCanvas,fps:n==null?void 0:n.canvasFps,quality:n==null?void 0:n.canvasQuality},sampleRate:o,minimumDurationMilliseconds:F(s)?null:s,endpoint:n==null?void 0:n.endpoint,triggerMatchType:n==null?void 0:n.triggerMatchType,masking:n==null?void 0:n.masking,urlTriggers:n==null?void 0:n.urlTriggers,version:n==null?void 0:n.version,triggerGroups:n==null?void 0:n.triggerGroups})})};i(),(t=this.Ku)==null||t.call(this),this.Ku=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;t&&`sessionRecording`in t?!1===t.sessionRecording?(this.ah(t),this.rh()):(this.ah(t),this.startIfEnabledOrStop()):(this.Ju===Jc&&(this.Ju=Yc,Zc.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.Qu)!=null&&n.log?this.Qu.log(e,t):Zc.warn(`log called before recorder was ready`)}get ih(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Er);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}oh(){var e,t=this._instance.get_property(Er);if(!t)return!1;try{e=typeof t==`object`?t:JSON.parse(t)}catch(e){return Zc.warn(`persisted remote config for session recording is invali
2d and will be ignored`,e),!1}return!L(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}eh(e){var t,n,r;if(!this.Yu){if((t=D.__PosthogExtensions__)==null||!t.initSessionRecording)return Zc.warn(`Called on script loaded before session recording is available. This can be caused by adblockers.`),void this._instance.register_for_session({[fi]:!0});var i;if(this.Qu||(this.Qu=(i=D.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance,this.kt),this.Qu._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.oh()){if(this.Ju===Yc||this.Ju===Jc)return;this.Ju=Jc,Zc.info(`persisted remote config is stale, requesting fresh config before starting`),new Ko(this._instance).load();return}this.Ju=qc,(n=(r=this.Qu).setDocumentWasEverVisible)==null||n.call(r,this.kt),this.Qu.start(e)}}onRRwebEmit(e){var t;(t=this.Qu)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Qu||(t=this.Sa)==null||t.register({[kr]:!0}),(e=this.Qu)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Qu||(t=this.Sa)==null||t.register({[Or]:!0}),(e=this.Qu)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.Qu||(n=this.Sa)==null||n.register({[e===`url`?Ar:jr]:!0}),(t=this.Qu)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Qu)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.Qu)==null||!n.tryAddCustomEvent(e,t))}}},Fl={autocapture:class{constructor(e){this.lh=!1,this.uh=null,this.hh=!1,this.dh=!1,this.instance=e,this.rageclicks=new Fc(e.config.rageclick),this.fh=null}initialize(){this.startIfEnabled()}get Oi(){var e,t,n=P(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((e=>new RegExp(e))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((e=>new RegExp(e))),n}ph(){if(this.isBrowserSupported()){if(h&&v){var e=e=>{e=e||(h==null?void 0:h.event);try{this.gh(e)}catch(e){Lc.error(`Failed to capture event`,e)}};if(K(v,`submit`,e,{capture:!0}),K(v,`change`,e,{capture:!0}),K(v,`click`,e,{capture:!0}),this.Oi.capture_copied_text){var t=e=>{e=e||(h==null?void 0:h.event);try{this.gh(e,Ic)}catch(e){Lc.error(`Failed to capture copy/cut event`,e)}};K(v,`copy`,t,{capture:!0}),K(v,`cut`,t,{capture:!0})}}}else Lc.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.lh&&(this.ph(),this.lh=!0)}onRemoteConfig(e){if(this.hh=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.dh=t.elementsChainAsString);var n=t.autocapture_opt_out;Re(n)&&(this.instance.persistence&&this.instance.persistence.register({[_r]:n}),this.uh=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.fh=e}getElementSelectors(e){var t,n=[];return(t=this.fh)==null||t.forEach((t=>{var r=v==null?void 0:v.querySelectorAll(t);r==null||r.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[_r],r=this.uh,i=this.instance.Js()&&!this.hh;if(Ie(r)&&!Re(n)&&!i)return!1;var a=(t=this.uh)==null?!!n:t;return!!this.instance.config.autocapture&&!a}gh(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n,r=ya(e);da(r)&&(r=r.parentNode||null),t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&ka(r,this.instance.config.rageclick)&&this.gh(e,`$rageclick`);var i=t===Ic;if(r&&function(e,t,n,r,i,a){var o;if(!h||Aa(e)||n!=null&&n.url_allowlist&&!ha(n.url_allowlist,a)||n!=null&&n.url_ignorelist&&ha(n.url_ignorelist,a))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=ja(e,r),l=c.parentIsUsefulElement,u=c.targetElementList;if(!function(e,t){var n=t==null?void 0:t.element_allowlist;if(F(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)||!xa(u,n==null?void 0:n.css_selector_allowlist)||xa(u,(o=n==null?void 0:n.css_selector_ignorelist)==null?Ca:o))return!1;try{var d=h.getComputedStyle(e);
2if(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&&(ba.indexOf(f)>-1||e.getAttribute(`contenteditable`)===`true`)}}(r,e,this.Oi,i,i?[`copy`,`cut`]:void 0,this.instance)){var a=Bc(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Oi.element_attribute_ignorelist,elementsChainAsString:this.dh,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=a.props;if(a.explicitNoCapture)return!1;var s=this.getElementSelectors(r);if(s&&s.length>0&&(o.$element_selectors=s),t===Ic){var c,l=_a(h==null||(c=h.getSelection())==null?void 0:c.toString()),u=e.type||`clipboard`;if(!l)return!1;o.$selected_content=l,o.$copy_type=u}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Ne(v==null?void 0:v.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.mh=(h==null||(t=h.location)==null?void 0:t.pathname)||``}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(B.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.yh&&this.yh(),this.yh=void 0,B.info(`History API monitoring stopped`)}monitorHistoryChanges(){h&&h.history&&(this.bh(`pushState`),this.bh(`replaceState`),this._h())}bh(e){var t;if(h&&((t=h.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(e,t,n){try{if(!(t in e))return Hc;var 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 Ne(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];Ne(n)&&n.__posthog_layer__;){var a=n.__posthog_layer__;if(a.next===i)return void(a.next=r.next);n=a.next}else e[t]=r.next}}catch{return Hc}})(h.history,e,(t=>function(r,i,a){t.call(this,r,i,a),n.wh(e)}))}}wh(e){try{var t,n=h==null||(t=h.location)==null?void 0:t.pathname;if(!n)return;n!==this.mh&&this.isEnabled&&this._instance.capture(bi,{navigation_type:e}),this.mh=n}catch(t){B.error(`Error capturing `+e+` pageview`,t)}}_h(){if(!this.yh){var e=()=>{this.wh(`popstate`)};K(h,`popstate`,e),this.yh=()=>{h&&h.removeEventListener(`popstate`,e)}}}},heatmaps:class{get Oi(){return this.instance.config}constructor(e){var t;this.kh=!1,this.lh=!1,this.Sh=null,this.instance=e,this.kh=!((t=this.instance.persistence)==null||!t.props[vr]),this.rageclicks=new Fc(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return P(this.Oi.capture_heatmaps)&&this.Oi.capture_heatmaps.flush_interval_milliseconds&&(e=this.Oi.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.Oi.capture_heatmaps)?L(this.Oi.enable_heatmaps)?this.kh:this.Oi.enable_heatmaps:!1!==this.Oi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.lh)return;Qc.info(`starting...`),this.xh(),this.It()}else{var e;clearInterval((e=this.Sh)==null?void 0:e),this.Ch(),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({[vr]:n}),this.kh=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.ft;return this.ft=void 0,e}Th(e){$c(e.originalEvent)&&this.mi(e.originalEvent,`deadclick`)}It(){this.Sh&&clearInterval(this.Sh),this.Sh=(v==null?void 0:v.visibilityState)===`visible`?setInterval(this.ca.bind(this),this.flushIntervalMilliseconds):null}xh(){h&&v&&(this.Mh=this.ca.bind(this),K(h,yi,this.Mh),this.Eh=e=>this.mi(e||(h==null?void 0:h.event)),K(v,`click`,this.Eh,{capture:!0}),this.Ih=e=>this.Rh(e||(h==null?void 0:h.event)),K(v,`mousemove`,this.Ih,{capture:!0}),this.Ph=new Ya(this.instance,qa,this.Th.bind(this)),this.Ph.startIfEnabledOrStop(),this.Ah=this.It.bind(this),K(v,vi,this.Ah),this.lh=!0)}Ch(){var e;h&&v&&(this.Mh&&h.removeEventListener(yi,this.Mh),this.Eh&&v.removeEventListener(`click`,this.Eh,{capture:!0}),this.Ih&&v.removeEventListener(`mousemove`,this.Ih,{capture:!0}),this.Ah&&v.removeEventListener(vi,this.Ah),clearTimeout(this.Fh),(e=this.Ph)==null||e.stop(),this.lh=!1)}Oh(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(e,t,n){for(var r=e;r&&la(r)&&!ua(r,`body`);){if(r===n)return!1;var i=void 0;try{var a,o,s;i=(a=(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?h:o)==null?void 0:a.getComputedStyle(r).position}catch{return!1}if(M(t,i))return!0;r=Sa(r)}return!1}(ya(e),[`fixed`,`sticky`],i);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}mi(e,t){var n;if(t===void 0&&(t=`click`),!ca(e.target)&&$c(e)){var r=this.Oh(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ka(ya(e),this.instance.config.rageclick)&&this.Fn(A({},r,{type:`rageclick`})),this.Fn(r)}}Rh(e){!ca(e.target)&&$c(e)&&(clearTimeout(this.Fh),this.Fh=setTimeout((()=>{this.Fn(this.Oh(e,`mousemove`))}),500))}Fn(e){if(h){var t=this.Oi.disable_capture_url_hashes?rn(h.location.href):h.location.href,n=this.Oi.custom_personal_data_properties,r=co(t,this.Oi.mask_personal_data_properties?[...mo,...n||[]]:[],go);this.ft=this.ft||{},this.ft[r]||(this.ft[r]=[]),this.ft[r].push(e)}}ca(){this.ft&&!Pe(this.ft)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ya,webVitalsAutocapture:class{constructor(e){var t;this.kh=!1,this.lh=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lh=()=>{clearTimeout(this.$h),this.$h=void 0,this.ft.metrics.length!==0&&(this._instance.capture(`$web_vitals`,A({$current_url:this.ft.url},this.ft.metrics.reduce(((e,t)=>A({},e,{[`$web_vitals_`+t.name+`_event`]:A({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Dh=e=>{var t;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},L(e==null?void 0:e.name)||L(e==null?void 0:e.value))Wc.error(`Invalid metric received`,e);else{var n=typeof e.navigationURL==`string`?e.navigationURL:void 0,r=this.Nh(n);if(!F(r)){var i=R(e.navigationId)||typeof e.navigationId==`string`?`navigation:`+e.navigationId:`url:`+r;if(!this.qh||this.qh>e.value){this.ft.navigationKey!==i&&(this.Lh(),this.$h=setTimeout(this.Lh,this.flushToCaptureTimeoutMs)),F(this.ft.navigationKey)&&(this.ft.navigationKey=i,this.ft.url=r),this.ft.firstMetricTimestamp=F(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var a=(t=this._instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0),o=A({},e,n?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});
2F(a)||(o.$session_id=a.sessionId,o.$window_id=a.windowId),this.ft.metrics.push(o),this.ft.metrics.length===this.allowedMetrics.length&&this.Lh()}else Wc.error(`Ignoring metric with value >= `+this.qh,e)}}},this.jh=()=>{if(!this.lh){var e,t,n,r,i=D.__PosthogExtensions__,a=i==null?void 0:i.postHogWebVitalsCallbacksByFlavor,o=(a==null?void 0:a[this.Bh])||(this.Bh===`web-vitals`&&F(a)?i==null?void 0:i.postHogWebVitalsCallbacks:void 0);if(F(o)||(e=o.onLCP,t=o.onCLS,n=o.onFCP,r=o.onINP),e&&t&&n&&r){var s={reportSoftNavs:this.useSoftNavs};this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.Dh.bind(this),s),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.Dh.bind(this),s),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.Dh.bind(this),s),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.Dh.bind(this),s),this.lh=!0}else Wc.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.kh=!((t=this._instance.persistence)==null||!t.props[Sr]),this.startIfEnabled()}get Hh(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=P(this.Hh)?(e=this.Hh)==null?void 0:e.web_vitals_allowed_metrics:void 0;return L(n)?((t=this._instance.persistence)==null?void 0:t.props[Tr])||[`CLS`,`FCP`,`INP`,`LCP`]:n}get flushToCaptureTimeoutMs(){return(P(this.Hh)?this.Hh.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=P(this.Hh)?this.Hh.web_vitals_attribution:void 0;return e!=null&&e}get useSoftNavs(){var e=P(this.Hh)?this.Hh.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get qh(){var e=P(this.Hh)&&R(this.Hh.__web_vitals_max_value)?this.Hh.__web_vitals_max_value:Gc;return e>0&&6e4>=e?Gc:e}get isEnabled(){var e=y==null?void 0:y.protocol;if(e!==`http:`&&e!==`https:`)return Wc.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=P(this.Hh)?this.Hh.web_vitals:Re(this.Hh)?this.Hh:void 0;return Re(t)?t:this.kh}startIfEnabled(){this.isEnabled&&!this.lh&&(Wc.info(`enabled, starting...`),this.Jn(this.jh))}onRemoteConfig(e){if(e.ok){var t=e.config;if(`capturePerformance`in t){var n=P(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=P(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Sr]:n}),this._instance.persistence.register({[Tr]:r})),this.kh=n,this.startIfEnabled()}}}get Bh(){return this.useSoftNavs?this.useAttribution?`web-vitals-with-attribution-soft-navs`:`web-vitals-soft-navs`:this.useAttribution?`web-vitals-with-attribution`:`web-vitals`}Jn(e){var t=D.__PosthogExtensions__,n=this.Bh,r=t==null?void 0:t.postHogWebVitalsCallbacksByFlavor;r!=null&&r[n]||n===`web-vitals`&&F(r)&&t!=null&&t.postHogWebVitalsCallbacks?e():t==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,n,(t=>{t?Wc.error(`failed to load script`,t):e()}))}Nh(e){var t=e||(h==null?void 0:h.location.href);if(t){var n=this._instance.config.disable_capture_url_hashes?rn(t):t,r=this._instance.config.custom_personal_data_properties;return co(n,this._instance.config.mask_personal_data_properties?[...mo,...r||[]]:[],go)}Wc.error(`Could not determine current URL`)}}},Il={exceptionObserver:class{constructor(e){var t;this.jh=()=>{var e;if(h&&this.isEnabled&&(e=D.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=D.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=D.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=D.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.zh&&this.Oi.capture_unhandled_errors&&(this.zh=t(this.captureException.bind(this))),!this.Uh&&this.Oi.capture_unhandled_rejections&&(this.Uh=n(this.captureException.bind(this))),!this.Wh&&this.Oi.capture_console_errors&&(this.Wh=r(this.captureException.bind(this)))}catch(e){Vc.error(`failed to start`,e),this.Vh()}}},this._instance=e,this.Gh=!((t=this._instance.persistence)==null||!t.props[yr]),this.oe=new Ze(A({},function(e){var t,n,r,i;return e===void 0&&(e={}),{refillRate:(t=(n=e.exceptionRateLimiterRefillRate)==null?e.__exceptionRateLimiterRefillRate:n)==null?1:t,bucketSize:(r=(i=e.exceptionRateLimiterBucketSize)==null?e.__exceptionRateLimiterBucketSize:i)==null?10:r}}(this._instance.config.error_tracking),{refillInterval:1e4,I:Vc})),this.Oi=this.Zh(),this.startIfEnabledOrStop()}Zh(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(e)?t=A({},t,e):(F(e)?this.Gh:e)&&(t=A({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}
2get isEnabled(){return this.Oi.capture_console_errors||this.Oi.capture_unhandled_errors||this.Oi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Vc.info(`enabled`),this.Vh(),this.Jn(this.jh)):this.Vh()}Jn(e){var t,n;(t=D.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return Vc.error(`failed to load script`,t);e()}))}Vh(){var e,t,n;(e=this.zh)==null||e.call(this),this.zh=void 0,(t=this.Uh)==null||t.call(this),this.Uh=void 0,(n=this.Wh)==null||n.call(this),this.Wh=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;`autocaptureExceptions`in t&&(this.Gh=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[yr]:this.Gh}),this.Oi=this.Zh(),this.startIfEnabledOrStop())}}onConfigChange(){this.Oi=this.Zh()}captureException(e){var t,n,r,i=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)==null?`Exception`:t;this.oe.consumeRateLimit(i)?Vc.info(`Skipping exception capture because of client rate limiting.`,{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.Qh=[],this.Jh=new kn([new Vn,new Zn,new Un,new Hn,new Yn,new Jn,new Gn,new Xn],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=Bn.test(s)?s.replace(Bn,`$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 A({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||An});var n}))}(i)}}(`web:javascript`,In,zn)),this._instance=e,this.Qh=(t=(n=this._instance.persistence)==null?void 0:n.get_property(br))==null?[]:t,this.Kh=nr(this.Yh()),this.Xh=new rr(this.Kh)}onConfigChange(){this.Kh=nr(this.Yh()),this.Xh.setConfig(this.Kh)}onRemoteConfig(e){var t,n,r;if(e.ok){var i=e.config;if(`errorTracking`in i){var a=(t=(n=i.errorTracking)==null?void 0:n.suppressionRules)==null?[]:t,o=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Qh=a,this._instance.persistence&&this._instance.persistence.register({[br]:this.Qh,[xr]:o})}}}get td(){var e,t=!!this._instance.get_property(xr),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n==null?t:n)!=null&&e}buildProperties(e,t){return this.Jh.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.Kh.enabled)try{if(!I(e)||e.trim().length===0)return void Sl.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)=>er.has(r)?(t.push(r),n):(n[r]=e[r],n)),{}),droppedKeys:t}}(this.ed(t)),r=n.sanitizedProperties,i=n.droppedKeys;i.length>0&&Sl.warn(`Ignoring reserved exception step fields`,{droppedKeys:i}),this.Xh.add(A({[Qn]:e,[$n]:new Date().toISOString()},r))}catch(e){Sl.error(`Failed to add exception step. Ignoring breadcrumb.`,e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.rd(t)){if(this.nd(t))return this.sd(`Exception dropped: matched a suppression rule`),void Sl.info(`Skipping exception capture because a suppression rule matched`);if(!this.td&&this.ad(t))return this.sd(`Exception dropped: thrown by a browser extension`),void Sl.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.od(t))return this.sd(`Exception dropped: thrown by the PostHog SDK`),void Sl.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}var n=this.Kh.enabled&&L(e.$exception_steps)?this.ld(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`,Go:!0});return i&&this.Xh.clear(),i}catch(e){Sl.error(`Failed to capture exception event. Dropping this exception.`,e),this.Xh.clear();return}}catch(e){Sl.error(`Failed to process exception event. Ignoring this exception.`,e);return}var a}ld(e){try{var t=this.Xh.getAttachable();return t.length===0?e:A({},e,{$exception_steps:t})}catch(t){return Sl.error(`Failed to read buffered exception steps. Capturing exception without steps.`,t),e}}
3sd(e){this.Kh.enabled&&this.Xh.add({[Qn]:e,[$n]:new Date().toISOString()})}ed(e){return P(e)?A({},e):{}}Yh(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)==null?{}:e}nd(e){if(e.length===0)return!1;try{var t=e.reduce(((e,t)=>{var n=t.type,r=t.value;return I(n)&&n.length>0&&e.$exception_types.push(n),I(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Qh.some((e=>{var n=e.values.map((e=>{var n=ec[e.operator],r=t[e.key];if(!n||!r)return!1;var i=N(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 Sl.warn(`Failed to evaluate suppression rules. Capturing the exception.`,e),!1}}ad(e){return e.flatMap((e=>{var t,n;return(t=(n=e.stacktrace)==null?void 0:n.frames)==null?[]:t})).some((e=>{var t=e.filename;return!!t&&Cl.some((e=>t.startsWith(e)))}))}od(e){if(e.length>0){var t,n,r,i,a=(t=(n=e[0].stacktrace)==null?void 0:n.frames)==null?[]:t,o=a[a.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes(`posthog.com/static`))!=null&&r}return!1}rd(e){return!L(e)&&N(e)}}},Ll=A({productTours:class{get Sa(){return this._instance.persistence}constructor(e){this.ud=null,this.hd=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if(`productTours`in t){var n,r;if(this.Sa&&this.Sa.register({[wr]:!!t.productTours}),!tl(this._instance))return!this.ud&&L((n=this.Sa)==null?void 0:n.props[Zr])||el.info(`product tours disabled; stopping and clearing cached tours`),(r=this.ud)==null||r.stop(),this.ud=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ud&&tl(this._instance)&&this.Jn((()=>this.dd()))}Jn(e){var t,n;(t=D.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?el.error(`Could not load product tours script`,t):e()}))}dd(){var e;!this.ud&&(e=D.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.ud=D.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!N(this.hd)||t){var n=this.Sa;if(n){var r=n.props[Zr];if(N(r)&&!t)return this.hd=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(tl(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||el.warn(i):el.error(i),e([],{isLoaded:!1,error:i});return}var a=N(t.json.product_tours)?t.json.product_tours:[];this.hd=a,n&&n.register({[Zr]:a}),e(a,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.hd,{isLoaded:!0})}getActiveProductTours(e){L(this.ud)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.ud.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ud)==null||t.showTourById(e)}previewTour(e){this.ud?this.ud.previewTour(e):this.Jn((()=>{var t;this.dd(),(t=this.ud)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.ud)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.ud)==null||e.nextStep()}previousStep(){var e;(e=this.ud)==null||e.previousStep()}clearCache(){var e;this.hd=null,(e=this.Sa)==null||e.unregister(Zr)}resetTour(e){var t;(t=this.ud)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.ud)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ud)==null||t.cancelPendingTour(e)}}},Nl),Rl={siteApps:class{constructor(e){this.vd=0,this._instance=e,this.fd=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}pd(e,t){if(t){var n=this.globalsForEvent(t);this.fd.push(n),this.fd.length>1e3&&(this.fd=this.fd.slice(10))}}get siteAppLoaders(){var e;return(e=D._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.pd.bind(this));this.gd=()=>{e(),this.fd=[],this.gd=void 0}}}globalsForEvent(e){var t,n,r,i,a,o,s;if(!e)throw Error(`Event payload is required`);var c={},l=this._instance.get_property(`$groups`)||[],u=this._instance.get_property(`$stored_group_properties`)||{};
3for(var d of Object.entries(u)){var f=d[0];c[f]={id:l[f],type:f,properties:d[1]}}var p=e.$set_once,m=e.$set;return{event:A({},j(e,nl),{properties:A({},e.properties,m?{$set:A({},(t=(n=e.properties)==null?void 0:n.$set)==null?{}:t,m)}:{},p?{$set_once:A({},(r=(i=e.properties)==null?void 0:i.$set_once)==null?{}:r,p)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)==null?``:a,distinct_id:(s=e.properties)==null?void 0:s.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:c}}md(e){var t,n=(t=e.tagName)==null?void 0:t.toLowerCase();return n===`style`&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(rl.error(`prepare_external_dependency_stylesheet returned null`),null):n===`script`&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(rl.error(`prepare_external_dependency_script returned null`),null):e}yd(){var e,t,n,r,i,a,o,s;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var c=v==null?void 0:v.defaultView,l=c==null||(e=c.Node)==null?void 0:e.prototype;if(!c||!l)return()=>{};if(this.vd++,this.bd)return this._d();var u=[],d=this,f=new WeakSet,p=(e,t,n)=>{if(e!=null&&e[t]){var r=e[t];e[t]=n(r),u.push((()=>{e[t]=r}))}},m=e=>{if(f.has(e))return e;var t=d.md(e);return t&&f.add(t),t},h=e=>e.map((e=>typeof e==`string`?e:m(e))).filter((e=>!Ie(e)));return p(l,`appendChild`,(e=>function(t){var n=m(t);return n?e.call(this,n):t})),p(l,`insertBefore`,(e=>function(t,n){var r=m(t);return r?e.call(this,r,n):t})),p(l,`replaceChild`,(e=>function(t,n){var r=m(t);return r?e.call(this,r,n):n})),[(t=c.Element)==null?void 0:t.prototype,(n=c.Document)==null?void 0:n.prototype,(r=c.DocumentFragment)==null?void 0:r.prototype].forEach((e=>{p(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,h(n))})),p(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,h(n))}))})),[(i=c.Element)==null?void 0:i.prototype,(a=c.CharacterData)==null?void 0:a.prototype,(o=c.DocumentType)==null?void 0:o.prototype].forEach((e=>{p(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,h(n))})),p(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,h(n))})),p(e,`replaceWith`,(e=>function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=h(n);return n.length&&!i.length?void 0:e.apply(this,i)}))})),p((s=c.Element)==null?void 0:s.prototype,`insertAdjacentElement`,(e=>function(t,n){var r=m(n);return r?e.call(this,t,r):null})),this.bd=()=>{u.forEach((e=>e())),this.bd=void 0},this._d()}_d(){var e=!1;return()=>{var t;e||(e=!0,this.vd--,this.vd===0&&((t=this.bd)==null||t.call(this)))}}wd(e,t){t===void 0&&(t=!0);var n=this.yd();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.fd.length&&(rl.info(`Processing `+this.fd.length+` events for site app with id `+e.id),this.fd.forEach((e=>this.wd((()=>t.processEvent==null?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&((n=this.gd)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,rl.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var a=this.wd((t=>e.init({posthog:this._instance,callback(e){t(),i(e)}})),!1).processEvent;a&&(t.processEvent=a),r=!0}catch(t){rl.error(il+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){rl.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}kd(){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)}Sd(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),r=function(r){try{t.wd((()=>r.processEvent==null?void 0:r.processEvent(n)))}catch(t){rl.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.kd(),void this._instance.on(`eventCaptured`,(e=>this.Sd(e)))):void rl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.gd)==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;D[`__$$ph_site_app_`+t]=i._instance,(e=D.__PosthogExtensions__)==null||e.loadSiteApp==null||e.loadSiteApp(i._instance,n,(e=>{if(e)return rl.error(il+t,e)}))};for(var s of a.siteApps)o()}else rl.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}}}},zl={tracingHeaders:class{constructor(e){this.xd=void 0,this.Cd=void 0,this.Td=void 0,this.jh=()=>{var e,t,n=this.Md();n?(F(this.xd)&&(this.xd=(e=D.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),F(this.Cd)&&(this.Cd=(t=D.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(n,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Vh()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Jn(e){var t,n;(t=D.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=D.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return Uc.error(`failed to load script`,t);
3e()}))}Ed(){var e,t;return(e=(t=this._instance.config.tracing_headers)==null?this._instance.config.addTracingHeaders:t)==null?this._instance.config.__add_tracing_headers:e}Md(){var e=this.Ed();return N(e)?(N(this.Td)?this.Td.splice(0,this.Td.length,...e):this.Td=[...e],e.length>0?this.Td:void 0):(N(this.Td)&&this.Td.splice(0),this.Td=e||void 0,this.Td)}Vh(){var e,t;(e=this.xd)==null||e.call(this),(t=this.Cd)==null||t.call(this),this.xd=void 0,this.Cd=void 0}startIfEnabledOrStop(){this.Md()?this.Jn(this.jh):this.Vh()}}},Bl=A({surveys:class{get Oi(){return this._instance.config}constructor(e){this.Id=void 0,this._surveyManager=null,this.Rd=!1,this.Pd=[],this.Ad=null,this.Fd=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Oi.disable_surveys){if(!e.ok)return Z.warn(`Remote config unavailable. Not loading surveys.`);var t=e.config.surveys;if(L(t))return Z.warn(`Flags not loaded yet. Not loading surveys.`);var n=N(t);this.Id=n?t.length>0:t,Z.info(`flags response received, isSurveysEnabled: `+this.Id),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(lc)||r!=null&&r.startsWith(`inProgressSurvey_`))&&t.push(r)}t.forEach((e=>localStorage.removeItem(e)))}catch{}}loadIfEnabled(){if(!this._surveyManager){if(this.Rd)Z.info(`Already initializing surveys, skipping...`);else if(this.Oi.disable_surveys)Z.info(ul);else if(this.Oi.cookieless_mode&&this._instance.consent.isOptedOut())Z.info(`Not loading surveys in cookieless mode without consent.`);else{var e=D==null?void 0:D.__PosthogExtensions__;if(e){if(!F(this.Id)||this.Oi.advanced_enable_surveys){var t=this.Id||this.Oi.advanced_enable_surveys;this.Rd=!0;try{var n=e.generateSurveys;if(n)return void this.Od(n,t);var r=e.loadExternalDependency;if(!r)return void this.Ld(pi);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.Ld(`Could not load surveys script`,n):this.Od(e.generateSurveys,t)}))}catch(e){throw this.Ld(`Error initializing surveys`,e),e}finally{this.Rd=!1}}}else Z.error(`PostHog Extensions not found.`)}}}Od(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new cl(this._instance),Z.info(`Surveys loaded successfully`),this.$d({isLoaded:!0})}Ld(e,t){Z.error(e,t),this.$d({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pd.push(e),this._surveyManager&&this.$d({isLoaded:!0}),()=>{this.Pd=this.Pd.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Oi.disable_surveys)return Z.info(ul),e([]);var n,r=this._instance.get_property(Kr);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Dd()&&this.getSurveys((()=>{}),!0));typeof Promise<`u`&&this.Ad?this.Ad.then((t=>e(t.surveys,t.context))):(typeof Promise<`u`&&(this.Ad=new Promise((e=>{n=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this.Oi.token),method:`GET`,timestampMode:`query`,timeout:this.Oi.surveys_request_timeout_ms,callback:t=>{var r;this.Ad=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;i===0?t.error||Z.warn(a):Z.error(a),this.Fd=Date.now();var o={isLoaded:!1,error:a};e([],o),n==null||n({surveys:[],context:o});return}this.Fd=null;var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(cc(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[Kr]:c,[qr]:Date.now()});var u={isLoaded:!0};e(c,u),n==null||n({surveys:c,context:u})}}))}Dd(){return this.Nd()&&!this.Ad&&!this.qd()}Nd(){var e=this._instance.get_property(qr);return R(e)&&Date.now()-e>3e5}qd(){return R(this.Fd)&&3e5>Date.now()-this.Fd}markSurveyAsSeen(e,t){var n;uc({id:e,current_iteration:(n=t==null?void 0:t.iteration)==null?null:n});try{localStorage.setItem(`lastSeenSurveyDate`,new Date().toISOString())}catch{}}$d(e){for(var t of this.Pd)try{if(!e.isLoaded)return t([],e);
3this.getSurveys(t)}catch(e){Z.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Z.warn(`init was not called`)}jd(e){var t=null;return this.getSurveys((n=>{var r;t=(r=n.find((t=>t.id===e)))==null?null:r})),t}Bd(e){if(L(this._surveyManager))return{eligible:!1,reason:ll};var t=typeof e==`string`?this.jd(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}Hd(e){if(L(this._surveyManager))return{eligible:!1,reason:ll};var t=typeof e==`string`?this.jd(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(L(this._surveyManager))return Z.warn(`init was not called`),{visible:!1,disabledReason:ll};var t=this.Hd(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(Z.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:ll})):new Promise((n=>{this.getSurveys((t=>{var r,i=(r=t.find((t=>t.id===e)))==null?null:r;if(i){var a=this.Hd(i);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(L(this._surveyManager))Z.warn(`init was not called`);else{var i=typeof e==`string`?this.jd(e):e;if(i!=null&&i.id){if(dc.includes(i.type)){var a=v==null?void 0:v.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(Z.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e,t;Z.info(`Rendering survey `+i.id+` with delay of `+((e=i.appearance)==null?void 0:e.surveyPopupDelaySeconds)+` seconds`),(t=this._surveyManager)==null||t.renderSurvey(i,a,n),Z.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);Z.warn(`Survey element not found`)}else Z.warn(`Surveys of type `+i.type+` cannot be rendered in the app`)}else Z.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(L(this._surveyManager))Z.warn(`init was not called`);else{var r=this.jd(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=A({},r,{appearance:A({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Bo.Popover&&t.initialResponses&&Z.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.Bd(r);if(!a.eligible)return void Z.warn(`Survey is not eligible to be displayed: `,a.reason)}t.displayType===Bo.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else Z.warn(`Survey not found`)}}cancelPendingSurvey(e){L(this._surveyManager)?Z.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},Nl),Vl={toolbar:class{constructor(e){this.instance=e}zd(e){D.ph_toolbar_state=e}Ud(){var e;return(e=D.ph_toolbar_state)==null?0:e}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),ji(this.instance.config)||!h||!v)return!1;e=e==null?h.location:e,n=n==null?h.history:n;try{if(!t){try{h.localStorage.setItem(`test`,`test`),h.localStorage.removeItem(`test`)}catch{return!1}t=h==null?void 0:h.localStorage}var r,i=dl||lo(e.hash,`__posthog`)||lo(e.hash,`state`),a=i?Ei((()=>JSON.parse(atob(decodeURIComponent(i)))))||Ei((()=>JSON.parse(decodeURIComponent(i)))):null;return a&&a.action===`ph_authorize`?((r=a).source=`url`,r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(fl)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Wd(e){var t=D.ph_load_toolbar||D.ph_load_editor;!L(t)&&Ne(t)?t(e,this.instance):pl.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(v==null||!v.getElementById(ia));if(!h||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=A({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(h.localStorage.setItem(fl,JSON.stringify(A({},r,{source:void 0}))),this.Ud()===2)this.Wd(r);else if(this.Ud()===0){var i;this.zd(1),(i=D.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return pl.error(`[Toolbar] Failed to load`,e),void this.zd(0);this.zd(2),this.Wd(r)})),K(h,`turbolinks:load`,(()=>{this.zd(0),this.loadToolbar(r)}))}return!0}Vd(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)}}},Hl=A({experiments:El},Nl),Ul=A({},Nl,Pl,Fl,Il,Ll,Rl,Bl,zl,Vl,Hl,{conversations:class{constructor(e){this.Gd=void 0,this._conversationsManager=null,this.Zd=!1,this.Me=null,this.Qd=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this.Jd=e.ok,e.ok)){var t=e.config.conversations;
3L(t)||(Re(t)?this.Gd=t:(this.Gd=t.enabled,this.Me=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Gd=void 0,this.Me=null,this.Jd=void 0,this.Qd=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Zd||this._instance.config.disable_conversations||ji(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=D==null?void 0:D.__PosthogExtensions__;if(e&&!F(this.Gd)&&this.Gd){if(this.Me&&this.Me.token){this.Zd=!0;try{var t=e.initConversations;if(t)return this.Kd(t),void(this.Zd=!1);var n=e.loadExternalDependency;if(!n)return void this.Yd(pi);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.Yd(`Could not load conversations script`,t):this.Kd(e.initConversations),this.Zd=!1}))}catch(e){this.Yd(`Error initializing conversations`,e),this.Zd=!1}}else Dl.error(`Conversations enabled but missing token in remote config.`)}}}Kd(e){if(this.Me)try{this._conversationsManager=e(this.Me,this._instance),this.Qd=!1,Dl.info(`Conversations loaded successfully`)}catch(e){this.Yd(`Error completing conversations initialization`,e)}else Dl.error(`Cannot complete initialization: remote config is null`)}Yd(e,t){Dl.error(e,t),this._conversationsManager=null,this.Zd=!1,this.Qd=!0}show(){this._conversationsManager?this._conversationsManager.show():Dl.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Gd&&!Ie(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?`disabled_by_config`:ji(this._instance.config)?`disabled_for_toolbar`:this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?`consent_opted_out`:!1===this.Jd?`remote_config_failed`:F(this.Gd)?this.Jd?`disabled_in_project`:`remote_config_pending`:this.Gd?L(this.Me)||!this.Me.token?`missing_token`:D!=null&&D.__PosthogExtensions__?this.Zd?`initializing`:this.Qd?`load_failed`:`not_loaded`:`extensions_unavailable`:`disabled_in_project`}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return k((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Dl.warn(Ol),null)}))()}getMessages(e,t){var n=this;return k((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Dl.warn(Ol),null)}))()}markAsRead(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Dl.warn(Ol),null)}))()}getTickets(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Dl.warn(Ol),null)}))()}requestRestoreLink(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Dl.warn(Ol),null)}))()}restoreFromToken(e){var t=this;return k((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Dl.warn(Ol),null)}))()}restoreFromUrlToken(){var e=this;return k((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Dl.warn(Ol),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())==null?null:e}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())==null?null:e}il(){var e;(e=this._conversationsManager)==null||e.setIdentity()}rl(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t,n=this;this.Xd=!1,this.tv=!1,this.I=V(`[logs]`),this.ev=A({},this.I,{error(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(Ml)||n.I.error(...t)}}),this.ea=[],this.iv=[],this.Su=0,this.rv=()=>{var e,t;this.Su=0,(e=this.nv)==null||e.onReconnect(),(t=this.sv)==null||t.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Xd=!0),h&&K(h,`online`,this.rv)}av(e,t,n,r){var i,a=function(e,t){var n,r,i,a,o,s,c,l=(n=e==null?void 0:e.flushIntervalMs)==null?3e3:n,u=(r=e==null?void 0:e.maxBufferSize)==null?100:r,d=t!=null&&t.consoleCapture?void 0:(i=e==null?void 0:e.maxLogsPerInterval)==null?1e3:i,f=F(d)?Math.max(u,2048):Math.max(u,d),p=e==null?void 0:e.resourceAttributes;return{serviceName:(a=(o=p==null?void 0:p[`service.name`])==null?e==null?void 0:e.serviceName:o)==null?t==null?void 0:t.serviceNameDefault:a,serviceVersion:(s=p==null?void 0:p[`service.version`])==null?e==null?void 0:e.serviceVersion:s,environment:(c=p==null?void 0:p[`deployment.environment`])==null?e==null?void 0:e.environment:c,resourceAttributes:p,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:l,max
3BufferSize:u,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:l,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}((i=this._instance)==null||(i=i.config)==null?void 0:i.logs,n);return[new bn(this.ov(e,t),a,this.ev,(()=>this.lv()),(e=>e()),void 0,r),a]}uv(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.nv||this.hv!==t){var n;(n=this.nv)==null||n.reset(),this.hv=t;var r=this.av((()=>this.ea),(e=>{this.ea=e}));this.nv=r[0],this.dv=r[1]}return this.nv}vv(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.sv||this.fv!==t){var n;(n=this.sv)==null||n.reset(),this.fv=t;var r=this.av((()=>this.iv),(e=>{this.iv=e}),{serviceNameDefault:`posthog-browser-logs`,consoleCapture:!0},kl);this.sv=r[0],this.pv=r[1]}return this.sv}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!L(n)&&n&&(this.Xd=!0,this.loadIfEnabled())}}reset(){var e,t;this.ea=[],(e=this.nv)==null||e.reset(),this.iv=[],(t=this.sv)==null||t.reset(),this.Su=0}captureLog(e){this.uv().captureLog(e)}ui(e){this.vv().captureLog(e)}get logger(){return this.gv||(this.gv={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.gv}flushLogs(e){e?this.mv(e):(this.nv&&this.nv.flush().catch((e=>this.yv(e))),this.sv&&this.sv.flush().catch((e=>this.yv(e))))}yv(e){Ml(e)||this.I.error(`PostHog logs flush failed:`,e)}loadIfEnabled(){if(this.Xd&&!this.tv){var e=D==null?void 0:D.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,`logs`,(t=>{var n;t||(n=e.logs)==null||!n.initializeLogs?this.I.error(`Could not load logs script`,t):(e.logs.initializeLogs(this._instance),this.tv=!0)})):this.I.error(pi)}else this.I.error(`PostHog Extensions not found.`)}}ov(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:t=>t===oe.LogsQueue?e():void 0,setPersistedProperty(e,n){var r;e===oe.LogsQueue&&t((r=n)==null?[]:r)},kn:e=>this.kn(e),getLibraryId:()=>O.LIB_NAME,getLibraryVersion:()=>O.LIB_VERSION}}kn(e){return new Promise((t=>{if(uo(this.Su,3))t({kind:`fatal`,error:jl(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:jl(void 0,`logs request timed out`)})}),9e4);this._instance._send_request({method:`POST`,url:this.bv(),data:e,compression:`best-available`,batchKey:`logs`,fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._v(t),t>=200&&300>t)r({kind:`ok`});else if(t===413)r({kind:`too-large`});else if(t!==0&&t!==429&&500>t)r({kind:`fatal`,error:Error(`logs request failed with status `+t)});else{var n;t===0?(e.error||this.I.warn(`Logs request failed before receiving an HTTP response`),r({kind:`retry-later`,error:jl(e.error,`logs request failed before receiving an HTTP response`)})):r({kind:`retry-later`,error:(n=e.error)==null?Error(`logs request failed with status `+t):n})}}})}}))}_v(e){(e!==0||this._instance.__loaded)&&(this.Su=fo(e,this.Su,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.`))))}mv(e){this.ea.length>0&&this.wv(e,this.ea,this.dv,O.LIB_NAME,(e=>{this.ea=e})),this.iv.length>0&&this.wv(e,this.iv,this.pv,kl,(e=>{this.iv=e}))}wv(e,t,n,r,i){if(t.length!==0){var a=t.map((e=>e.record));i([]);var o=yn(a,vn(n,O.LIB_NAME,O.LIB_VERSION),r,O.LIB_VERSION);this._instance._send_request({method:`POST`,url:this.bv(),data:o,compression:`best-available`,batchKey:`logs`,transport:e})}}bv(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/logs`)+`?token=`+encodeURIComponent(this._instance.config.token)}lv(){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,L(i)||(t.sessionStartTimestamp=i),L(a)||(t.lastActivityTimestamp=a)}if(D!=null&&(e=D.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?rn(D.location.href):D.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(){}uv(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.nv&&this.hv===n||((t=this.nv)==null||t.reset(),this.hv=n,this.nv=new wn(this.ov(),function(e){var t,n,r,i,a,o=e==null?void 0:e.resourceAttributes;return{serviceName:(t=o==null?void 0:o[`service.name`])==null?e==null?void 0:e.serviceName:t,serviceVersion:(n=o==null?void 0:o[`service.version`])==null?e==null?void 0:e.serviceVersion:n,environment:(r=o==null?void 0:o[`deployment.environment`])==null?e==null?void 0:e.environment:r,resourceAttributes:o,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:(i=e==null?void 0:e.flushIntervalMs)==null?1e4:i,maxSeriesPerFlush:(a=e==null?void 0:e.maxSeriesPerFlush)==null?1e3:a}}(n),this.I)),this.nv}count(e,t,n){t===void 0&&(t=1),this.uv().count(e,t,n)}
3gauge(e,t,n){this.uv().gauge(e,t,n)}histogram(e,t,n){this.uv().histogram(e,t,n)}flush(e){if(!this.nv)return Promise.resolve();if(e){var t=this.nv.drainWindow();return t&&this.Nn(t,e),Promise.resolve()}return this.nv.flush().catch((e=>this.I.error(`PostHog metrics flush failed:`,e)))}reset(){var e;(e=this.nv)==null||e.reset()}ov(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Nn:e=>t.Nn(e),getLibraryId:()=>O.LIB_NAME,getLibraryVersion:()=>O.LIB_VERSION}}Nn(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(A({method:`POST`,url:this.Sv(),data:e,compression:`best-available`,batchKey:`metrics`},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;if(t>=200&&300>t)i({kind:`ok`});else if(t===413)i({kind:`too-large`});else if(t!==0&&t!==429&&500>t)i({kind:`fatal`,error:Error(`metrics request failed with status `+t)});else{var n;i({kind:`retry-later`,error:(n=e.error)==null?Error(`metrics request failed with status `+t):n})}}}))}))}Sv(){return this._instance.requestRouter.endpointFor(`api`,`/i/v1/metrics`)+`?token=`+encodeURIComponent(this._instance.config.token)}}});Pc.__defaultExtensionClasses=A({},Ul);var Wl=function(){O.SDK_DIST_CHANNEL=`npm`;var e=bc[Oc]=new Pc;return function(){function e(){e.done||(e.done=!0,kc=!1,W(bc,(function(e){e._dom_loaded()})))}v!=null&&v.addEventListener?v.readyState===`complete`?e():K(v,`DOMContentLoaded`,e,{capture:!1}):h&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),Gl=class{constructor(){e(this,`userData`,null),e(this,`cookieName`,`mb-user-description-v1`),this.userData=this.loadFromCookie()}loadFromCookie(){try{return t(this.cookieName)||null}catch(e){return console.warn(`Failed to load user data from cookie:`,e),null}}value(e){if(!this.userData)return null;let t=e.split(`.`),n=this.userData;for(let e of t){if(typeof n!=`object`||!n)return null;n=n[e]}return n===void 0?null:n}isLoggedIn(){var e,t;return(e=(t=this.userData)==null?void 0:t.is_logged)!=null&&e}isSubscribed(){var e,t;return(e=(t=this.userData)==null?void 0:t.is_subscribed)!=null&&e}isExpired(){var e;return(e=this.userData)!=null&&(e=e.meta)!=null&&e.expires?Date.now()/1e3>this.userData.meta.expires:!0}},Kl=class{constructor(){e(this,`insights`,void 0),e(this,`storageKey`,`hubspot-insights-v1`),this.insights=this.loadFromStorage(),document.addEventListener(`mb:consent:update`,()=>{this.hasConsent()&&this.upgradeStorage()})}hasConsent(){var e,t;return(e=(t=window.MbTagManager)==null?void 0:t.isConsentGranted([`analytics`]))!=null&&e}loadFromStorage(){if(!this.hasConsent())return{};try{let e=i(this.storageKey);if(!e)return{};try{return JSON.parse(e)}catch(e){return console.warn(`Failed to parse insights data from localStorage:`,e),{}}}catch(e){return console.warn(`Failed to access localStorage for insights:`,e),{}}}upgradeStorage(){if(!this.hasConsent())return;let e=this.loadFromStorage();this.insights={...e,...this.insights},this.saveToStorage()}all(){return this.insights}value(e){let t=e.split(`.`),n=this.insights;for(let e of t){if(typeof n!=`object`||!n)return null;n=n[e]}return n==null||n===``?null:String(n)}saveToStorage(){if(this.hasConsent())try{r(this.storageKey,JSON.stringify(this.insights))}catch(e){console.warn(`Failed to save insights data to localStorage:`,e)}}setValue(e,t){let n=e.split(`.`),r=this.insights;for(let e=0;e<n.length-1;e++){let t=n[e];(r[t]===null||r[t]===void 0||typeof r[t]!=`object`)&&(r[t]={}),r=r[t]}let i=n.at(-1);i&&(r[i]=t),this.saveToStorage()}},ql=new WeakSet,Jl=class{constructor(){u(this,ql),e(this,`SESSION_STORAGE_KEY`,`mb-mbt-session-v1`),e(this,`LOCAL_STORAGE_KEY`,`mb-mbt-data-v1`),e(this,`COOKIE_KEY`,`mbt`),e(this,`paramMap`,{mbt_session_start_date:{src:[],default:()=>new Date().toISOString()},mbt_landing_page:{src:[],default:()=>this.getLandingPage()},mbt_referrer:{src:[],default:()=>this.getReferrer()||`(not set)`},mbt_matchtype:{src:[`mbt_matchtype`],default:`(not set)`},mbt_searchquery:{src:[`mbt_searchquery`],default:`(not set)`},mbt_adcid:{src:[`mbt_adcid`],default:`(not set)`},mbt_mbcid:{src:[`mbt_mbcid`],default:`(not set)`},mbt_adgid:{src:[`mbt_adgid`],default:`(not set)`},mbt_clickid:{src:[`msclkid`,`fbclid`,`gclid`,`liclid`],default:`(not set)`},mbt_referring_affiliate_id:{src:[],default:()=>{var e;return(e=d(ql,this,Yl).call(this).id)==null?`(not set)`:e}},mbt_referring_affiliate_date_time:{src:[],default:()=>{var e;return(e=d(ql,this,Yl).call(this).datetime)==null?`(not set)`:e}},utm_campaign:{src:[`utm_campaign`,`mbt_utm_campaign`],default:()=>this.getSingleTrackingValue(`utm_source`)?`referral`:`(direct)`}
3,utm_content:{src:[`utm_content`,`mbt_utm_content`],default:`(not set)`},utm_medium:{src:[`utm_medium`,`mbt_utm_medium`],default:()=>this.getSingleTrackingValue(`utm_source`)?`referral`:`(none)`},utm_source:{src:[`utm_source`,`mbt_utm_source`],default:()=>this.getReferrer()?this.getReferrer().split(`/`)[2].split(`?`)[0]:`(direct)`},utm_term:{src:[`utm_term`,`mbt_utm_term`],default:`(not set)`}})}initialize(){var e,n;let r=this.getTrackingData(),i=this.getLocalStorage(),a=this.getSessionStorage();if(!i){let e=t(this.COOKIE_KEY);e&&(i=e)}if(s(this.COOKIE_KEY),i&&d(ql,this,Zl).call(this,i),(e=r.mbt_referrer)!=null&&e.includes(`medbridgeeducation.com`)||(n=r.mbt_referrer)!=null&&n.includes(`medbridge.com`)){var o,c;this.setLocalStorage((o=i)==null?{}:o),this.setSessionStorage((c=a)==null?{}:c);return}let l=r.utm_source!==`(direct)`||r.mbt_clickid!==`(not set)`||r.mbt_adcid!==`(not set)`||r.mbt_mbcid!==`(not set)`;if(!i){i={};for(let e in r)i[`latest_`+e]=r[e],i[`first_`+e]=r[e]}else if(l)for(let e in r)i[`latest_`+e]=r[e];if(!a){a={};for(let e in r)a[`session_`+e]=r[e]}else if(l)for(let e in r)a[`session_`+e]=r[e];let u={...i,...a};this.setLocalStorage(u),this.setSessionStorage(a)}getTrackingData(){let e={};for(let t in this.paramMap)e[t]||(e[t]=this.getSingleTrackingValue(t));return e}getSingleTrackingValue(e){let t=``;for(let r of this.paramMap[e].src){let e=n(r);e!==null&&(t=String(e))}return t||(t=typeof this.paramMap[e].default==`function`?this.paramMap[e].default():this.paramMap[e].default),this.limitLength(t)}getReferrer(){return document.referrer&&!document.referrer.includes(window.location.hostname)?this.limitLength(document.referrer):``}getLandingPage(){let e=new URLSearchParams(window.location.search);for(let t in this.paramMap)for(let n of this.paramMap[t].src)e.delete(n);let t=e.toString(),n=t?`?${t}`:``;return this.limitLength(window.location.pathname+n+window.location.hash)}limitLength(e){let t=e.substring(0,253);return t!==e&&(t+=`...`),t}getData(){return this.getLocalStorage()}getCookie(){return this.getData()}setLocalStorage(e){if(d(ql,this,Xl).call(this))try{r(this.LOCAL_STORAGE_KEY,JSON.stringify(e))}catch(e){console.warn(`MBT: Failed to set local storage`,e)}}getLocalStorage(){if(!d(ql,this,Xl).call(this))return null;try{let e=i(this.LOCAL_STORAGE_KEY);if(e)return JSON.parse(e)}catch(e){console.warn(`MBT: Failed to get local storage`,e)}return null}setSessionStorage(e){if(d(ql,this,Xl).call(this))try{r(this.SESSION_STORAGE_KEY,JSON.stringify(e),sessionStorage)}catch(e){console.warn(`MBT: Failed to set session storage`,e)}}getSessionStorage(){if(!d(ql,this,Xl).call(this))return null;try{let e=i(this.SESSION_STORAGE_KEY,sessionStorage);if(e)return JSON.parse(e)}catch(e){console.warn(`MBT: Failed to get session storage`,e)}return null}};function Yl(){let e=t(`mb_referring_affiliate`);return typeof e!=`object`||!e||Array.isArray(e)?{id:null,datetime:null}:{id:`id`in e?String(e.id):null,datetime:`date_time`in e?String(e.date_time):null}}function Xl(){var e,t;return(e=(t=window.MbTagManager)==null?void 0:t.isConsentGranted([`analytics`]))!=null&&e}function Zl(e){let t=[];for(let n of Object.keys(e))!n.startsWith(`latest_`)&&!n.startsWith(`first_`)&&!n.startsWith(`session_`)&&t.push(n);for(let n of t){let t=e[n],r=`latest_`+n;e[r]||(e[r]=t),delete e[n]}}var Q=new WeakSet,Ql=class{constructor(t){u(this,Q),e(this,`posthogInstance`,null),e(this,`config`,void 0),e(this,`mbt`,void 0),e(this,`user`,void 0),e(this,`insights`,void 0),e(this,`lastKnownEmail`,null),e(this,`identifiedAfterConsent`,!1),this.config=t,this.mbt=new Jl,this.user=new Gl,this.insights=new Kl}getInstance(){return this.posthogInstance}getPersonProperties(){let e=d(Q,this,iu).call(this),t=d(Q,this,ru).call(this);return{...d(Q,this,cu).call(this),...t,...e}}getDistinctId(){var e;let t=(e=this.user.value(`user.email`))==null?this.insights.all().email:e;if(t&&d(Q,this,eu).call(this,t.toString()))return t.toString().trim()}async initialize(){let e=this.getPersonProperties(),t=this.getDistinctId();o([`Initializing PostHog`]),await Promise.race([new Promise(n=>{Wl.init(this.config.apiKey,{person_profiles:`identified_only`,cookieless_mode:`on_reject`,disable_session_recording:!0,capture_exceptions:{capture_unhandled_errors:!0,capture_unhandled_rejections:!0,capture_console_errors:!0},api_host:this.config.host,ui_host:`https://us.posthog.com`,loaded:r=>{this.posthogInstance=r,d(Q,this,nu).call(this,r,t,e),this.lastKnownEmail=t==null?null:t,window.mbPostHog=this,document.dispatchEvent(new CustomEvent(`posthog:ready`,{detail:{posthog:r}})),r.onFeatureFlags&&r.onFeatureFlags(()=>{o([`[MbPostHog] Feature flags loaded`])}),document.addEventListener(`mb:consent:update`,()=>{if(d(Q,this,su).call(this),this.identifiedAfterConsent||!d(Q,this,$l).call(this))return;this.identifiedAfterConsent=!0,d(Q,this,tu).call(this);let e=this.getDistinctId(),t=this.getPersonProperties();this.lastKnownEmail=e==null?null:e,d(Q,this,nu).call(this,r,e,t)}),n()}})}),new Promise((e,t)=>
3setTimeout(()=>t(Error(`PostHog init timed out`)),1e4))]).catch(e=>{o([`PostHog initialization failed:`,e])})}isInitialized(){return this.posthogInstance!==null}capture(e,t){let n=this.getInstance();if(!n){console.warn(`PostHog client not initialized`);return}o([e,t],{level:`debug`}),n.capture(e,t)}setFlagOverride(e,t){let n=this.getInstance();if(!n){console.warn(`PostHog client not initialized`);return}n.featureFlags&&(n.featureFlags.overrideFeatureFlags({flags:{[e]:t}}),o([`[MbPostHog] setFlagOverride for "${e}" to "${t}"`]))}async reloadFeatureFlags(){let e=this.getInstance();if(!e){console.warn(`PostHog client not initialized`);return}d(Q,this,tu).call(this);let t=this.getPersonProperties();e.setPersonProperties(t),e.setPersonPropertiesForFlags(t),o([`[MbPostHog] reloadFeatureFlags called`])}async updateUser(){var e,t;if(!this.getInstance()){console.warn(`PostHog client not initialized`);return}if(!d(Q,this,$l).call(this)){o([`PostHog: skipping updateUser (no analytics consent)`]);return}d(Q,this,tu).call(this);let n=(e=(t=this.user.value(`user.email`))==null?this.insights.all().email:t)==null?null:e,r=null;if(n){let e=String(n);d(Q,this,eu).call(this,e)?(r=e.trim(),o([`PostHog updateUser: Valid email found`,{email:r}])):o([`PostHog updateUser: Invalid email format`,{email:e}])}else o([`PostHog updateUser: No email found`,{userEmail:this.user.value(`user.email`),insightsEmail:this.insights.all().email}]);if(this.lastKnownEmail&&r&&this.lastKnownEmail!==r){this.lastKnownEmail=r,await this.resetAndIdentify();return}this.lastKnownEmail=r||null,await this.identify()}async identify(){let e=this.getInstance();if(!e){console.warn(`PostHog client not initialized`);return}if(!d(Q,this,$l).call(this)){o([`PostHog: skipping identify (no analytics consent)`]);return}let t=this.getDistinctId(),n=this.getPersonProperties();d(Q,this,nu).call(this,e,t,n)}async resetAndIdentify(){let e=this.getInstance();if(!e){console.warn(`PostHog client not initialized`);return}if(!d(Q,this,$l).call(this)){o([`PostHog: skipping resetAndIdentify (no analytics consent)`]);return}d(Q,this,tu).call(this),e.reset(),o([`Resetting and re-identifying PostHog user`]),await this.identify()}};function $l(){var e,t;return(e=(t=window.MbTagManager)==null?void 0:t.isConsentGranted([`analytics`]))!=null&&e}function eu(e){if(!e||typeof e!=`string`)return!1;let t=e.trim();if(t.length===0)return!1;let n=t.split(`@`);if(n.length!==2)return!1;let[r,i]=n;return!(!r||r.length===0||!i||i.length===0||!i.includes(`.`))}function tu(){this.user=new Gl,this.insights=new Kl}function nu(e,t,n){if(d(Q,this,su).call(this),!d(Q,this,$l).call(this)){o([`PostHog: skipping identify (no analytics consent)`]);return}d(Q,this,au).call(this),t?(o([`Identifying PostHog user with distinct ID`,{distinctId:t,personProperties:n}]),e.identify(t,n)):Object.keys(n).length>0&&o([`Identifying PostHog user by anonymous device ID`,{personProperties:n}]),e.setPersonProperties(n)}function ru(){let e={email:`email`,company:`company_name`,country:`country_name`,state:`state_name`,job_level:`job_level`,setting:`setting`,discipline:`discipline`,role:`role`,num_employees:`num_employees`},t=this.insights.all(),n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!=null&&(n[i]=e)}return n}function iu(){var e;let t={},n=this.user.value(`user.email`);n&&(t.email=n);let r=(e=this.user.value(`user.id`))==null?void 0:e.toString();return r&&(t.user_id=r),t.care_platform=this.user.value(`products.one_care.enabled`)?`One Care`:`Classic`,t}function au(){var e;let t=this.getInstance();if(!(t!=null&&t.group))return;let n=this.insights.all(),r=(e=this.user.value(`user.organization_id`))==null?void 0:e.toString();r&&t.group(`company`,r);let i=n.setting;i&&t.group(`setting`,i);let a=n.discipline;a&&t.group(`discipline`,a)}function ou(){return{...d(Q,this,cu).call(this),tracking_mode:d(Q,this,$l).call(this)?`cookie`:`cookieless`}}function su(){let e=this.getInstance();if(!e)return;let t=d(Q,this,ou).call(this);Object.keys(t).length>0&&e.register(t)}function cu(){var e;let t=(e=this.mbt.getData())==null?{}:e,n={};for(let[e,r]of Object.entries(t)){let t=e.replaceAll(`_utm_`,`_mbt_utm_`);n[t]=r}return n}var lu=2e3,uu=`//js.hsforms.net/forms/embed/v2.js`,du=new WeakMap,fu=new WeakMap,pu=new WeakMap,mu=new WeakMap,hu=new WeakMap,gu=new WeakMap,_u=new WeakMap,vu=new WeakMap,yu=new WeakMap,bu=new WeakMap,xu=new WeakMap,Su=new WeakMap,Cu=new WeakMap,wu=new WeakMap,$=new WeakSet,Tu=class{constructor(){u(this,$),p(this,du,new Jl),p(this,fu,new AbortController),p(this,pu,null),p(this,mu,!1),p(this,hu,!1),p(this,gu,!1),p(this,_u,!1),p(this,vu,!1),p(this,yu,null),p(this,bu,!1),p(this,xu,null),p(this,Su,[]),p(this,Cu,null),p(this,wu,{necessary:!0,functional:!1,analytics:!1,performance:!1,advertisement:!1}),window.disableHubSpotCookieBanner=!0,window.MBT=f(du,this)}initialize(){f(mu,this)||(m(mu,this,!0),d($,this,Mu).call(this),window.getCkyConsent?(m(hu,this,!0),d($,this,Eu).call(this,window.getCkyConsent())):window.cookieYesConfig?d($,this,ku).call(this):d($,this,Ou).call(this),d($,this,Du).call(this),window.posthogConfig&&!window.cookieYesConfig&&d($,this,Nu).call(this),d($,this,Fu).call(this)&&d($,this,Iu).call(this),o([`[MbTagManager]`,{analytics:f(wu,this).analytics,bannerType:f(pu,this),cookieYes:f(hu,this)}]))}isConsentGranted(e=[`functional`,`analytics`,`performance`,`advertisement`]){return e.every(e=>f(wu,this)[e])}getBannerType(){return f(pu,this)}isCookieYesAvailable(){return f(hu,this)}getAnalyticsConsentState(){return window.cookieYesConfig&&!f(hu,this)&&!f(vu,this)?`pending`:f(wu,this).analytics?`granted`:`denied`}destroy(){d($,this,Lu).call(this),d($,this,Bu).call(this),f(fu,this).abort()}loadScript(e,t){let n=document.createElement(`script`);if(t)for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n.src=e,document.head.appendChild(n),n}ensureHubSpotFormsEmbed(){var e;return window.hbspt?Promise.resolve():f(xu,this)===null?!((e=window.hubSpotTracking)!=null&&e.enabled)||!d($,this,Wu).call(this)?Promise.reject(Error(`HubSpot forms embed is not available`)):(m(xu,this,this.getAnalyticsConsentState()===`pen
3ding`?d($,this,Ru).call(this).then(()=>d($,this,Vu).call(this)):d($,this,Vu).call(this)),f(xu,this)):f(xu,this)}};function Eu(e){m(pu,this,e.activeLaw===`gdpr`?`explicit`:`implicit`),m(wu,this,{...e.categories}),o([`[MbTagManager] applyConsentData`,{bannerType:f(pu,this),analytics:e.categories.analytics}]),d($,this,ku).call(this),d($,this,Nu).call(this)}function Du(){let e=f(fu,this).signal;document.addEventListener(`cookieyes_banner_load`,e=>{let t=e.detail;o([`[MbTagManager] cookieyes_banner_load`,t]),f(hu,this)?f(pu,this)||(m(pu,this,t.activeLaw===`gdpr`?`explicit`:`implicit`),d($,this,Yu).call(this)):(m(hu,this,!0),d($,this,Eu).call(this,t))},{signal:e}),document.addEventListener(`cookieyes_consent_update`,e=>{let t=e.detail;m(hu,this,!0),f(wu,this).analytics=t.accepted.includes(`analytics`),f(wu,this).functional=t.accepted.includes(`functional`),f(wu,this).performance=t.accepted.includes(`performance`),f(wu,this).advertisement=t.accepted.includes(`advertisement`),d($,this,ku).call(this),d($,this,Nu).call(this)},{signal:e})}function Ou(){m(wu,this,{necessary:!0,functional:!0,analytics:!0,performance:!0,advertisement:!0}),d($,this,ku).call(this)}function ku(){d($,this,Au).call(this),d($,this,ju).call(this),d($,this,Hu).call(this),d($,this,Yu).call(this)}function Au(){f(hu,this)&&f(du,this).initialize()}function ju(){if(f(Cu,this)){let e=f(Cu,this).getInstance();e&&(f(wu,this).analytics?(e.opt_in_capturing(),e.startSessionRecording()):(f(hu,this)||f(vu,this))&&(e.opt_out_capturing(),e.stopSessionRecording()))}f(wu,this).functional&&!f(gu,this)&&window.chiliPiperConfig&&d($,this,Ku).call(this)}function Mu(){let e=window.cookieYesConfig;e&&this.loadScript(`https://cdn-cookieyes.com/client_data/${e.siteKey}/script.js`,{id:`cookieyes`})}function Nu(e=!1){!window.posthogConfig||f(_u,this)||!e&&window.cookieYesConfig&&this.getAnalyticsConsentState()===`pending`||(m(_u,this,!0),d($,this,Lu).call(this),d($,this,Pu).call(this))}function Pu(){let e=window.posthogConfig;e&&(m(Cu,this,new Ql(e)),f(Cu,this).initialize().then(()=>{d($,this,ju).call(this),f(vu,this)&&!f(hu,this)&&d($,this,Yu).call(this)}))}function Fu(){var e;return!window.cookieYesConfig||window.getCkyConsent||this.getAnalyticsConsentState()!==`pending`?!1:!!(window.posthogConfig||(e=window.hubSpotTracking)!=null&&e.enabled)}function Iu(){!window.cookieYesConfig||f(yu,this)!==null||m(yu,this,setTimeout(()=>{m(vu,this,!0),m(yu,this,null),d($,this,Nu).call(this,!0),d($,this,Hu).call(this,!0),window.posthogConfig||d($,this,Yu).call(this)},lu))}function Lu(){f(yu,this)!==null&&(clearTimeout(f(yu,this)),m(yu,this,null))}function Ru(){return this.getAnalyticsConsentState()===`pending`?new Promise((e,t)=>{f(Su,this).push({resolve:e,reject:t})}):Promise.resolve()}function zu(){if(this.getAnalyticsConsentState()===`pending`)return;let e=f(Su,this);m(Su,this,[]),e.forEach(({resolve:e})=>e())}function Bu(){let e=f(Su,this);m(Su,this,[]),e.length!==0&&(m(xu,this,null),e.forEach(({reject:e})=>e(Error(`HubSpot forms embed is not available`))))}function Vu(){return new Promise((e,t)=>{if(window.hbspt){e();return}let n=document.querySelector(`script[src*="hsforms.net/forms/embed/v2.js"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,()=>{m(xu,this,null),t(Error(`HubSpot forms embed failed to load`))},{once:!0});return}let r=this.loadScript(uu,{defer:`true`,charset:`utf-8`,type:`text/javascript`});r.onload=()=>e(),r.onerror=()=>{m(xu,this,null),t(Error(`HubSpot forms embed failed to load`))}})}function Hu(e=!1){if(d($,this,zu).call(this),!d($,this,Uu).call(this,e))return;d($,this,Lu).call(this),d($,this,Gu).call(this);let t=d($,this,Wu).call(this);!t||f(bu,this)||(m(bu,this,!0),this.loadScript(`//js.hs-scripts.com/${t}.js`,{id:`hs-script-loader`,async:`true`,defer:`true`,type:`text/javascript`}))}function Uu(e=!1){var t;return!(!((t=window.hubSpotTracking)!=null&&t.enabled)||!d($,this,Wu).call(this)||!e&&window.cookieYesConfig&&this.getAnalyticsConsentState()===`pending`)}function Wu(){var e;return((e=window.hubSpotTracking)==null||(e=e.portalId)==null?void 0:e.trim())||null}function Gu(){window._hsp=window._hsp||[],window._hsp.push([`setHubSpotConsent`,{analytics:f(wu,this).analytics,advertisement:f(wu,this).advertisement,functionality:f(wu,this).functional}])}
3function Ku(){m(gu,this,!0);let e=window.chiliPiperConfig,t=this.loadScript(`https://js.chilipiper.com/marketing.js`);t.onload=()=>d($,this,qu).call(this,e)}function qu(e){window.addEventListener(`message`,t=>{if(t.origin===document.location.origin)for(let r of Object.values(e.routers)){var n;r.forms.includes((n=t.data)==null?void 0:n.id)&&d($,this,Ju).call(this,t,e.tenantDomain,r.name)}},{signal:f(fu,this).signal})}function Ju(e,t,n){var r,i,a;if(((r=e.data)==null?void 0:r.type)!==`hsFormCallback`||((i=e.data)==null?void 0:i.eventName)!==`onFormSubmitted`)return;let o={...e.data.data.submissionValues};for(let e in o)Array.isArray(o[e])&&(o[e]=o[e].toString().replaceAll(`,`,`;`));(a=window.ChiliPiper)==null||a.submit(t,n,{map:!0,lead:o})}function Yu(){document.dispatchEvent(new CustomEvent(`mb:consent:update`,{detail:{categories:{...f(wu,this)},bannerType:f(pu,this)}}))}var Xu=class e{static buildProperties(e){var t;let n={},r=e.getAttribute(`href`);r!==null&&r!==``&&(n.href=r);let i=((t=e.textContent)==null?``:t).trim();i!==``&&(n.innerText=i.slice(0,this.MAX_TEXT_LENGTH));let a=e.dataset.analyticsId;return a!==void 0&&a!==``&&(n.analyticsId=a),n}static init(){this.listenersRegistered||typeof document>`u`||(this.listenersRegistered=!0,document.addEventListener(`click`,this.handleAnchorActivation,{capture:!0}),document.addEventListener(`auxclick`,this.handleAnchorActivation,{capture:!0}))}static resetForTests(){this.listenersRegistered&&typeof document<`u`&&(document.removeEventListener(`click`,this.handleAnchorActivation,{capture:!0}),document.removeEventListener(`auxclick`,this.handleAnchorActivation,{capture:!0})),this.listenersRegistered=!1}static handleAnchorActivation(t){let n=t.target;if(!(n instanceof Element))return;let r=n.closest(`a`);r instanceof HTMLAnchorElement&&l(`link_click`,e.buildProperties(r))}};e(Xu,`listenersRegistered`,!1),e(Xu,`MAX_TEXT_LENGTH`,48),c(),Xu.init(),window.MbAnalytics={FormAnalyticsFactory:a},window.MbInsights=new Kl,window.MbUser=new Gl,window.MbTagManager=new Tu,window.MbTagManager.initialize();

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.