PageSourceSearch

https://magicstudio.com/_next/static/chunks/55242232-878453b0040d71c4.js

js magicstudio.com collected 2026-10-02 04:09:46 UTC 230,678 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3215],{52809:function(e,t,i){i.d(t,{ZP:function(){return as}});var s="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:s,n=null==r?void 0:r.navigator,o=null==r?void 0:r.document,a=null==r?void 0:r.location,l=null==r?void 0:r.fetch,u=null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,h=null==r?void 0:r.AbortController,c=null==r?void 0:r.CompressionStream,d=null==n?void 0:n.userAgent;function p(){return!(!s||!1===s.navigator.onLine)}var v="undefined"!=typeof globalThis?globalThis:s;v&&"undefined"==typeof self&&(v.self=v),v&&"undefined"==typeof File&&(v.File=function(){});var g=null!=s?s:{},_="0.2.0",f={DEBUG:!1,LIB_VERSION:_,LIB_NAME:"browser-common",JS_SDK_VERSION:_};function m(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(u){return void i(u)}a.done?t(l):Promise.resolve(l).then(s,r)}function y(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){m(n,s,r,o,a,"next",e)}function a(e){m(n,s,r,o,a,"throw",e)}o(void 0)})}}function b(){return(b=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e}).apply(null,arguments)}function w(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var E=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function x(e){return"string"==typeof e||e}function S(e){return"string"==typeof e?e:void 0}var k,T,P,F,$=["$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","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],R=((k={}).AnonymousId="anonymous_id",k.DistinctId="distinct_id",k.Props="props",k.EnablePersonProcessing="enable_person_processing",k.PersonMode="person_mode",k.FeatureFlagDetails="feature_flag_details",k.FeatureFlags="feature_flags",k.FeatureFlagPayloads="feature_flag_payloads",k.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",k.BootstrapFeatureFlags="bootstrap_feature_flags",k.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",k.OverrideFeatureFlags="override_feature_flags",k.Queue="queue",k.AiQueue="ai_queue",k.LogsQueue="logs_queue",k.OptedOut="opted_out",k.SessionId="session_id",k.SessionStartTimestamp="session_start_timestamp",k.SessionLastTimestamp="session_timestamp",k.PersonProperties="person_properties",k.GroupProperties="group_properties",k.InstalledAppBuild="installed_app_build",k.InstalledAppVersion="installed_app_version",k.SessionReplay="session_replay",k.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",k.SurveyLastSeenDate="survey_last_seen_date",k.SurveysSeen="surveys_seen",k.Surveys="surveys",k.RemoteConfig="remote_config",k.FlagsEndpointWasHit="flags_endpoint_was_hit",k.DeviceId="device_id",k),I=((T={}).GZipJS="gzip-js",T.Base64="base64",T),O=["$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"],M=["token"],C="NativeGzipValidationError",A=e=>e.length>=2&&31===e[0]&&139===e[1],L=(e,t)=>e===I.GZipJS||t===I.GZipJS||"gzip"===t,D=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),N=e=>{var t=Error("Native gzip produced invalid output: "+e);throw t.name=C,t},U=(P=y(function*(e,t){18>e.size&&N("too-short");var i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));A(i)&&8===i[2]||N("invalid-header");var s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{for(var t=(()=>
1{if(F)return F;F=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;F[e]=t>>>0}return F})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&N("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&N("invalid-size")}),function(e,t){return P.apply(this,arguments)});function H(){return(H=y(function*(e,t,i){void 0===t&&(t=!0);try{var s,r,n=(new TextEncoder).encode(e),o=new globalThis.CompressionStream("gzip"),a=o.writable.getWriter(),l=(yield Promise.all([new Response(o.readable).blob(),a.write(n).then(()=>a.close()).catch((s=y(function*(e){try{yield a.abort(e)}catch(t){}throw e}),function(e){return s.apply(this,arguments)}))]))[0];return yield U(l,n),l}catch(u){if(null!=i&&i.rethrow)throw u;return t&&console.error("Failed to gzip compress data",u),null}})).apply(this,arguments)}var j=["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"],q=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return j.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function z(e,t){return -1!==e.indexOf(t)}var B=function(e){return e.trim()},V=function(e){return e.replace(/^\$/,"")};function G(e){var t,i=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}var W=Object.prototype,K=W.hasOwnProperty,J=W.toString,Y=Array.isArray||function(e){return"[object Array]"===J.call(e)},Z=e=>"function"==typeof e,X=e=>e===Object(e)&&!Y(e),Q=e=>{if(X(e)){for(var t in e)if(K.call(e,t))return!1;return!0}return!1},ee=e=>void 0===e,et=e=>"[object String]"==J.call(e),ei=e=>et(e)&&0===e.trim().length,es=e=>null===e,er=e=>ee(e)||es(e),en=e=>"[object Number]"==J.call(e)&&e==e,eo=e=>en(e)&&e>0,ea=e=>"[object Boolean]"===J.call(e),el=e=>e instanceof FormData,eu=e=>z(O,e),eh=e=>z(M,e);function ec(e){return null===e||"object"!=typeof e}function ed(e,t){return({}).toString.call(e)==="[object "+t+"]"}function ep(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(i){return!1}}(e,Event)}var ev=[!0,"true",1,"1","yes"],eg=e=>z(ev,e),e_=[!1,"false",0,"0","no"];function ef(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),en(e)?e>i?(s.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ef(r||i,t,i,s))}class em{constructor(e){this.tt={},this.et=e.et,this.rt=ef(e.bucketSize,0,100,e.it),this.nt=ef(e.refillRate,0,this.rt,e.it),this.st=ef(e.refillInterval,0,864e5,e.it)}ot(e,t){var i=Math.floor((t-e.lastAccess)/this.st);i>0&&(e.tokens=Math.min(e.tokens+i*this.nt,this.rt),e.lastAccess=e.lastAccess+i*this.st)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.tt[s];return r?this.ot(r,i):this.tt[s]=r={tokens:this.rt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.et)||t.call(this,e)),0===r.tokens)}stop(){this.tt={}}}var ey="Mobile",eb="Android",ew="Tablet",eE=eb+" "+ew,ex="iPad",eS="Apple",ek=eS+" Watch",eT="Safari",eP="BlackBerry",eF="Samsung",e$=eF+"Browser",eR=eF+" Internet",eI="Chrome",eO=eI+" iOS",eM="Internet Explorer",eC=eM+" "+ey,eA="Opera",eL=eA+" Mini",eD="Edge",eN="Microsoft "+eD,eU="Firefox",eH=eU+" iOS",ej="Nintendo",eq="PlayStation",ez="Xbox",eB=eb+" "+ey,eV=ey+" "+eT,eG="Windows",eW=eG+" Phone",eK="Nokia",eJ="Ouya",eY="Generic",eZ=eY+" "+ey.toLowerCase(),eX=eY+" "+ew.toLowerCase(),eQ="Konqueror",e0="Oculus Browser",e1="Vivaldi",e2="Yandex",e3="Whale",e5="DuckDuckGo",e4="Pale Moon",e6="Waterfox",e8="Brave",e7="Google Search App",e9="(\\d+(\\.\\d+)?)",te=RegExp("Version/"+e9),tt=RegExp(ez,"i"),ti=RegExp(eq+" \\w+","i"),ts=RegExp(ej+" \\w+","i"),tr=RegExp(eP+"|PlayBook|BB10","i"),tn={"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"},to=function(e,t,i,s){var r,n,o,a;return t=t||"",(null!=i&&i.brave?e8:null)||(null!=s&&s.detectGoogleSearchApp&&z(e,"GSA/")?e7:z(e," OPR/")&&z(e,"Mini")?eL:z(e," OPR/")?eA:tr.test(e)?eP:z(e,"IE"+ey)||z(e,"WPDesktop")?eC:z(e,"OculusBrowser")?e0:z(e,e$)?eR:z(e,eD)||z(e,"Edg/")?eN:z(e,e1+"/")?e1:z(e,"YaBrowser/")?e2:z(e,e3+"/")?e3:z(e,e5+"/")||z(e,"Ddg/")?e5:z(e,"FBIOS")?"Facebook "+ey:z(e,"UCWEB")||z(e,"UCBrowser")?"UC Browser":z(e,"CriOS")?eO:z(e,"CrMo")||z(e,eI)?eI:z(e,eb)&&z(e,eT)?eB:z(e,"FxiOS")?eH:z(e.toLowerCase(),eQ.toLowerCase())?eQ:z(e,e8+"/")?e8:(o=t)&&z(o,eS)||z(e,eT)&&!z
1(e,eI)&&!z(e,eb)?z(e,ey)?eV:eT:z(e,"PaleMoon/")?e4:z(e,e6+"/")?e6:z(e,eU)?eU:z(e,"MSIE")||z(e,"Trident/")?eM:z(e,"Gecko")?eU:"")},ta={[eC]:[RegExp("rv:"+e9)],[eN]:[RegExp(eD+"?\\/"+e9)],[eI]:[RegExp("("+eI+"|CrMo)\\/"+e9)],[eO]:[RegExp("CriOS\\/"+e9)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+e9)],[eT]:[te],[eV]:[te],[eA]:[RegExp("(Opera|OPR)\\/"+e9)],[eU]:[RegExp(eU+"\\/"+e9)],[eH]:[RegExp("FxiOS\\/"+e9)],[eQ]:[RegExp("Konqueror[:/]?"+e9,"i")],[eP]:[RegExp(eP+" "+e9),te],[eB]:[RegExp("android\\s"+e9,"i")],[eR]:[RegExp(e$+"\\/"+e9)],[e0]:[RegExp("OculusBrowser\\/"+e9)],[e1]:[RegExp(e1+"\\/"+e9)],[e2]:[RegExp("YaBrowser\\/"+e9)],[e3]:[RegExp(e3+"\\/"+e9)],[e8]:[RegExp(e8+"\\/"+e9)],[e5]:[RegExp("(DuckDuckGo|Ddg)\\/"+e9)],[e4]:[RegExp("PaleMoon\\/"+e9)],[e6]:[RegExp(e6+"\\/"+e9)],[e7]:[RegExp("GSA\\/"+e9)],[eM]:[RegExp("(rv:|MSIE )"+e9)],Mozilla:[RegExp("rv:"+e9)]},tl=function(e,t,i,s){var r=ta[to(e,t,i,s)];if(ee(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},tu=[[RegExp(ez+"; "+ez+" (.*?)[);]","i"),e=>[ez,e&&e[1]||""]],[RegExp(ej,"i"),[ej,""]],[RegExp(eq,"i"),[eq,""]],[tr,[eP,""]],[RegExp(eG,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eW,""];if(RegExp(ey).test(t)&&!/IEMobile\b/.test(t))return[eG+" "+ey,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=tn[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eG,s]}return[eG,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ee(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+eb+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+eb+")","i"),e=>e&&e[2]?[eb,[e[2],e[3],e[4]||"0"].join(".")]:[eb,""]],[/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/,[eI+" OS",""]],[/Linux|debian/i,["Linux",""]]],th=function(e){return ts.test(e)?ej:ti.test(e)?eq:tt.test(e)?ez:RegExp(eJ,"i").test(e)?eJ:RegExp("("+eW+"|WPDesktop)","i").test(e)?eW:/iPad/.test(e)?ex:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ek:tr.test(e)?eP:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eK,"i").test(e)?eK:/(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)?RegExp(ey).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)?eb:eE:RegExp("(pda|"+ey+")","i").test(e)?eZ:RegExp(ew,"i").test(e)&&!RegExp(ew+" pc","i").test(e)?eX:""},tc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function td(e,t){return"string"==typeof e&&tc.test(e)?e:t()}function tp(e){return e?e.split("#")[0]:e}function tv(e,t){var i=setTimeout(e,t);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var tg=e=>e instanceof Error,t_={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}},tf=t_.info;function tm(e){if(ea(e))return{boolValue:e};if("number"==typeof e)return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if("string"==typeof e)return{stringValue:e};if(Y(e))return{arrayValue:{values:e.map(e=>tm(e))}};try{return{stringValue:JSON.stringify(e)}}catch(t){return{stringValue:String(e)}}}function ty(e){var t=[];for(var i in e){var s=e[i];es(s)||ee(s)||t.push({key:i,value:tm(s)})}return t}function tb(e,t,i){return b({},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":i})}function tw(e,t,i,s){return{resourceLogs:[{resource:{attributes:ty(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}let tE=class{constructor(e,t,i,s,r,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this.Te=t,this.it=i,this.ut=s,this.ht=r,this.dt=n,this.ct=o,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.xt=t.maxBufferSize,this.kt=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.It=t.rateCapWindowMs,this.Tt=t.maxLogsPerInterval}reset(){this.Mt(),this.vt=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Te.maxBatchRecordsPerPost}onReconnect(){this.yt=0,this.Et()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this.Rt(e);if(null!==t){if(t.body){if(this.Pt()){var i,s,r,n,o,a,l,u,h,c={record:(s=this.ut(),n=(r=t_[t.level||"info"]||tf).text,o=r.number,a=String(Date.now())+"000000",l={},s.distinctId&&(l.posthogDistinctId=s.distinctId),s.sessionId&&(l.sessionId=s.sessionId),s.windowId&&(l["window.id"]=s.windowId),er(s.sessionStartTimestamp)||(l.sessionStartTimestamp=String(s.sessionStartTimestamp)),er(s.lastActivityTimestamp)||(l.lastActivityTimestamp=String(s.lastActivityTimestamp)),s.currentUrl&&(l["url.full"]=s.currentUrl),s.screenName&&(l["screen.name"]=s.screenName),s.appState&&(l["app.state"]=s.appState),s.activeFeatureFlags&&s.activeFeatureFlags.length>0&&(l.feature_flags=s.activeFeatureFlags),u=b({},l,t.attributes||{}),h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:t.body},attributes:ty(u)},t.trace_id&&(h.traceId=t.trace_id),t.span_id&&(h.spanId=t.span_id),ee(t.trace_flags)||(h.flags=t.trace_flags),h)};this.ht(()=>this.Ot(c))}}else this.it.info("Log was rejected in beforeSend function")}}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var i=Y(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.it.info("Log was rejected in beforeSend function"),null;s=n}catch(o){return this.it.error("Error in beforeSend function for log:",o),null}return s}
1Pt(){if(void 0===this.Tt)return!0;var e=Date.now(),t=e-this.bt;return this.It>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.Tt>this._t?(this._t++,!0):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.It+"ms"),this.wt=!0),!1)}flush(){var e=this;return y(function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally(()=>{e.vt=null})),e.vt})()}Ft(){var e=this;return y(function*(){e.Mt();var t=null!==(r=e._instance.getPersistedProperty(R.LogsQueue))&&void 0!==r?r:[];if(0!==t.length)for(var i=t.length,s=0;t.length>0&&i>s;){e.ft=0;var r,n,o,a=Math.min(t.length,e.Ct),l=t.slice(0,a),u=yield e._instance.$t(tw(l.map(e=>e.record),e.Lt(),null!==(n=e.ct)&&void 0!==n?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()));if("too-large"===u.kind&&l.length>1)e.Ct=Math.max(1,Math.floor(l.length/2)),e.it.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.Ct);else if("retry-later"===u.kind||("too-large"===u.kind?e.it.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&e.Te.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Te.maxBatchRecordsPerPost,e.Ct+1)),yield e.At(l.length),t=null!==(o=e._instance.getPersistedProperty(R.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind))throw u.error}})()}At(e){var t=this;return y(function*(){var i,s=Math.max(0,e-t.ft),r=null!==(i=t._instance.getPersistedProperty(R.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(R.LogsQueue,r.slice(s)),yield t.dt()})()}Lt(){return tb(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var i=null!==(t=this._instance.getPersistedProperty(R.LogsQueue))&&void 0!==t?t:[];this.kt>i.length||(i.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(R.LogsQueue,i),this.xt>i.length?this.Nt():this.Et()}}Nt(e){void 0===e&&(e=this.St),this.Dt||(this.Dt=tv(()=>{this.Dt=void 0,this.Et()},e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(R.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return y(function*(){t.Mt();var i=t.flush().catch(()=>{});void 0!==e?yield Promise.race([i,new Promise(t=>tv(t,e))]):yield i})()}flushWithTimeout(e){var t=this;return y(function*(){var i=!1,s=t.flush(),r=new Promise(t=>tv(()=>{i=!0,t()},e));try{yield Promise.race([s,r])}finally{i&&s.catch(()=>{})}})()}Et(){this.flush().then(()=>{this.yt=0},e=>{this.yt++,this.it.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.jt()&&this.Nt(this.qt())})}Mt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0)}};var tx=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function tS(e){return String(e)+"000000"}function tk(e,t,i,s){var r="";return s&&(r=Object.keys(s).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(s[e])).join(",")),e+"\0"+t+"\0"+(null!=i?i:"")+"\0"+r}let tT=class{constructor(e,t,i){this._instance=e,this.Te=t,this.it=i,this.Ht=new Map,this.vt=null,this.Bt=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(e,t,i){void 0===t&&(t=1),this.Wt({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Wt({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Wt({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e,t=this,i=this.vt,s=(e=y(function*(){i&&(yield i.catch(()=>{})),yield t.Zt()}),function(){return e.apply(this,arguments)})().finally(()=>{this.vt===s&&(this.vt=null)});return this.vt=s,s}drainWindow(){if(0===this.Ht.size)return null;var e=this.Ht;return this.Ht=new Map,this.Bt=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Vt++,this.Mt(),this.Ht=new Map,this.vt=null,this.Bt=!1,this.Ut=new Map,this.zt=new Set}Wt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(e);if(null!==t){if(t.name&&"string"==typeof t.name){if("number"==typeof t.value&&Number.isFinite(t.value)){if("count"===t.type&&0>t.value)this.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{try{s=t.attributes?b({},t.attributes):void 0,r=tk(t.type,t.name,t.unit,s)}catch(i){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",i)}var s,r,n=this.Ht.get(r);
1if(!n){if(!this.Qt())return;n={name:t.name,type:t.type,unit:t.unit,attributes:s,windowStartMs:Date.now()},this.Ht.set(r,n)}var o=this.Ut.get(t.name);void 0===o?this.Ut.set(t.name,t.type):o===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(n,t.value),this.Nt()}}else this.it.warn("Dropping metric '"+t.name+"': value must be a finite number")}else this.it.warn("Dropping metric with empty name")}}}Qt(){return this.Te.maxSeriesPerFlush>this.Ht.size||(this.Bt||(this.Bt=!0,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(e,t){var i;switch(e.type){case"count":e.total=(null!==(i=e.total)&&void 0!==i?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(tx.length+1).fill(0)});var s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[function(e,t){for(var i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,tx)]+=1}}Rt(e){var t=this.Te.beforeSend;if(!t)return e;var i=Y(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.it.info("Metric was rejected in beforeSend function"),null;s=n}catch(o){return this.it.error("Error in beforeSend function for metric:",o),null}return s}Nt(){this.Dt||(this.Dt=tv(()=>{this.Dt=void 0,this.flush().catch(e=>{this.it.error("Metrics flush failed:",e)})},this.Te.flushIntervalMs))}Mt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0)}Zt(){var e=this;return y(function*(){if(0!==e.Ht.size){var t=e.Ht;e.Ht=new Map,e.Bt=!1,e.Ut=new Map,e.zt=new Set;var i=e.Vt,s=yield e._instance.Kt(e.Gt(t));if(i===e.Vt)switch(s.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.Nt();case"too-large":return void e.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.it.error("Failed to send metrics batch:",s.error)}}})()}Gt(e){var t,i,s,r,n,o,a;return t=this.Xt(e),n=this.Te,o=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),i=b({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":o,"telemetry.sdk.version":a}),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ty(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}Xt(e){var t=tS(Date.now()),i=new Map;for(var s of e.values()){var r,n=tk(s.type,s.name,s.unit,void 0),o=i.get(n);o||(o=b({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,o));var a=ty(null!==(r=s.attributes)&&void 0!==r?r:{}),l=tS(s.windowStartMs);if("count"===s.type){var u,h={attributes:a,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!==(u=s.total)&&void 0!==u?u:0};o.sum.dataPoints.push(h)}else if("gauge"===s.type){var c,d={attributes:a,timeUnixNano:t,asDouble:null!==(c=s.last)&&void 0!==c?c:0};o.gauge.dataPoints.push(d)}else s.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:t,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:tx})}return Array.from(i.values())}Yt(e){var t,i;for(var s of e){var r=s[0],n=s[1],o=this.Ht.get(r);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist){if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}}else this.Qt()&&this.Ht.set(r,n)}}};class tP{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return y(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&Y(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),b({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return y(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(r=e.synthetic)&&void 0!==r&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return s_&&i.length===sg||(sg=i.length,s_=i.reduce((i,s)=>{sv||(sv={});var r=sv[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,sv[s]=[l,u];break}}return i},{})),s_}}(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return b({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function tF(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return ee(s)||(n.lineno=s),ee(r)||(n.colno=r),n}var t$=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tR=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tI=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tO=/\((\S*)(?::(\d+))(?::(\d+))\)/,tM=(e,t)=>{var i=tR.exec(e);if(i)return tF(t,i[1],"?",+i[2],+i[3]);var s=tI.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var r=tO.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=t$(s[1]||"?",s[2]);return tF(t,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tA=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tL=(e,t)=>{var i=tC.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=tA.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?",o=t$(n,r);return tF(t,r=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tD=/\(error: (.*)\)/;class tN{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=et(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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 ed(e,"DOMException")}isDOMError(e){return ed(e,"DOMError")}}class tU{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class tH{constructor(){}match(e){return ed(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var tj=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tq{match(e){return"string"==typeof e}coerce(e,t){var i,s=this.getInfos(e),r=s[0],n=s[1];return{type:null!=r?r:"Error",value:null!=n?n:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(tj);return s&&(t=s[1],i=s[2]),[t,i]}}var tz=["fatal","error","warning","log","info","debug"];function tB(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");
1if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class tV{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ep(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+tB(e)}isSeverityLevel(e){return et(e)&&!ei(e)&&tz.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(tg(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(i){return}}}class tG{match(e){return ep(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+tB(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tW{match(e){return ec(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tK{match(e){return ed(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ep(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(i){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return ec(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}}var tJ="$message",tY="$timestamp",tZ=new Set([tJ,tY]),tX={enabled:!0,max_bytes:32768};function tQ(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:tX.enabled,max_bytes:function(e,t){if(!en(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}(e.max_bytes,tX.max_bytes)}:b({},tX)}class t0{constructor(e){this.$e=[],this.ze=0,this.Te=tQ(e)}setConfig(e){this.Te=tQ(e),this.Ze()}add(e){var t=function(e){var t;try{t=G(e)}catch(i){return}try{var s=JSON.parse(t);if(!X(s))return;var r=s[tJ],n=s[tY];if(!et(r)||0===r.trim().length||!et(n)&&!en(n))return;return{step:s,json:t}}catch(o){return}}(e);if(t){var i=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this.Te.max_bytes||(this.$e.push({step:t.step,bytes:i}),this.ze+=i,this.Ze())}}getAttachable(){return this.$e.map(e=>e.step)}clear(){this.$e=[],this.ze=0}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var e=this.$e.shift();e&&(this.ze-=e.bytes)}}}var t1=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={k(t){if(s&&(f.DEBUG||s.POSTHOG_DEBUG||i)&&!ee(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("debug",...t)},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>t1(e+" "+t,i)};return r},t2=t1("[PostHog.js]"),t3=t2.createLogger,t5=t3("[ExternalScriptsLoader]"),t4=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return t5.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==o?void 0:o.querySelectorAll("script");
1if(s){for(var r,n=0;s.length>n;n++)if(r=function(){if(s[n].src===t){var e=s[n];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}}())return r.v}var a=()=>{if(!o)return i("document not found");var s=o.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)o.head.appendChild(s);else{var r,n=o.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):o.body.appendChild(s)}};null!=o&&o.body?a():null==o||o.addEventListener("DOMContentLoaded",a)};g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5)),s=e.requestRouter.endpointFor("assets",r)}t4(e,s,i)}else{var n=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");t4(e,n,i)}},g.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);t4(e,s,i)};var t6="1.407.2";f.DEBUG=!1,f.LIB_VERSION=t6,f.LIB_NAME="web",f.JS_SDK_VERSION=t6;var t8="$people_distinct_id",t7="$device_id",t9="$device_model",ie="__alias",it="__timers",ii="$autocapture_disabled_server_side",is="$heatmaps_enabled_server_side",ir="$exception_capture_enabled_server_side",io="$error_tracking_suppression_rules",ia="$error_tracking_capture_extension_exceptions",il="$web_vitals_enabled_server_side",iu="$dead_clicks_enabled_server_side",ih="$product_tours_enabled_server_side",ic="$web_vitals_allowed_metrics",id="$session_recording_remote_config",ip="$replay_sample_rate",iv="$replay_override_sampling",ig="$replay_override_linked_flag",i_="$replay_override_url_trigger",im="$replay_override_event_trigger",iy="$sesid",ib="$session_is_sampled",iw="$enabled_feature_flags",iE="$active_feature_flags",ix="$early_access_features",iS="$feature_flag_details",ik="$feature_flag_payloads",iT="$feature_flag_request_id",iP="$minimal_flag_called_events",iF="$override_feature_flags",i$="$override_feature_flag_payloads",iR="$stored_person_properties",iI="$stored_group_properties",iO="$surveys",iM="$surveys_loaded_at",iC="$surveys_activated",iA="$surveys_activated_session",iL="ph_product_tours",iD="$flag_call_reported",iN="$flag_call_reported_session_id",iU="$feature_flag_errors",iH="$feature_flag_evaluated_at",ij="$user_state",iq="$client_session_props",iz="$capture_rate_limit",iB="$initial_campaign_params",iV="$initial_referrer_info",iG="$initial_person_info",iW="$epp",iK="$posthog_cookieless",iJ="$cookieless_mode",iY="$sdk_debug_extensions_init_method",iZ="$sdk_debug_extensions_init_time_ms",iX="$sdk_debug_recording_script_not_loaded",iQ="PostHog loadExternalDependency extension not found.",i0="on_reject",i1="always",i2="anonymous",i3="identified",i5="identified_only",i4="visibilitychange",i6="beforeunload",i8="$pageview",i7="$pageleave",i9="$identify",se="$groupidentify";function st(e,t){Y(e)&&e.forEach(t)}function si(e,t){if(!er(e)){if(Y(e))e.forEach(t);else if(el(e))e.forEach((e,i)=>t(e,i));else for(var i in e)K.call(e,i)&&t(e[i],i)}}var ss=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function sr(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var sn=function(e){try{return e()}catch(t){return}},so=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(r){t2.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),t2.critical(r)}}},sa=function(e){var t={};return si(e,function(e,i){(et(e)&&e.length>0||en(e))&&(t[i]=e)}),t},sl=["herokuapp.com","vercel.app","netlify.app"];function su(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function sh(e){return"ph_toolbar_internal"===e.name}var sc=e=>{if(o){try{for(var t=e+"=",i=o.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(n){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return en(e)&&isFinite(e)&&Math.floor(e)===e});class sd{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw RangeError("invalid field value");
1var r=new Uint8Array(16);return r[0]=e/1099511627776,r[1]=e/4294967296,r[2]=e/16777216,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new sd(r)}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),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new sd(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class sp{generate(){var e=this.generateOrAbort();if(!ee(e))return e;this.S=0;var t=this.generateOrAbort();if(ee(t))throw Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return sd.fromFieldsV7(this.S,Math.trunc(this.I/1073741824),1073741823&this.I,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new sy}}var sv,sg,s_,sf,sm=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};s&&!ee(s.crypto)&&crypto.getRandomValues&&(sm=e=>crypto.getRandomValues(e));class sy{nextUint32(){return this.R.length>this.O||(sm(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var sb=()=>sw().toString(),sw=()=>(sf||(sf=new sp)).generate(),sE="",sx=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,sS={N:()=>!!o,D(e){t2.error("cookieStore error: "+e)},A:sc,F(e){var t;try{t=JSON.parse(sS.A(e))||{}}catch(i){}return t},q(e,t,i,s,r){if(!o)return!1;try{var n="",a="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=o),sE)return sE;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+sb();!sE&&s--;){var n=i.slice(s).join("."),a=r+"=1;domain=."+n+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(r)&&(t.cookie=a+";max-age=0",sE=n)}return sE}(e);if(!i){var s,r,n=(r=e.match(sx))?r[0]:"";n!==i&&t2.info("Warning: cookie subdomain discovery mismatch",n,i),i=n}return i?"; domain=."+i:""}return""}(o.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(a="; secure");var h=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&t2.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,!0}catch(c){return!1}},P(e,t){if(null!=o&&o.cookie)try{sS.q(e,"",-1,t)}catch(i){return}}},sk=null,sT={N(){if(!es(sk))return sk;var e=!0;if(ee(s))e=!1;else try{var t="__mplssupport__";sT.q(t,"xyz"),'"xyz"'!==sT.A(t)&&(e=!1),sT.P(t)}catch(i){e=!1}return e||t2.error("localStorage unsupported; falling back to cookie store"),sk=e,e},D(e){t2.error("localStorage error: "+e)},A(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(t){sT.D(t)}return null},F(e){try{return JSON.parse(sT.A(e))||{}}catch(t){}return null},q(e,t){try{return null==s||s.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){sT.D(i)}return!1},P(e){try{null==s||s.localStorage.removeItem(e)}catch(t){sT.D(t)}}},sP=[t7,"distinct_id",iy,ib,iW,iG,ij],sF={},s$={N:()=>!0,D(e){t2.error("memoryStorage error: "+e)},A:e=>sF[e]||null,F:e=>sF[e]||null,q:(e,t)=>(sF[e]=t,!0),P(e){delete sF[e]}},sR=null,sI={N(){if(!es(sR))return sR;if(sR=!0,ee(s))sR=!1;else try{var e="__support__";sI.q(e,"xyz"),'"xyz"'!==sI.A(e)&&(sR=!1),sI.P(e)}catch(t){sR=!1}return sR},D(e){t2.error("sessionStorage error: ",e)},A(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(t){sI.D(t)}return null},F(e){try{return JSON.parse(sI.A(e))||null}catch(t){}return null},q(e,t){try{return null==s||s.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){sI.D(i)}return!1},P(e){try{null==s||s.sessionStorage.removeItem(e)}catch(t){sI.D(t)}}};class sO{constructor(e){this._instance=e}get Te(){return this._instance.config}get consent(){return this.Ge()?0:this.Qe}isOptedOut(){return this.Te.cookieless_mode===i1||this.isRejected()||-1===this.consent&&this.Te.cookieless_mode===i0}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Te.opt_out_capturing_by_default}optInOut(e){this.Je.q(this.Ke,e?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Je.P(this.Ke,this.Te.cross_subdomain_cookie)}get Ke(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;
1return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get Qe(){var e=this.Je.A(this.Ke);return eg(e)?1:z(e_,e)?0:-1}get Je(){var e=this.Te.opt_out_capturing_persistence_type,t="localStorage"===e?sT:sS;if(!this.Ye||this.Ye!==t){this.Ye=t;var i="localStorage"===e?sS:sT;i.A(this.Ke)&&(this.Ye.A(this.Ke)||this.optInOut(eg(i.A(this.Ke))),i.P(this.Ke,this.Te.cross_subdomain_cookie))}return this.Ye}Ge(){return!!this.Te.respect_dnt&&[null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,g.doNotTrack].some(e=>eg(e))}}function sM(e,t){var i,s=null==e||null==(i=e.config)?void 0:i.get_current_url;if(!Z(s))return t;try{var r=s(t);return et(r)&&r?r:t}catch(n){return t2.error("Error in get_current_url, falling back to window.location.href",n),t}}var sC="__POSTHOG_TOOLBAR__";function sA(e){return e instanceof Element&&(e.id===sC||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sL(e){return!!e&&1===e.nodeType}function sD(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function sN(e){return!!e&&3===e.nodeType}function sU(e){return!!e&&11===e.nodeType&&sL(e.host)}function sH(e){return e?B(e).split(/\s+/):[]}function sj(e,t){var i,r,n,o=(n=null==s||null==(r=s.location)?void 0:r.href,ee(n)?void 0:sM(t,n));return!!(o&&e&&e.some(e=>o.match(e)))}function sq(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 sH(t)}function sz(e){return er(e)?null:B(e).split(/(\s+)/).filter(e=>ri(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sB(e){var t="";return s5(e)&&!s4(e)&&e.childNodes&&e.childNodes.length&&si(e.childNodes,function(e){var i;sN(e)&&e.textContent&&(t+=null!==(i=sz(e.textContent))&&void 0!==i?i:"")}),B(t)}function sV(e){var t;return ee(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var sG=["a","button","form","input","select","textarea","label"];function sW(e,t){if(ee(t))return!0;var i,s=function(e){if(t.some(t=>(function(e,t){var i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(s){return!1}})(e,t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function sK(e){var t=e.parentNode;return!(!t||!sL(t))&&t}var sJ=[".ph-no-autocapture","[data-ph-no-autocapture]"],sY=["next","previous","prev",">","<"],sZ=[...sY,"+","-","−","–"],sX=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,sQ=[".ph-no-rageclick",".ph-no-capture"],s0=["","text","search","email","password","url","tel","number"];function s1(e,t){if(!s||s2(e)||(ea(t)?(r=!!t&&sQ,n=void 0,o=!1):(r=null!==(a=null==t?void 0:t.css_selector_ignorelist)&&void 0!==a?a:sQ,n=null==t?void 0:t.content_ignorelist,o=null!==(l=null==t?void 0:t.ignore_text_selection)&&void 0!==l&&l),!1===r)||o&&!(!(i=e)||!sL(i))&&(sD(i,"textarea")||(sD(i,"input")?z(s0,(i.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(i))))return!1;var i,r,n,o,a,l,u=s3(e,!1).targetElementList;return!function(e,t){var i;if(!1===e||ee(e))return!1;if(!0===e)i=sY;else{if(!Y(e))return!1;if(e.length>10)return t2.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var t=e.safeText,s=e.ariaLabel;return i.some(e=>sX(t,e)||sX(s,e))})}(n,u.map(e=>{var t;return{safeText:sB(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!sW(u,r)}var s2=e=>!e||sD(e,"html")||!sL(e),s3=(e,t)=>{if(!s||s2(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!sD(n,"body");)if(sU(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=sK(n);if(!o)break;if(t||sG.indexOf(o.tagName.toLowerCase())>-1)i=!0;else try{var a=s.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}catch(l){}r.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:r}};function s5(e){for(var t=new Set,i=0,s=e;s.parentNode&&!sD(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);var r=sq(s);if(z(r,"ph-sensitive")||z(r,"ph-no-capture"))return!1}if(z(sq(e),"ph-include"))return!0;var n=e.type||"";if(et(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}
1var o=e.name||e.id||"";return!et(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 s4(e){return!!(sD(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sD(e,"select")||sD(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var s6="(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})",s8=RegExp("^(?:"+s6+")$"),s7=RegExp(s6),s9="\\d{3}-?\\d{2}-?\\d{4}",re=RegExp("^("+s9+")$"),rt=RegExp("("+s9+")");function ri(e,t){return void 0===t&&(t=!0),!(er(e)||et(e)&&(e=B(e),(t?s8:s7).test((e||"").replace(/[- ]/g,""))||(t?re:rt).test(e)))}function rs(e){var t=sB(e);return ri(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&si(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=sB(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(n){t2.error("[AutoCapture]",n)}}),i}(e)).trim())?t:""}function rr(e){return e.replace(/"|\\"/g,'\\"')}var rn=t3("[Dead Clicks]"),ro=()=>!0,ra=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(iu)),s=e.instance.config.capture_dead_clicks;return ea(s)?s:!!X(s)||i};class rl{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[iu]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr(()=>{this.er()}):this.stop()}tr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?rn.error("failed to load script",t):e()})}er(){var e;if(o){if(!this.Xe&&null!=(e=g.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=X(this.instance.config.capture_dead_clicks)?b({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Xe=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Xe.start(o),rn.info("starting...")}}else rn.error("`document` not found. Cannot start.")}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,rn.info("stopping..."))}}var ru=t3("[SegmentIntegration]"),rh="posthog-js";function rc(e,t){var i=void 0===t?{}:t,s=i.organization,r=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,l=i.sendExceptionsToPostHog,u=void 0===l||l;return t=>{if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var i=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=i,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var o,l,h,c,d,p,v=(null==(o=t.exception)?void 0:o.values)||[],g=v.map(e=>b({},e,{stacktrace:e.stacktrace?b({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>b({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(h=v[0])?void 0:h.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:t.tags};return s&&r&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}class rd{constructor(e,t,i,s,r,n){this.name=rh,this.setupOnce=function(o){o(rc(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class rp{constructor(e){this.rr=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(t2.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.nr()}nr(){var e;this.sr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.rr)}destroy(){var e;null==(e=this.sr)||e.call(this),this.sr=void 0}doPageView(e,t){var i,r=this.ar(e,t);return this.ir={pathname:null!==(i=null==s?void 0:s.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ar(e,null==(t=this.ir)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.ir)?void 0:e.pageViewId}}ar(e,t){var i=this.ir;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,h=r.maxContentY;if(!(ee(n)||ee(o)||ee(a)||ee(l)||ee(u)||ee(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var c=n>1?ef(o/n,0,1,t2):1,d=n>1?ef(a/n,0,1,t2):1,p=l>1?ef(u/l,0,1,t2):1,v=l>1?ef(h/l,0,1,t2):1;s=ss(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var rv=["flags","surveys"],rg={[t8]:{exposure:"hidden"},[ie]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[it]:{exposure:"hidden"},[ii]:{exposure:"event"},[is]:{exposure:"hidden"},[ir]:{exposure:"event"},[io]:{exposure:"hidden"},[ia]:{exposure:"event"},[il]:{exposure:"event"},[iu]:{exposure:"event"}
1,[ih]:{exposure:"hidden"},[ic]:{exposure:"event"},[id]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[iy]:{exposure:"hidden"},[ib]:{exposure:"event"},[ip]:{exposure:"event",shouldSkipFromEventProperties:e=>es(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"},[iw]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!X(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[iE]:{exposure:"event",storageGroup:"flags"},[ix]:{exposure:"hidden"},[iS]:{exposure:"hidden",storageGroup:"flags"},[ik]:{exposure:"event",storageGroup:"flags"},[iT]:{exposure:"event",storageGroup:"flags",volatile:!0},[iP]:{exposure:"hidden",storageGroup:"flags"},[iF]:{exposure:"event"},[i$]:{exposure:"hidden"},[iR]:{exposure:"hidden"},[iI]:{exposure:"hidden"},[iO]:{exposure:"hidden",storageGroup:"surveys"},[iM]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[iC]:{exposure:"event"},[iA]:{exposure:"hidden"},[iL]:{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"},[iD]:{exposure:"hidden"},[iN]:{exposure:"hidden"},[iU]:{exposure:"hidden"},[iH]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ij]:{exposure:"hidden"},[iq]:{exposure:"hidden"},[iz]:{exposure:"hidden"},[iB]:{exposure:"hidden"},[iV]:{exposure:"hidden"},[iG]:{exposure:"hidden"},[iW]:{exposure:"hidden"},[iv]:{exposure:"event"},[ig]:{exposure:"event"},[i_]:{exposure:"event"},[im]:{exposure:"event"},[iY]:{exposure:"event"},[iZ]:{exposure:"event"},[iX]:{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"}},r_=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],rf=e=>{var t=rg[e];if(t)return t;for(var i of r_){var s=i[1];if(0===e.indexOf(i[0]))return s}},rm=(e,t)=>{try{return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t)}catch(i){return G(e)}},ry=e=>{var t=null==o?void 0:o.createElement("a");return ee(t)?null:(t.href=e,t)},rb=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!Y(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(a){t2.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rw=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");Y(c)&&(t.includes(c[0])?u.push(c[0]+"="+i):u.push(l[h]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},rE=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},rx=(e,t)=>e>=t&&p(),rS=(e,t,i,s)=>{if(0===e){if(p()){var r=t+1;return r===i&&s(),r}return t}return 0},rk="https?://(.*)",rT=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rP=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...rT],rF="<masked>",r$=["li_fat_id"];function rR(e,t,i){if(!o)return{};var s,r=rI(rw(o.URL,t?[...rT,...i||[]]:[],rF),e),n=(s={},si(r$,function(e){var t=sc(e);s[e]=t||null}),s);return ss(n,r)}function rI(e,t){var i=rP.concat(t||[]),s={};return si(i,function(t){var i=rb(e,t);s[t]=i||null}),s}function rO(e){var t,i=e?0===e.search(rk+"google.([^/?]*)")?"google":0===e.search(rk+"bing.com")?"bing":0===e.search(rk+"yahoo.com")?"yahoo":0===e.search(rk+"duckduckgo.com")?"duckduckgo":null:null,s={};if(!es(i)){s.$search_engine=i;var r=o?rb(o.referrer,"yahoo"!=i?"q":"p"):"";r.length&&(s.ph_keyword=r)}return s}function rM(){return navigator.language||navigator.userLanguage}var rC="$direct";function rA(){return(null==o?void 0:o.referrer)||rC}function rL(e,t,i){void 0===i&&(i=!1);var s=i?tp(null==a?void 0:a.href):null==a?void 0:a.href,r=null==s?void 0:s.substring(0,1e3);return{r:rA().substring(0,1e3),u:r?rw(r,e?[...rT,...t||[]]:[],rF):void 0}}function rD(e,t){void 0===t&&(t=!1);var i,s=e.r,r=e.u,n=t?tp(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==rC?rC:null==(i=ry(s))?void 0:i.host};
1if(n){o.$current_url=n;var a=ry(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=rI(n);ss(o,l)}if(s){var u=rO(s);ss(o,u)}return o}function rN(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var rU={flags:iH,surveys:iM},rH=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],rj="main";class rq{constructor(e,t,i){var r,n;if(void 0===i&&(i=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=e,this.dr=i,this.props={},this.cr=!1,this.vr=(n="",e.token&&(n=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+n+"_posthog"),this.Je=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&t2.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),s){var o=()=>this.flush();su(s,"beforeunload",o,{capture:!1}),su(s,"pagehide",o,{capture:!1})}}mr(){var e,t=null==(e=this.Te)?void 0:e.persistence_save_debounce_ms;return en(t)&&t>0?t:0}isDisabled(){return!!this.yr}pr(e){-1===rH.indexOf(e.persistence.toLowerCase())&&(t2.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,r,n,o=(t=e.cookie_persisted_properties||[],i=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===i&&(i=!1),r=[...sP,...t],b({},sT,{F(e){try{var t={};try{t=sS.F(e)||{}}catch(s){}var r,n=JSON.parse(sT.A(e)||"{}");if(i){var o={};for(var a in t){var l=t[a];es(l)||""===l||(o[a]=l)}r=ss(n,o)}else r=ss(t,n);return sT.q(e,r),r}catch(u){}return null},q(e,t,i,s,n,o){var a=sT.q(e,t,void 0,void 0,o);try{var l={};r.forEach(e=>{t[e]&&(l[e]=t[e])}),Object.keys(l).length&&sS.q(e,l,i,s,n,o)}catch(u){sT.D(u)}return a},P(e,t){try{null==s||s.localStorage.removeItem(e),sS.P(e,t)}catch(i){sT.D(i)}}})),a=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&sT.N()?(n=sT,a=!0):"localstorage+cookie"===l&&o.N()?(n=o,a=!0):"sessionstorage"===l&&sI.N()?n=sI:"memory"===l?n=s$:"cookie"===l?n=sS:o.N()?(n=o,a=!0):n=sS,this.ur=a,n}br(e){return this.vr+"__"+e}gr(e){return this.ur&&!!e.split_storage}_r(e){var t=null!=e?e:this.Te.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[iH];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return si(this.props,(t,i)=>{var s=rf(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===iw?()=>this._r():()=>!1))return;s.transformToEventProperties&&ss(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,()=>!1))return;e[i]=t}}),e}load(){if(!this.yr){var e=this.Je.F(this.vr);e&&(this.props=ss({},e)),this.hr&&this.wr()}}wr(){for(var e of rv){var t=sT.F(this.br(e));if(t&&!Q(t)){var i=this.kr(e);i.persisted=!0,this.Sr(e)||(i.fingerprint=this.Cr(t,e)),this.Ir(e,t)||ss(this.props,t)}}}Sr(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=rf(t))?void 0:i.storageGroup)===e})}Ir(e,t){var i=rU[e];if(!i)return!1;var s=t[i],r=this.props[i];return en(s)&&en(r)&&r>s}refreshKey(e){var t;if(!this.yr){var i=this.hr?null==(t=rf(e))?void 0:t.storageGroup:void 0,s=i?sT.F(this.br(i)):this.Je.F(this.vr);if(s&&e in s)this.Tr(e,s[e]);else{if(i){var r=this.Je.F(this.vr);if(r&&e in r)return void this.Tr(e,r[e])}this.Mr(e)}}}save(){if(!this.yr){var e=this.mr();e>0?ee(this.Er)&&(this.Er=setTimeout(()=>{this.Er=void 0,this.Rr()},e)):this.Rr()}}flush(){ee(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,rj))}Pr(){var e=this.Fr(),t=e.main,i=e.groups;for(var s of(this.Or(this.Je,this.vr,t,rj),rv)){var r,n=i[s];(!Q(n)||null!=(r=this.lr[s])&&r.persisted)&&this.Or(sT,this.br(s),n,s)}}Fr(){var e={},t={flags:{},surveys:{}};return si(this.props,(i,s)=>{var r,n=null==(r=rf(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}Cr(e,t){if(t===rj)return JSON.stringify(e)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return si(e,(e,t)=>{var s;i[t]=null!=(s=rf(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}Or(e,t,i,s){var r,n=this.kr(s);if(s===rj||n.dirty||ee(n.fingerprint)){try{if((r=this.Cr(i,s))===n.fingerprint)return void(n.dirty=!1)}catch(o){r=void 0}e.q(t,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(n.dirty=!1,s!==rj&&(n.persisted=!0),ee(r)||(n.fingerprint=r)):this.Te.debug&&t2.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(ee(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.P(this.vr,!1),this.Je.P(this.vr,!0),!i&&this.dr)for(var s of rv)sT.P(this.br(s));i?delete this.lr[rj]:this.lr={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(X(e)){ee(t)&&(t="None"),this.Lr=ee(i)?this.Nr:i;var s=!1;if(si(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Tr(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(X(e)){this.Lr=ee(t)?this.Nr:t;var i=!1;if(si(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.Tr(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Mr(e),this.save())}update_campaign_params(){if(!this.cr){var e=rR(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);Q(sa(e))||this.register(e),this.cr=!0}}update_search_keyword(){var e;this.register((e=null==o?void 0:o.referrer)?rO(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rA(),$referring_domain:null!=o&&o.referrer&&(null==(e=ry(o.referrer))?void 0:e.host)||rC},void 0)}set_initial_person_info(){this.props[iB]||this.props[iV]||this.register_once({[iG]:rL(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes
1)},void 0)}get_initial_props(){var e={};si([iV,iB],t=>{var i=this.props[t];i&&si(i,function(t,i){e["$initial_"+V(i)]=t})});var t=this.props[iG];if(t){var i,s,r,n,o=(void 0===(s=this.Te.disable_capture_url_hashes)&&(s=!1),r=rD(t,s),n={},si(r,function(e,t){n["$initial_"+V(t)]=e}),n);ss(e,o)}return e}safe_merge(e){return si(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){this.Nr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this.pr(e):this.Je,n=this.gr(e);if(s||n!==this.hr){var o=this.props;this.clear(),this.Je=r,this.hr=n,this.props=o,this.save()}}set_disabled(e){this.yr=e,this.yr?this.remove():this.save()}set_cross_subdomain(e){e!==this.$r&&(this.$r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ar&&(this.Ar=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[it]||{};i[e]=t,this.Tr(it,i),this.save()}remove_event_timer(e){var t=this.props[it]||{},i=t[e];return ee(i)||(delete t[e],this.Tr(it,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){var i;this.props[e]=t,null!=(i=rf(e))&&i.volatile||this.Dr(e)}Mr(e){delete this.props[e],this.Dr(e)}Dr(e){var t,i=null==(t=rf(e))?void 0:t.storageGroup;i&&(this.kr(i).dirty=!0)}kr(e){return this.lr[e]||(this.lr[e]={})}}var rz={Activation:"events",Cancellation:"cancelEvents"},rB={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},rV={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},rG={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"},rW={Popover:"popover",Inline:"inline"},rK={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"},rJ={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"},rY=t3("[RateLimiter]");class rZ{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
vendor: 8,623 bytes, line 1
1if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{rY.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(i){return void rY.warn('could not rate limit - continuing. Error: "'+(null==i?void 0:i.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(iz))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(iz,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var rX=t3("[RemoteConfig]");class rQ{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}qr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}jr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return rX.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void rX.warn("Remote config is disabled. Falling back to local config.");this.qr(e=>{if(!e)return rX.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr(e=>{this.Hr(e),this.Br()});this.Hr(e),this.Br()})}catch(e){rX.error("Error loading remote config",e)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&o&&"hidden"!==o.visibilityState&&this._instance.reloadFeatureFlags()}Br(){var e;if(!this.zr){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this.zr=setInterval(()=>{this.refresh()},t))}}Hr(e){var t;e||rX.error("Failed to fetch remote config from PostHog."),this._instance.Hr(e?{ok:!0,config:e}:{ok:!1}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var r0={GZipJS:"gzip-js",Base64:"base64"},r1=Uint8Array,r2=Uint16Array,r3=Uint32Array,r5=new r1([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]),r4=new r1([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]),r6=new r1([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r8=function(e,t){for(var i=new r2(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new r3(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},r7=r8(r5,2),r9=r7[1];r7[0][28]=258,r9[258]=28;for(var ne=r8(r4,0)[1],nt=new r2(32768),ni=0;32768>ni;++ni){var ns=(43690&ni)>>>1|(21845&ni)<<1;nt[ni]=((65280&(ns=(61680&(ns=(52428&ns)>>>2|(13107&ns)<<2))>>>4|(3855&ns)<<4))>>>8|(255&ns)<<8)>>>1}var nr=function(e,t,i){for(var s=e.length,r=0,n=new r2(t);s>r;++r)++n[e[r]-1];var o,a=new r2(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new r2(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],h=t-e[r],c=a[e[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[nt[c]>>>l]=u}else for(o=new r2(s),r=0;s>r;++r)o[r]=nt[a[e[r]-1]++]>>>15-e[r];return o},nn=new r1(288);for(ni=0;144>ni;++ni)nn[ni]=8;for(ni=144;256>ni;++ni)nn[ni]=9;for(ni=256;280>ni;++ni)nn[ni]=7;for(ni=280;288>ni;++ni)nn[ni]=8;var no=new r1(32);for(ni=0;32>ni;++ni)no[ni]=5;var na,nl=nr(nn,9,0),nu=nr(no,5,0),nh=function(e){return(e/8>>0)+(7&e&&1)},nc=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof r2?r2:e instanceof r3?r3:r1)(i-t);return s.set(e.subarray(t,i)),s},nd=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},np=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},nv=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new r1(0),0];if(1==r){var o=new r1(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=r-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new r2(d+1),v=ng(i[h-1],p,0);if(v>t){s=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new r1(p),v]},ng=function(e,t,i){return -1==e.s?Math.max(ng(e.l,t,i+1),ng(e.r,t,i+1)):t[e.s]=i},n_=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new r2(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},nf=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},nm=function(e,t,i){var s=i.length,r=nh(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},ny=function(e,t,i,s,r,n,o,a,l,u,h){nd(t,h++,i),++r[256];for(var c=nv(r,15),d=c[0],p=c[1],v=nv(n,15),g=v[0],_=v[1],f=n_(d),m=f[0],y=f[1],b=n_(g),w=b[0],E=b[1],x=new r2(19),S=0;m.length>S;++S)x[31&m[S]]++;for(S=0;w.length>S;++S)x[31&w[S]]++;for(var k=nv(x,7),T=k[0],P=k[1],F=19;F>4&&!T[r6[F-1]];--F);var $,R,I,O,M=u+5<<3,C=nf(r,nn)+nf(n,no)+o,A=nf(r,d)+nf(n,g)+o+14+3*F+nf(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(C>=M&&A>=M)return nm(t,h,e.subarray(l,l+u));if(nd(t,h,1+(C>A)),h+=2,C>A){$=nr(d,p,0),R=d,I=nr(g,_,0),O=g;var L=nr(T,P,0);for(nd(t,h,y-257),nd(t,h+5,E-1),nd(t,h+10,F-4),h+=14,S=0;F>S;++S)nd(t,h+3*S,T[r6[S]]);h+=3*F;for(var D=[m,w],N=0;2>N;++N){var U=D[N];for(S=0;U.length>S;++S)nd(t,h,L[H=31&U[S]]),h+=T[H],H>15&&(nd(t,h,U[S]>>>5&127),h+=U[S]>>>12)}}else $=nl,R=nn,I=nu,O=no;for(S=0;a>S;++S)if(s[S]>255){np(t,h,$[257+(H=s[S]>>>18&31)]),h+=R[H+257],H>7&&(nd(t,h,s[S]>>>23&31),h+=r5[H]);var H,j=31&s[S];np(t,h,I[j]),h+=O[j],j>3&&(np(t,h,s[S]>>>5&8191),h+=r4[j])}else np(t,h,$[s[S]]),h+=R[s[S]];return np(t,h,$[256]),h+R[256]},nb=new r3([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nw=function(){for(var e=new r3(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),nE=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},nx="text/plain",nS=!1,nk=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},nT=function(e,t,i){void 0===i&&(i=!0);var s,r,n,o,a,l,u=e.split("?"),h=u[0],c=u[1],d=b({},t),p=null!==(l=null==c?void 0:c.split("&").map(e=>{var t,s=e.split("="),r=s[0],n=i&&null!==(t=d[r])&&void 0!==t?t:s[1];return delete d[r],r+"="+n}))&&void 0!==l?l:[],v=(void 0===r&&(r="&"),a=[],si(d,function(e,t){ee(e)||ee(t)||"undefined"===t||(n=encodeURIComponent(e instanceof File?e.name:e.toString()),o=encodeURIComponent(t),a[a.length]=o+"="+n)}),a.join(r));return v&&p.push(v),p.length>0?h+"?"+p.join("&"):h},nP=e=>{if(e.Vr)return e.Vr;var t=e.data,i=e.compression;if(t){if(i===r0.GZipJS){var s,r,n,o,a,l,u,h,c,d,p=(s=function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new r1(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new r1(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>
1l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return nc(s,0,r)}(rm(t)),r={mtime:0},void 0===r&&(r={}),n=(a=4294967295,{p(e){for(var t=a,i=0;e.length>i;++i)t=nw[255&t^e[i]]^t>>>8;a=t},d:()=>4294967295^a}),o=s.length,n.p(s),c=(h=10+((l=r).filename&&l.filename.length+1||0),function(e,t,i,s,r,n){var o=e.length,a=new r1(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=nm(l,u,e.subarray(h,c)):(l[h]=!0,u=nm(l,u,e.subarray(h,o)))}else{for(var d=nb[t-1],p=d>>>13,v=8191&d,g=(1<<i)-1,_=new r2(32768),f=new r2(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new r3(25e3),E=new r2(288),x=new r2(32),S=0,k=0,T=(h=0,0),P=0,F=0;o>h;++h){var $=b(h),R=32767&h,I=f[$];if(_[R]=I,f[$]=R,h>=P){var O=o-h;if((S>7e3||T>24576)&&O>423){u=ny(e,l,0,w,E,x,k,T,F,h-F,u),T=S=k=0,F=h;for(var M=0;286>M;++M)E[M]=0;for(M=0;30>M;++M)x[M]=0}var C=2,A=0,L=v,D=R-I&32767;if(O>2&&$==b(h-D))for(var N=Math.min(p,O)-1,U=Math.min(32767,h),H=Math.min(258,O);U>=D&&--L&&R!=I;){if(e[h+C]==e[h+C-D]){for(var j=0;H>j&&e[h+j]==e[h+j-D];++j);if(j>C){if(C=j,A=D,j>N)break;var q=Math.min(D,j-2),z=0;for(M=0;q>M;++M){var B=h-D+M+32768&32767,V=B-_[B]+32768&32767;V>z&&(z=V,I=B)}}}D+=(R=I)-(I=_[R])+32768&32767}if(A){w[T++]=268435456|r9[C]<<18|ne[A];var G=31&r9[C],W=31&ne[A];k+=r5[G]+r4[W],++E[257+G],++x[W],P=h+C,++S}else w[T++]=e[h],++E[e[h]]}}u=ny(e,l,!0,w,E,x,k,T,F,h-F,u)}return nc(a,0,s+nh(u)+r)}(s,null==(u=r).level?6:u.level,null==u.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+u.mem,h,8)),d=c.length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&nE(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(c,r),nE(c,d-8,n.d()),nE(c,d-4,o),c);return{contentType:nx,body:p.buffer.slice(p.byteOffset,p.byteOffset+p.byteLength),estimatedSize:p.byteLength}}if(i===r0.Base64){var v,g,_=(g=(v=rm(t))?btoa(encodeURIComponent(v).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):v,"data="+encodeURIComponent("string"==typeof g?g:rm(g)));return{contentType:"application/x-www-form-urlencoded",body:_,estimatedSize:new Blob([_]).size}}var f=rm(t);return{contentType:"application/json",body:f,estimatedSize:new Blob([f]).size}}},nF=e=>{var t,i,s=()=>"sendBeacon"===e.transport?{url:nT(e.url,{compression:r0.Base64}),encodedBody:nP(b({},e,{compression:r0.Base64,Vr:void 0}))}:{url:nk(e.url,"compression"),encodedBody:nP(b({},e,{compression:void 0,Vr:void 0}))};try{t=nP(e)}catch(r){if(L(e.compression,rb(e.url,"compression")))return t2.error("Failed to gzip request body, sending uncompressed payload",r),s();throw r}return!(t&&L(e.compression,rb(e.url,"compression")))||((i=t.body)instanceof ArrayBuffer?A(new Uint8Array(i)):ArrayBuffer.isView(i)&&A(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?{url:e.url,encodedBody:t}:(nS=!0,s())},n$=e=>{try{return nF(e)}catch(t){return t2.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},nR=(na=y(function*(e){var t=yield function(e,t,i){return H.apply(this,arguments)}(rm(e.data),f.DEBUG,{rethrow:!0});if(!t)return e;var i=yield t.arrayBuffer();return b({},e,{Vr:{contentType:nx,body:i,estimatedSize:i.byteLength}})}),function(e){return na.apply(this,arguments)}),nI=/Failed to fetch|NetworkError|Load failed/i,nO=e=>{var t=n$(e);if(t){var i,s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,u=n.estimatedSize,c=new Headers;si(e.headers,function(e,t){c.append(t,e)}),o&&c.append("Content-Type",o);var d=null,p=!1;if(h){var v=new h;d={signal:v.signal,timeout:setTimeout(()=>{var t,i;p=!0,v.abort(((i=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",i))},e.timeout)}}var g=t=>{var i;p&&"AbortError"===(null==t?void 0:t.name)||"TypeError"===(null==t?void 0:t.name)&&nI.test((null==t?void 0:t.message)||"")?t2.warn(t):t2.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{l(s,b({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e.Wr&&52428.8>(u||0),body:a,signal:null==(i=d)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(r){t2.error(r)}null==e.callback||e.callback(s)})).catch(g).finally(()=>d?clearTimeout(d.timeout):null)}catch(_){d&&clearTimeout(d.timeout),g(_)}}},nM=e=>{try{var t=nF(e),i=t.url,s=t.encodedBody,r=null!=s?s:{},o=r.body,a=r.estimatedSize;if(!o)return;var l=o instanceof Blob?o:new Blob([o],{type:r.contentType});if(n.sendBeacon(i,l))return;if(Y(e.data)&&e.data.length>1&&(null!=a?a:0)>16384){var u=Math.ceil(e.data.length/2);return nM(b({},e,{data:e.data.slice(0,u)})),void nM(b({},e,{data:e.data.slice(u)}))}t2.warn("Beacon of ~"+(null!=a?a:0)+" bytes was rejected by the browser, falling back to fetch"),nO(b({},e,{Wr:!0}))}catch(h){t2.warn("Beacon send failed",h)}},nC=["/e/","/s/"],nA=(e,t,i,s)=>{var r,n,o,a,l,u=(l=(a=(null==(o=ry(e))?void 0:o.pathname)||e.split(/[?#]/)[0])?"/"===a[0]?a:"/"+a:"/",nC.some(e=>{var t,i;return l.slice(l.length-e.length)===e})),h=u?nk(e,"ver"):e,c="query"===s?"POST"===t?"sent_at":"_":void 0;return nT(i===r0.GZipJS?nk(h,"compression"):h,b({},c?{[c]:Date.now().toString()}:{},u?{}:{ver:f.JS_SDK_VERSION},i===r0.GZipJS?{}:{compression:i}))},nL=[];l&&nL.push({transport:"fetch",method:nO}),u&&nL.push({transport:"XHR",method(e){var t=n$(e);if(t){var i=new u,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;si(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};
1if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(s){}null==e.callback||e.callback(t)}},i.send(o)}}}),null!=n&&n.sendBeacon&&nL.push({transport:"sendBeacon",method:nM});class nD{constructor(e,t){this.Zr=!0,this.Gr=[],this.Qr=ef((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,t2.createLogger("flush interval"),3e3),this.Jr=e}enqueue(e){this.Gr.push(e),this.Kr||this.Yr()}unload(){this.Xr();var e=Object.values(this.Gr.length>0?this.ti():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ei(b({},e,{transport:"sendBeacon"}))})}enable(){this.Zr=!1,this.Yr()}Yr(){var e=this;this.Zr||(this.Kr=setTimeout(()=>{if(this.Xr(),this.Gr.length>0){var t=this.ti();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&Y(s.data)&&si(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.ei(s)}()}},this.Qr))}ei(e){try{this.Jr(e)}catch(t){t2.error(t)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ti(){var e={};return si(this.Gr,t=>{var i,s=(t?t.batchKey:null)||t.url;ee(e[s])&&(e[s]=b({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.Gr=[],e}}var nN=["retriesPerformedSoFar"];class nU{constructor(e){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=!0,!ee(s)&&"onLine"in s.navigator&&(this.ni=s.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},su(s,"online",this.si),su(s,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=w(e,nN);eo(t)&&(i.url=nT(i.url,{retry_count:t})),this._instance._send_request(b({},i,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.Ot(b({retriesPerformedSoFar:t},i));0===e.statusCode&&t2.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==i.callback||i.callback(e)}}))}Ot(e){var t,i,s,r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var n=Math.ceil((s=Math.min(18e5,i=3e3*Math.pow(2,r)))+(Math.random()-.5)*(s-i/2)),o=Date.now()+n;this.Gr.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),t2.warn(a),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),0===this.Gr.length)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout(()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()},this.ii)}oi(){var e=Date.now(),t=[],i=this.Gr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Gr=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,ee(s)||(this.si&&(s.removeEventListener("online",this.si),this.si=void 0),this.ai&&(s.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var t=e.requestOptions;try{this._instance._send_request(b({},t,{transport:"sendBeacon"}))}catch(i){t2.error(i)}}this.Gr=[]}}class nH{constructor(e){this.hi=()=>{this.di||(this.di={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.di.lastScrollY=Math.ceil(n),this.di.maxScrollY=Math.max(n,null!==(e=this.di.maxScrollY)&&void 0!==e?e:0),this.di.maxScrollHeight=Math.max(o,null!==(t=this.di.maxScrollHeight)&&void 0!==t?t:0),this.di.lastContentY=a,this.di.maxContentY=Math.max(a,null!==(i=this.di.maxContentY)&&void 0!==i?i:0),this.di.maxContentHeight=Math.max(l,null!==(s=this.di.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var e=this.di;return setTimeout(this.hi,0),e}startMeasuringScrollPosition(){su(s,"scroll",this.hi,{capture:!0}),su(s,"scrollend",this.hi,{capture:!0}),su(s,"resize",this.hi)}scrollElement(){if(!this.ci)return null==s?void 0:s.document.documentElement;var e=Y(this.ci)?this.ci:[this.ci];for(var t of e){var i=null==s?void 0:s.document.querySelector(t);if(i)return i}}vi(e){if(this.ci){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return s?"y"===e?s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop||0:s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var nj=e=>rL(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes
1);class nq{constructor(e,t,i,s){this.fi=e=>{var t=this.pi();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.gi(this._instance)};this.mi.register({[iq]:i})}},this._instance=e,this.yi=t,this.mi=i,this.gi=s||nj,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[iq]}getSetOnceProps(){var e,t=null==(e=this.pi())?void 0:e.props;return t?"r"in t?rD(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return si(sa(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+V(i)]=t}),e}}class nz{on(e,t){return this.bi[e]||(this.bi[e]=[]),this.bi[e].push(t),()=>{this.bi[e]=this.bi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.bi[e]||[])i(t);for(var s of this.bi["*"]||[])s(e,t)}constructor(){this.bi={}}}var nB=t3("[SessionId]");class nV{on(e,t){return this.wi.on(e,t)}constructor(e,t,i){if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new nz,this.Ii=(e,t)=>!(!eo(e)||!eo(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===i1)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=e.config,this.mi=e.persistence,this.Ti=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=t||sb,this.Ri=i||sb;var s,r=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*ef(this.Te.session_idle_timeout_seconds||1800,60,36e3,nB.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+r+"_window_id",this.Fi="ph_"+r+"_primary_window_exists",this.Li()){var n=sI.F(this.Oi),o=sI.F(this.Fi);n&&!o?this.Ti=n:sI.P(this.Oi),sI.q(this.Fi,!0)}if(null!=(s=this.Te.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this.Te.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,(new Date).getTime(),a)}catch(l){nB.error("Invalid sessionID in bootstrap",l)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ee(this.ki)&&(this.ki=[]),this.ki.push(e),this.Mi&&e(this.Mi,this.Ti),()=>{this.ki=this.ki.filter(t=>t!==e)}}Li(){return"memory"!==this.Te.persistence&&!this.mi.yr&&sI.N()}Ni(e){e!==this.Ti&&(this.Ti=e,this.Li()&&sI.q(this.Oi,e))}Di(){return this.Ti?this.Ti:this.Li()?sI.F(this.Oi):null}qi(e){var t=this.xi;return!es(t)&&!es(e)&&5e3>Math.abs(e-t)}$i(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Mi=e,r&&!s||r&&this.qi(t)||(this.xi=t,this.mi.register({[iy]:[t,e,i]}))}ji(){var e,t=null==(e=this.Te)?void 0:e.persistence_save_debounce_ms;return eo(t)&&t>0}Hi(){this.ji()?this.mi.refreshKey(iy):(this.mi.flush(),this.mi.load())}Bi(){var e;if(!es(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var t=this.Ui();t[1]===this.Mi&&t[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[iy]:[this._sessionActivityTimestamp,null!==(e=this.Mi)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var e=this.Ui()[0],t=eo(e)?e:0,i=eo(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}Vi(e){return this.Hi(),this.Ii(e,this.zi())}Ui(){var e=this.mi.props[iy];return Y(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&s&&(s.removeEventListener(i6,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&sI.P(this.Fi)},su(s,i6,this.Si,{capture:!1})}
1checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Te.cookieless_mode===i1)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this.Ui(),r=s[1],n=s[2],o=this.zi(),a=this.Di(),l=eo(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,c=!r,d=r,p=!c&&!e&&this.Ii(i,o);if(p){(p=this.Vi(i))||nB.info("cross-tab refresh kept the session alive",{sessionId:r});var v=this.Ui();r=v[1],n=v[2]}c||p||l?(r=this.Ei(),a=this.Ri(),nB.info("new session ID generated",{sessionId:r,windowId:a,changeReason:{noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.Ri(),u=!0),(h=r!==d)&&(nB.info("adopted cross-tab session id",{sessionId:r,windowId:a}),u=!0));var g=eo(o)&&e&&!l?o:i,_=eo(n)?n:(new Date).getTime();this.Ni(a),this.$i(r,g,_),e||this.Pi();var f={noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.ki.forEach(e=>e(r,a,f)),{sessionId:r,windowId:a,sessionStartTimestamp:_,changeReason:u?f:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout(()=>{if(!this.Ci){if(this.Vi((new Date).getTime())){var e=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:e})}else this.Pi()}},1.1*this.sessionTimeoutMs))}}var nG=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&q(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>q(null==e?void 0:e.brand,t)))return!0}catch(r){}return!!e.webdriver};function nW(){return(nW=y(function*(){var e=null==n?void 0:n.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return et(i)&&i.length>0?i:void 0}catch(s){return void t2.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",s)}})).apply(this,arguments)}var nK=function(e,t){if(!function(e){try{RegExp(e)}catch(t){return!1}return!0}(t))return!1;try{return RegExp(t).test(e)}catch(i){return!1}};function nJ(e,t,i){return rm({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var nY={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>nK(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!nK(t,e))),icontains:(e,t)=>t.map(nZ).some(t=>e.map(nZ).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(nZ).every(t=>e.map(nZ).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},nZ=e=>e.toLowerCase();function nX(e,t){return!e||Object.entries(e).every(e=>{var i=e[1],s=null==t?void 0:t[e[0]];if(ee(s)||es(s))return!1;var r=[String(s)],n=nY[i.operator];return!!n&&n(i.values,r)})}var nQ="custom",n0="i.posthog.com",n1=/^\/static\//;class n2{constructor(e){this.Zi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+n0,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Zi[this.apiHost]||(this.Zi[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":nQ),this.Zi[this.apiHost]}Gi(e){if(n1.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this.Gi(t);if(i)return""+i+t}if(this.region===nQ)return this.apiHost+t;var s=n0+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}function n3(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}var n5=t3("[Surveys]"),n4="seenSurvey_",n6=e=>{try{var t,i,s,r=""+n4+(e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id);if(localStorage.getItem(r))return;localStorage.setItem(r,"true")}catch(n){n5.error("Failed to persist survey seen state",n)}},n8=[rB.Popover,rB.Widget,rB.API],n7={ignoreConditions:!1,ignoreDelay:!1,displayType:rW.Popover}
1,n9=t3("[PostHog ExternalIntegrations]"),oe={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ot{constructor(e){this._instance=e}tr(e,t){var i;null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return n9.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this;for(var i of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{}))!function(){var e,s,r,n=i[0],o=i[1];!o||null!=(e=g.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.tr(oe[n],()=>{var e;null==(e=g.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!o&&null!=(s=g.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=g.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())}()}}var oi={},os=0,or=()=>{},on='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',oo="Surveys module not available",oa="sanitize_properties is deprecated. Use before_send instead",ol="Invalid value for property_denylist config: ",ou=["token","distinct_id",iJ],oh="posthog",oc=!(u||l)&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),od=e=>{var t,i;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!et(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of sl)if(i===s)return!1;return!0}(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:or,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:a&&et(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){t2.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:i5,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:or},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:sZ,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)})},op=[["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"]],ov=e=>{var t={};for(var i of op){var s=i[0],r=i[1];ee(e[s])||(t[r]=e[s])}var n=ss({},t,e),o=e.__preview_external_dependency_versioned_paths;return ee(o)||(ee(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),et(o)&&ee(e.asset_host)&&(n.asset_host=o)),Y(e.property_blacklist)&&(ee(e.property_denylist)?n.property_denylist=e.property_blacklist:Y(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:t2.error(ol+e.property_denylist)),n};class og{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(e){t2.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class o_{Ji(e,t){if(e){var i=this.Ki.indexOf(e);-1!==i&&this.Ki.splice(i,1)}return this.Ki.push(t),null==t.initialize||t.initialize(),t}Yi(){return this.config.cookieless_mode===i1||this.config.cookieless_mode===i0&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new og,this.Xi=!1,this.version=f.LIB_VERSION,this.tn=new nz,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=od(),this.SentryIntegration=rd,this.sentryIntegration=e=>{var t,i,s;return s=rc(this,e),{name:rh,processEvent:e=>s(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.en=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new nH(this),this.pageViewManager=new rp(this),this.rateLimiter=new rZ(this),this.requestRouter=new n2(this),this.consent=new sO(this),this.externalIntegrations=new ot(this);var e,t=null!==(e=o_.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=et(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=et(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>t2.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==oh){var s,r=null!==(s=oi[i])&&void 0!==s?s:new o_;return r._init(e,t,i),oi[i]=r,oi[oh][i]=r,r}return this._init(e,t,i)}_init(e,t,i){void 0===t&&(t={});var r,n,o=et(e)?e.trim():"";if(!o)return t2.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=od(t.defaults),t.debug=this.an(t.debug),this.ln=t,this.un=[],t.person_profiles?this.nn=t.person_profiles:t.process_person&&(this.nn=t.process_person);var a=od(t.defaults),l=ov(t),u=ss({},a,l,{name:i,token:o});X(a.rageclick)&&X(l.rageclick)&&(u.rageclick=ss({},a.rageclick,l.rageclick)),X(a.session_recording)&&X(l.session_recording)&&(u.session_recording=ss({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&t2.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:r0.GZipJS;var h=this.hn();this.persistence=new rq(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rq(b({},this.config,{persistence:"sessionStorage"}),h,!1);var c=b({},this.persistence.props),d=b({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.dn=new nD(e=>this.cn(e),this.config.request_queue_config),this.vn=new nU(this),this.__request_queue=[];var p=this.Yi();if(p||(this.sessionManager=new nV(this),this.sessionPropsManager=new nq(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(t2.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.fn(p)},0)):(t2.info("Initializing extensions synchronously"),this.fn(p)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&t2.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p:c,s:d}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=b({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
1)),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var v=t.bootstrap.distinctID,g=this.get_distinct_id(),_=this.persistence.get_property(ij);if(t.bootstrap.isIdentifiedID&&null!=g&&g!==v&&_===i2)this.identify(v);else if(t.bootstrap.isIdentifiedID&&null!=g&&g!==v&&_===i3)t2.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 m=this.config.get_device_id(sb()),y=t.bootstrap.isIdentifiedID?m:v;this.persistence.set_property(ij,t.bootstrap.isIdentifiedID?i3:i2),this.register({distinct_id:v,$device_id:y})}}if(p)this.register_once({distinct_id:iK,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(sb());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(ij,i2)}return su(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||sb();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(ij,i3)),t()},r=i.user();"then"in r&&Z(r.then)?r.then(s):s(r)}(e,()=>{var s,r;i.register(("undefined"!=typeof Promise&&Promise.resolve||ru.warn("This browser does not have Promise support, and can not use the segment integration"),r=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ru.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ru.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>r(e,e.event.event),page:e=>r(e,i8),identify:e=>r(e,i9),screen:e=>r(e,"$screen")})).then(()=>{t()})})}(this,()=>this.pn()):this.pn(),Z(this.config._onCapture)&&this.config._onCapture!==or&&(t2.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&t2.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 nW.apply(this,arguments)})().then(e=>{e&&this.register({[t9]:e})}).catch(or),this}fn(e){var t,i,s,r,n,o,a,l,u=performance.now(),h=b({},o_.__defaultExtensionClasses,this.config.__extensionClasses),c=[];h.featureFlags&&this.Ki.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new h.featureFlags(this)),h.exceptions&&this.Ki.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.Ki.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ki.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ki.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.Ki.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Ki.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ki.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.Ki.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this)),h.metrics&&this.Ki.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.Ki.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ki.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ki.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ki.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,ra)),h.toolbar&&this.Ki.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ki.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ki.forEach(e
1=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.gn){var e=this.gn;this.gn=void 0,this.Hr(e)}}),this.mn(c,u)}mn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.mn(e,t)},0);var i=e.shift();if(i)try{i()}catch(s){t2.error("Error initializing extension:",s)}}var r=Math.round(performance.now()-t);this.register_for_session({[iY]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[iZ]:r}),this.config.__preview_deferred_init_extensions&&t2.info("PostHog extensions initialized ("+r+"ms)")}Hr(e){if(!o||!o.body)return t2.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Hr(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.gn=e),this.yn=e,this.compression=void 0,e.ok){var t,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=z(i.supportedCompression,r0.GZipJS)?r0.GZipJS:z(i.supportedCompression,r0.Base64)?r0.Base64:void 0),null!=(t=i.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:i5}),this.Ki.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}pn(){try{this.config.loaded(this)}catch(e){t2.critical("`loaded` function failed",e)}if(this.bn(),this.config.internal_or_test_user_hostname&&null!=a&&a.hostname){var t=a.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Yi())&&this._n()},1),this.wn=new rQ(this),this.wn.load()}bn(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.dn)||e.enable())}_dom_loaded(){this.is_capturing()&&st(this.__request_queue,e=>this.cn(e)),this.__request_queue=[],this.bn()}_handle_unload(){var e,t,i,s,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(i7),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this.dn)||s.unload(),null==(r=this.vn)||r.unload()):this.xn()&&this.capture(i7,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?oc?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=b({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(ee(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r=b({},e);r.timeout=r.timeout||6e4;var n=null!==(t=r.transport)&&void 0!==t?t:"fetch";"sendBeacon"===n&&ee(r.compression)&&r.data&&(r.compression=r0.Base64),"body"===r.timestampMode&&"POST"===r.method&&r.data&&!Y(r.data)&&(r.data=b({},r.data,{sent_at:(new Date).toISOString()})),r.url=nA(r.url,r.method,r.compression,r.timestampMode);var o=nL.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!==(i=null==(s=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===n)return e[i]}(o))?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===r0.GZipJS&&c&&"undefined"!=typeof Promise&&!nS?nR(r).then(e=>{a(e)}).catch(t=>{if(D(t))return nS=!0,void a(b({},r,{compression:void 0,url:nA(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return D(e)||t===C})(t)&&(nS=!0),a(r)}):a(r)})(b({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}
1cn(e){this.vn?this.vn.retriableRequest(e):this._send_request(e)}_execute_array(e){os++;try{var t,i=[],s=[],r=[];st(e,e=>{if(e){if(Y(t=e[0]))r.push(e);else if(Z(e))try{e.call(this)}catch(n){t2.error("Error executing queued PostHog call",e,n)}else Y(e)&&"alias"===t?i.push(e):Y(e)&&-1!==t.indexOf("capture")&&Z(this[t])?r.push(e):s.push(e)}});var n=function(e,t){st(e,function(e){try{if(Y(e[0])){var i=t;si(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(s){t2.error("Error executing queued PostHog call",e,s)}})};n(i,this),n(s,this),n(r,this)}finally{os--}}push(e){if(os>0&&Y(e)&&et(e[0])){var t=o_.prototype[e[0]];Z(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing()){if(!ee(e)&&et(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!et(null==t?void 0:t.$current_url)&&(t2.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.kn||t2.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,c=(null==i?void 0:i.timestamp)||h,d=td(null==i?void 0:i.uuid,sb),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},c,d)};e===i8&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var v="$feature_flag_called"===e&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property(iP);(null==i?void 0:i.$set)&&!v&&(p.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(p.$unset=g);var _,f,m,y,w,E,x,S=v?void 0:this.Sn(null==i?void 0:i.$set_once,e!==se,e===i9);if(S&&(p.$set_once=S),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>et(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){if(t!==Object(t))return o?o(t):t;if(!a.has(t)){var s;if(a.add(t),Y(t))s=[],st(t,t=>{s.push(e(t))});else{var r={};si(t,(t,i)=>{a.has(t)||(r[i]=e(t,i))}),s=r}return s}}(n)),p.timestamp=c,ee(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),v&&(p.properties=(y=p.properties,void 0===(w=ou)&&(w=[]),E={},x=e=>{void 0!==y[e]&&(E[e]=y[e])}
1,$.forEach(x),w.forEach(x),E)),e===rV.DISMISSED||e===rV.SENT){var k=null==t?void 0:t[rG.SURVEY_ID],T=null==t?void 0:t[rG.SURVEY_ITERATION];n6({id:k,current_iteration:T}),p.$set=b({},p.$set,{[(_={id:k,current_iteration:T},m="$survey_"+(f=e===rV.SENT?"responded":"dismissed")+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(m="$survey_"+f+"/"+_.id+"/"+_.current_iteration),m)]:!0})}else e===rV.SHOWN&&(p.$set=b({},p.$set,{[rG.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===rK.SHOWN){var P=null==t?void 0:t[rJ.TOUR_TYPE];P&&(p.$set=b({},p.$set,{[rJ.TOUR_LAST_SEEN_DATE+"/"+P]:(new Date).toISOString()}))}var F=b({},p.properties.$set,p.$set);if(Q(F)||this.setPersonPropertiesForFlags(F),!er(this.config.before_send)){var R=this.Rt(p);if(!R)return;(p=R).uuid=td(p.uuid,sb)}this.tn.emit("eventCaptured",p);var I={method:"POST",url:null!==(s=null==i?void 0:i._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",timestampMode:"query",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.cn(I):this.dn.enqueue(I),p}t2.critical("This capture call is ignored due to client rate limiting.")}}else t2.error("No event name provided to posthog.capture")}}else t2.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var l,u=n?void 0:this.persistence.remove_event_timer(e),h=b({},t);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Yi()&&(h[iJ]=!0),"$snapshot"===e){var c=b({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=c.distinct_id,(!et(h.distinct_id)&&!en(h.distinct_id)||ei(h.distinct_id))&&t2.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var p,v=function(e,t,i,r){if(void 0===r&&(r=!1),!d)return{};var n,o,l,u,h,c=function(e){for(var t=0;tu.length>t;t++){var i=tu[t],s=i[1],r=i[0].exec(e),n=r&&(Z(s)?s(r,e):s);if(n)return n}return["",""]}(d),p=c[0],v=c[1],g=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},_={};ee(i)||(_.detectGoogleSearchApp=i);var m={},y=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,b=null==(o=navigator)?void 0:o.maxTouchPoints,w=null==s||null==(l=s.screen)?void 0:l.width,E=null==s||null==(u=s.screen)?void 0:u.height,x=null==s?void 0:s.devicePixelRatio;ee(y)||(m.userAgentDataPlatform=y),ee(b)||(m.maxTouchPoints=b),ee(w)||(m.screenWidth=w),ee(E)||(m.screenHeight=E),ee(x)||(m.devicePixelRatio=x);var S,k,T,P,F,$,R=ss(sa({$os:p,$os_version:v,$browser:to(d,navigator.vendor,g,_),$device:th(d),$device_type:($=th(d))===ex||$===eE||"Kobo"===$||"Kindle Fire"===$||$===eX?ew:$===ej||$===ez||$===eq||$===eJ?"Console":$===ek?"Wearable":$?ey:"Android"===(null==m?void 0:m.userAgentDataPlatform)&&(null!==(k=null==m?void 0:m.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==m?void 0:m.screenWidth)&&void 0!==T?T:0,null!==(P=null==m?void 0:m.screenHeight)&&void 0!==P?P:0)/(null!==(F=null==m?void 0:m.devicePixelRatio)&&void 0!==F?F:1)?ey:ew:"Desktop",$timezone:rN(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:rw(r?tp(null==a?void 0:a.href):null==a?void 0:a.href,e?[...rT,...t||[]]:[],rF),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:tl(d,navigator.vendor,g,_),$browser_language:rM(),$browser_language_prefix:"string"==typeof(S=rM())?S.split("-")[0]:void 0,$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:f.LIB_NAME,$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return f.SDK_DIST_CHANNEL&&(R.$sdk_dist_channel=f.SDK_DIST_CHANNEL),R}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes
1);if(this.sessionManager){var g=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime()),_=g.windowId;h.$session_id=g.sessionId,h.$window_id=_}this.sessionPropsManager&&ss(h,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&ss(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(l=this.vn)?void 0:l.length}catch(m){h.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===nQ&&(h.$lib_custom_api_host=this.config.api_host),h=ss(h,e!==i8||n?e!==i7||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r)),e===i8&&o&&(h.title=o.title),!ee(u)){var y=i.getTime()-u;h.$duration=parseFloat((y/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var w=this.persistence.properties(),E=this.sessionPersistence.properties();si(["$referrer","$referring_domain"],e=>{e in w&&delete E[e]}),(h=ss({},v,w,E,h)).$is_identified=this._isIdentified(),Y(this.config.property_denylist)?si(this.config.property_denylist,function(e){delete h[e]}):t2.error(ol+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(t2.error(oa),h=x(h,e));var S=this.Cn();return h.$process_person_profile=S,S&&!n&&this.In("_calculate_event_properties"),h}Sn(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return e;var s,r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=ss({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(t2.error(oa),o=a(o,"$set_once")),t&&(this.Xi=!0),Q(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Tn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.tn.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:oo}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:oo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:oo})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=n7),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:oo}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:oo})}Mn(e){return!e||ei(e)?(t2.critical("Unique user id has not been set in posthog.identify"),!1):e===iK?(t2.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())||(t2.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return t2.uninitializedWarning("posthog.identify");if(en(e)&&(e=e.toString(),t2.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(e)&&this.In("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(t7)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(ie)&&(this.unregister(ie),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(ij)||i2)===i2;e!==s&&n?(this.persistence.set_property(ij,i3),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(i9,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.sn=nJ(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(iD))}}setPersonProperties(e,t){if((e||t)&&this.In("posthog.setPersonProperties")){var i=nJ(this.get_distinct_id(),e,t);this.sn!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.sn=i):t2.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(Y(e)?e:[e]).filter(e=>et(e)&&e.length>0);0!==i.length&&this.In("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(se,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else t2.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.In("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(t2.info("reset"),!this.__loaded)return t2.uninitializedWarning("posthog.reset");var t,i,s,r,n,o,a,l,u,h,c,d=this.get_property(t7),p=this.get_property(t9),v=this.get_property(id);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),ee(v)||null==(c=this.persistence)||c.register({[id]:v}),null==(s=this.surveys)||s.reset(),null==(r=this.wn)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(ij,i2),null==(h=this.sessionManager)||h.resetSessionId(),this.sn=null,this.config.cookieless_mode===i1)this.register_once({distinct_id:iK,$device_id:null},"");else{var g=this.config.get_device_id(sb());this.register_once({distinct_id:g,$device_id:e?g:d},""),e||ee(p)||this.register({[t9]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return y(function*(){var e,i,s,r,n;t.__loaded?(null==(e=t.logs)||e.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(s=t.dn)||s.unload(),null==(r=t.vn)||r.unload(),null==(n=t.featureFlags)||n.destroy()):t2.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.En()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Rn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(t8)?(t2.critical("Attempting to create alias for existing People user - aborting."),-2):this.In("posthog.alias")?(ee(t)&&(t=this.get_distinct_id()),e!==t?(this.Tn(ie,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(t2.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(X(e)){ss(this.config,ov(e));var i,s,r,n,o,a,l,u,h,c,d,p=this.hn();null==(i=this.persistence)||i.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rq(b({},this.config,{persistence:"sessionStorage"}),p,!1);var v=this.an(this.config.debug);ea(v)&&(this.config.debug=v),ea(this.config.debug)&&(this.config.debug?(f.DEBUG=!0,sT.N()&&sT.q("ph_debug",!0),t2.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(f.DEBUG=!1,sT.N()&&sT.P("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.exceptions)||r.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.Pn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){f.LIB_NAME=e,f.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(b({},s,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:o_.On}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:oh;return t!==oh&&(t=oh+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ij))===i3||(null==(t=this.sessionPersistence)?void 0:t.get_property(ij))===i3}Cn(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===i5&&!this._isIdentified()&&Q(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[ie])&&(null==(t=this.persistence)||null==(t=t.props)||!t[iW]))}xn(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Cn()||this.In("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.In("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}In(e){return"never"===this.config.person_profiles?(t2.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Tn(iW,!0),!0)}hn(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==i0)}Pn(){var e,t,i,s,r=this.hn();return(null==(e=this.persistence)?void 0:e.yr)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.yr)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==i1){if(this.Yi()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new nV(this),this.pageViewManager=new rp(this),this.persistence&&(this.sessionPropsManager=new nq(this,this.sessionManager,this.persistence));var i,s,r,n,o,a,l,u,h=null!==(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)&&void 0!==o?o:null==(l=o_.__defaultExtensionClasses)?void 0:l.sessionRecording;h&&(this.sessionRecording=this.Ji(this.sessionRecording,new h(this)),this.yn&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.yn)))}this.consent.optInOut(!0),this.Pn(),this.bn(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==i0&&(null==(i=this.surveys)||i.loadIfEnabled()),(ee(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else t2.warn(on)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==i1?(this.config.cookieless_mode===i0&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===i0&&(this.register({distinct_id:iK,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):t2.warn(on)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===i1||(this.config.cookieless_mode===i0?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return n?nG(n,this.config.custom_blocked_useragents):void 0}_n(){o&&("visible"===o.visibilityState?this.en||(this.en=!0,this.capture(i8,{title:o.title},{send_instantly:!0}),this.rn&&(o.removeEventListener(i4,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),su(o,i4,this.rn)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}Ur(){var e,t,i,s,r,n,o=this.ln||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(t2.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=(t="advanced_disable_flags")in o&&!er(o[t]),n=i in o&&!er(o[i]),r?o[t]:!!n&&(t2&&t2.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),o[i]))}Rt(e){if(er(this.config.before_send))return e;var t,i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(eh),s=Y(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(er(r=n(r))){var o="Event '"+e.event+"' was rejected in beforeSend function";return eu(e.event)?t2.warn(o+". This can cause unexpected behavior."):t2.info(o),null}r.properties&&!Q(r.properties)||t2.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&er(r.properties[a]))return t2.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager.ir)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}an(e){var t=ea(e)&&!e,i=sT.N()&&"true"===sT.A("ph_debug");return!t&&(!!i||e)}}o_.__defaultExtensionClasses={},o_.On={trace:o3=()=>{},debug:o3,info:o3,warn:o3,error:o3,fatal:o3},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=so(e.prototype[t[i]])}
1(o_,["identify"]);class of{constructor(e){this.disabled=!1===e;var t=X(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,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var om="$copy_autocapture",oy=t3("[AutoCapture]");function ob(e,t){return t.length>e?t.slice(0,e)+"...":t}function ow(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!sL(t));return t}var oE=t3("[ExceptionAutocapture]"),ox=()=>{},oS=t3("[TracingHeaders]"),ok=t3("[Web Vitals]"),oT="disabled",oP="lazy_loading",oF="awaiting_config",o$="missing_config";t3("[SessionRecording]"),t3("[SessionRecording]");var oR="[SessionRecording]",oI=t3(oR),oO=t3("[Heatmaps]");function oM(e){return X(e)&&"clientX"in e&&"clientY"in e&&en(e.clientX)&&en(e.clientY)}var oC=t3("[Product Tours]"),oA=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(ih))},oL=["$set_once","$set"],oD=t3("[SiteApps]"),oN="Error while initializing PostHog app with config id ";function oU(e,t,i){if(er(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return RegExp(t).test(e)}catch(s){return!1}default:return!1}}class oH{constructor(e){this.Fn=new nz,this.Ln=(e,t)=>this.$n(e,t)&&this.An(e,t)&&this.Nn(e,t)&&this.Dn(e,t),this.$n=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.qn=new Set,this.jn=new Set}init(){var e,t;ee(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!ee(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.jn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.qn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.qn.has(e)||this.qn.has(t.event))&&this.jn&&(null==(i=this.jn)?void 0:i.size)>0&&this.jn.forEach(e=>{this.Hn(t,e)&&this.Fn.emit("actionCaptured",e.name)})}Bn(e){this.onAction("actionCaptured",t=>e(t))}Hn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ln(e,i))return!0;return!1}onAction(e,t){return this.Fn.on(e,t)}An(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!oU(s,t.url,t.url_matching||"contains"))return!1}return!0}Nn(e,t){return!!this.Un(e,t)&&!!this.zn(e,t)&&!!this.Vn(e,t)}Un(e,t){if(null==t||!t.href)return!0;var i=this.Wn(e);if(i.length>0)return i.some(e=>oU(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&oU((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}zn(e,t){if(null==t||!t.text)return!0;var i=this.Wn(e);if(i.length>0)return i.some(e=>oU(e.text,t.text,t.text_matching||"exact")||oU(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,o,a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!er(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>oU(e,n,o)))}Vn(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return RegExp(t.selector_regex).test(n)}catch(o){}return!1}Wn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Dn(e,t){return null==t||!t.properties||0===t.properties.length||nX(t.properties.reduce((e,t)=>
1{var i=Y(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class oj{constructor(e){var t;this.Zn=[],this._instance=e,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,null==(t=this._instance)||null==t.onSessionId||t.onSessionId(e=>this.Kn(e))}Yn(e,t){return!!e&&nX(e.propertyFilters,null==t?void 0:t.properties)}Xn(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}ts(e,t,i){var s=(i===rz.Activation?this.Gn:this.Qn).get(e),r=[];return this.es(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.Yn(n,t)})}register(e){var t;ee(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.rs(e),this.ns(e))}ns(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.ss&&(this.ss=new oH(this._instance),this.ss.init(),this.ss.Bn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.ss)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.Jn.get(t.name);i&&i.push(e.id),this.Jn.set(t.name,i||[e.id])}}))}))}rs(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.Gn=this.Xn(e,rz.Activation),this.Qn=this.Xn(e,rz.Cancellation))}onEvent(e,t){var i,s,r=this.os(),n=(null==t||null==(i=t.properties)?void 0:i.$survey_id)||(null==t||null==(s=t.properties)?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.ls(e,n);if("consume"===o)return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.us([n]);if("persist"===o)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),void this.hs(n)}if(this.Qn.has(e)){var a=this.ts(e,t,rz.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(e=>e.id)}),this.us(a.map(e=>e.id)),a.forEach(e=>this.ds(e.id)))}if(this.Gn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Gn.get(e)});var l=this.ts(e,t,rz.Activation);this.cs(l.map(e=>e.id))}}onAction(e){this.Jn.has(e)&&this.cs(this.Jn.get(e)||[])}cs(e){0!==e.length&&(this.Zn=[...new Set([...this.Zn,...e])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(e){this.Zn=this.Zn.filter(t=>t!==e);var t=this.vs();t.includes(e)||(this.fs([...t,e]),this.ps())}us(e){var t=new Set(e);this.Zn=this.Zn.filter(e=>!t.has(e));var i=this.gs(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.fs(s),0===s.length&&this.ys())}gs(){var e,t=this.bs();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}vs(){var e,t,i=this.gs();if(0===i.length)return[];var s=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._s()],r=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return r&&s===r?i:[]}ps(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this.ws(t)}ys(){this.xs()}Kn(e){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._s()];i&&i!==e&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter(e=>!this.ks(e))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}
1getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class oq extends oj{constructor(e){super(e)}bs(){return iC}_s(){return iA}Cs(){return rV.SHOWN}es(e){var t;null==(t=this._instance)||t.getSurveys(e)}ds(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}os(){return n5}fs(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iC]:e})}ws(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iA]:e})}xs(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(iA)}ks(){return!1}ls(e,t){var i,s,r;return this.es(e=>{r=e.find(e=>e.id===t)}),!r||n3(i=r)&&!(null==(s=i.conditions)||null==(s=s.events)||!s.repeatedActivation)||"always"===i.schedule?e===rV.SHOWN?"consume":"ignore":e===rV.SHOWN?"persist":e===rV.DISMISSED||e===rV.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var oz="SDK is not enabled or survey functionality is not yet loaded",oB="Disabled. Not loading surveys.",oV=null!=s&&s.location?rE(s.location.hash,"__posthog")||rE(location.hash,"state"):null,oG="_postHogToolbarParams",oW=t3("[Toolbar]"),oK=t3("[FeatureFlags]"),oJ=t3("[FeatureFlags]",{debugEnabled:!0}),oY="\" failed. Feature flags didn't load in time.",oZ=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},oX=e=>{var t={};for(var i of sr(e||{})){var s=i[1];s&&(t[i[0]]=s)}return t},oQ=t3("[Error tracking]"),o0="Refusing to render web experiment since the viewer is a likely bot",o1={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>nK(t,e),not_regex:(e,t)=>!nK(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class o2{get Te(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{o2.Is("retrieved web experiments from the server"),t.Ts=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Ts&&(o2.Is("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Ts)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);et(s)&&e.variants[s]&&t.Ms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];o2.Es(n,t._instance)&&t.Ms(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())o2.Is(o0);else if(!this.Te.disable_web_experiments){if(er(this.Ts))return this.Ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();o2.Is("applying feature flags",e),e.forEach(e=>{var t;if(this.Ts&&null!=(t=this.Ts)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Ts)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Ms(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=o2.getWindowLocation();if(null!=e&&e.search){var t=rb(null==e?void 0:e.search,"__experiment_id"),i=rb(null==e?void 0:e.search,"__experiment_variant");t&&i&&(o2.Is("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Rs(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Te.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Rs(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(o2.Is("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ms(s[0].name,t,s[0].variants[t].transforms))}static Es(e,t){return!er(e.conditions)&&o2.Ps(e,t)&&o2.Os(e)}static Ps(e,t){if(er(e.conditions)||er(null==(s=e.conditions)?void 0:s.url))return!0;var i=o2.getWindowLocation();if(i){var s,r,n,o,a=sM(t,i.href);return null==(r=e.conditions)||!r.url||o1[null!==(n=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](e.conditions.url,a)}return!1}
1static getWindowLocation(){return null==s?void 0:s.location}static Os(e){if(er(e.conditions)||er(null==(i=e.conditions)?void 0:i.utm))return!0;var t=rR();if(t.utm_source){var i,s,r,n,o,a,l,u,h,c=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=e.conditions)||null==(h=h.utm)?void 0:h.utm_term)==t.utm_term;return c&&p&&v&&d}return!1}static Is(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];t2.info("[WebExperiments] "+e,i)}Ms(e,t,i){this._is_bot()?o2.Is(o0):"control"!==t?i.forEach(i=>{if(i.selector){o2.Is("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):o2.Is("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?nG(n,this.Te.custom_blocked_useragents):void 0}}var o3,o5,o4=t3("[Conversations]"),o6="Conversations not available yet.",o8="console",o7={featureFlags:class{constructor(e){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var e=this.Us();this.Hs=0,e&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],s&&su(s,"online",this.Bs)}destroy(){null==s||s.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(e){return this._instance.get_property(e)}Vs(){var e,t;return null!==(e=null==(t=this.mi)?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))&&void 0!==e&&e}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,oK.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var e,t=null!==(e=this.Te.evaluation_contexts)&&void 0!==e?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(oK.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||oK.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Gs(){return this.Zs().length>0}Qs(){var e=this.Te.flag_keys;if(!ee(e)){if(Y(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||oK.error("Invalid flag key found:",e,"Expected non-empty string"),t});oK.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,i=this._instance.config,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var s,r,n=null!=i&&i.merge&&null!==(s=this.zs(iw))&&void 0!==s?s:{},o=null!=i&&i.merge&&null!==(r=this.zs(ik))&&void 0!==r?r:{},a=b({},n,e),l=b({},o,t),u={};for(var h of Object.entries(a)){var c=h[0],d=h[1];u[c]={key:c,enabled:x(d),variant:S(d),reason:void 0,metadata:ee(null==l?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.zs(iS),t=this.zs(iF),i=this.zs(i$);if(!i&&!t)return e||{};var s=ss({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of r){var o,a,l=s[n],u=null==t?void 0:t[n],h=ee(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,c=ee(u)?l.variant:"string"==typeof u?u:void 0,d=null==i?void 0:i[n],p=b({},l,{enabled:h,variant:h?null!=c?c:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),c!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=b({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=p}return this.Fs||(oK.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Fs=!0),s}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{var s=e[i];return{key:i,enabled:x(s),variant:S(s),payload:E(t[i])}})}getFlagVariants(){var e=this.zs(iw),t=this.zs(iF);if(!t)return e||{};for(var i=ss({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Fs||(oK.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Fs=!0),i}getFlagPayloads(){var e=this.zs(ik),t=this.zs(i$);if(!t)return e||{};for(var i=ss({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Fs||(oK.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Fs=!0),i}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.tn.emit("featureFlagsReloading",!0),this.Js=setTimeout(()=>{this.Ks()},5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.As=e}Ks(e){var t;
1if(this.Ys(),!this._instance.Ur()&&!this.Us()){if(this.$s)this.Ns=!0;else{var i=this.Te.token,s=this.zs(t7),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},(null==(t=this.mi)?void 0:t.get_initial_props())||{},this.zs(iR)||{}),group_properties:this.zs(iI),timezone:rN()};es(s)||ee(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Gs()&&(r.evaluation_contexts=this.Zs());var n=this.Qs();ee(n)||(r.flag_keys=n);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:a,data:r,compression:this.Te.disable_compression?void 0:r0.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(this.Xs(e.statusCode),200===e.statusCode&&(this.Ns||(this.$anon_distinct_id=void 0),n=!1),this.$s=!1,!r.disable_flags||this.Ns){this.Ds=!n;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));(u&&a.push("quota_limited"),null==(s=this.mi)||s.register({[iU]:a}),u)?oK.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."):(r.disable_flags||this.receivedFeatureFlags(null!==(l=e.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}}Us(){return rx(this.Hs,3)}Xs(e){this.Hs=rS(e,this.Hs,3,()=>oK.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 i;if(void 0===t&&(t={}),!t.fresh||this.Ds){if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else oK.warn('getFeatureFlag for key "'+e+oY)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.Ds){if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFlagVariants(),s=i[e],r=this.getFlagPayloads()[e],n=String(s),o=this.zs(iT)||void 0,a=this.zs(iH)||void 0,l=this.zs(iD)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),c=this.zs(iN);h&&h!==c&&(l={},null==(u=this.mi)||u.register({[iD]:l,[iN]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in l)||!l[e].includes(n))){Y(l[e])?l[e].push(n):l[e]=[n],null==(g=this.mi)||g.register({[iD]:l});var d=this.getFeatureFlagDetails(e),p=[...null!==(_=this.zs(iU))&&void 0!==_?_:[]];ee(s)&&p.push("flag_missing");var v={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:r||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:(null==(f=this.Te.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])||null,$feature_flag_bootstrapped_payload:(null==(m=this.Te.bootstrap)||null==(m
1=m.featureFlagPayloads)?void 0:m[e])||null,$used_bootstrap_value:!this.Ds};ee(null==d||null==(y=d.metadata)?void 0:y.has_experiment)||(v.$feature_flag_has_experiment=d.metadata.has_experiment),ee(null==d||null==(b=d.metadata)?void 0:b.version)||(v.$feature_flag_version=d.metadata.version);var g,_,f,m,y,b,w,x,S,k,T,P,F=null!==(w=null==d||null==(x=d.reason)?void 0:x.description)&&void 0!==w?w:null==d||null==(S=d.reason)?void 0:S.code;F&&(v.$feature_flag_reason=F),null!=d&&null!=(k=d.metadata)&&k.id&&(v.$feature_flag_id=d.metadata.id),ee(null==d?void 0:d.original_variant)&&ee(null==d?void 0:d.original_enabled)||(v.$feature_flag_original_response=ee(d.original_variant)?d.original_enabled:d.original_variant),null!=d&&null!=(T=d.metadata)&&T.original_payload&&(v.$feature_flag_original_payload=null==d||null==(P=d.metadata)?void 0:P.original_payload),p.length&&(v.$feature_flag_error=p.join(",")),this._instance.capture("$feature_flag_called",v)}if(e in i)return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:E(r)}}}else oK.warn('getFeatureFlagResult for key "'+e+oY)}}getRemoteConfigPayload(e,t){var i=this.Te.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.Gs()&&(s.evaluation_contexts=this.Zs());var r=this.Qs();ee(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Te.disable_compression?void 0:r0.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this.Ds)return t.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return oK.warn('isFeatureEnabled for key "'+e+oY),t.defaultValue;var i=this.getFeatureFlag(e,t);return ee(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.mi){this.Ls=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,s,r,n){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var o,a,l=((a=(o=e).flags)?(o.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!==(t=a[e].variant)&&void 0!==t?t:a[e].enabled]})),o.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):o.featureFlags&&oK.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),o),u=l.flags,h=l.featureFlags,c=l.featureFlagPayloads;if(h){var d=e.requestId,p=e.evaluatedAt;if(Y(h)){oK.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var g=0;h.length>g;g++)v[h[g]]=!0;t&&t.register({[iE]:h,[iw]:v,[iP]:!1})}else{var _=h,f=c,m=u;if(null!=n&&n.partialResponse)_=b({},i,_),f=b({},s,f),m=b({},r,m);else if(e.errorsWhileComputingFlags){if(u){var y=new Set(Object.keys(u).filter(e=>{var t;return!(null!=(t=u[e])&&t.failed)}));_=b({},i,Object.fromEntries(Object.entries(_).filter(e=>y.has(e[0])))),f=b({},s,Object.fromEntries(Object.entries(f||{}).filter(e=>y.has(e[0])))),m=b({},r,Object.fromEntries(Object.entries(m||{}).filter(e=>y.has(e[0]))))}else _=b({},i,_),f=b({},s,f),m=b({},r,m)}t&&t.register(b({[iE]:Object.keys(oX(_)),[iw]:_||{},[ik]:f||{},[iS]:m||{},[iP]:!0===e.minimalFlagCalledEvents},d?{[iT]:d}:{},p?{[iH]:p}:{}))}}}(e,this.mi,s,r,n,i),t||(this.js=!1),this.eo(t)}}override(e,t){void 0===t&&(t=!1),oK.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return oK.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.mi.unregister(iF),this.mi.unregister(i$),this.eo(),oJ.info("All overrides cleared");if(Y(e)){var t,i=oZ(e);return this.mi.register({[iF]:i}),this.eo(),oJ.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Fs=Boolean(null!==(t=e.suppressWarning)&&void 0!==t&&t),"flags"in e){if(!1===e.flags)this.mi.unregister(iF),oJ.info("Flag overrides cleared");else if(e.flags){if(Y(e.flags)){var s=oZ(e.flags);this.mi.register({[iF]:s})}else this.mi.register({[iF]:e.flags});oJ.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.mi.unregister(i$),oJ.info("Payload overrides cleared")):e.payloads&&(this.mi.register({[i$]:e.payloads}),oJ.info("Payload overrides set",{payloads:e.payloads}))),void this.eo()}if(e&&"object"==typeof e)return this.mi.register({[iF]:e}),this.eo(),oJ.info("Flag overrides set",{flags:e});oK.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Ls){var t=this.ro(),i=t.flags,s=t.flagVariants;try{e(i,s)}catch(r){oK.error("Error while running feature flags callback",r)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.zs(ix)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=b({},this.getFlagVariants(),{[e]:t});null==(s=this.mi)||s.register({[iE]:Object.keys(oX(a)),[iw]:a}),this.eo()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.zs(ix),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+r),method:"GET",timestampMode:"query",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.mi)||i.unregister(ix),null==(s=this.mi)||s.register({[ix]:r}),e(r)}}})}ro(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}eo(e){var t=this.ro(),i=t.flags,s=t.flagVariants;
1this.featureFlagEventHandlers.forEach(t=>{try{t(i,s,{errorsLoading:e})}catch(r){oK.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.zs(iR)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this._instance.register({[iR]:b({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=b({},this.zs(iR)||{});e.forEach(e=>{delete i[e]}),this._instance.register({[iR]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(iR),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.zs(iI)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=b({},i[t],e[t]),delete e[t]}),this._instance.register({[iI]:b({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.zs(iI)||{};this._instance.register({[iI]:b({},t,{[e]:{}})})}else this._instance.unregister(iI)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},o9=b({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.fa=null,this.pa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t,i,s=e.config;if("productTours"in s){if(this.mi&&this.mi.register({[ih]:!!s.productTours}),!oA(this._instance))return!this.fa&&er(null==(t=this.mi)?void 0:t.props[iL])||oC.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.fa)||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&oA(this._instance)&&this.tr(()=>this.ga())}tr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?oC.error("Could not load product tours script",t):e()})}ga(){var e;!this.fa&&null!=(e=g.__PosthogExtensions__)&&e.generateProductTours&&(this.fa=g.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Y(this.pa)||t){var i=this.mi;if(i){var s=i.props[iL];if(Y(s)&&!t)return this.pa=s,void e(s,{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(oA(this._instance)){var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return oC.error(r),void e([],{isLoaded:!1,error:r})}var n=Y(t.json.product_tours)?t.json.product_tours:[];this.pa=n,i&&i.register({[iL]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.pa,{isLoaded:!0})}getActiveProductTours(e){er(this.fa)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.fa)||t.showTourById(e)}previewTour(e){this.fa?this.fa.previewTour(e):this.tr(()=>{var t;this.ga(),null==(t=this.fa)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.fa)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.fa)||e.nextStep()}previousStep(){var e;null==(e=this.fa)||e.previousStep()}clearCache(){var e;this.pa=null,null==(e=this.mi)||e.unregister(iL)}resetTour(e){var t;null==(t=this.fa)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.fa)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.fa)||t.cancelPendingTour(e)}}},o7),ae=b({surveys:class{get Te(){return this._instance.config}constructor(e){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return n5.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(er(t))return n5.warn("Flags not loaded yet. Not loading surveys.");var i=Y(t);this.Fa=i?t.length>0:t,n5.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var s=localStorage.key(i);(null!=s&&s.startsWith(n4)||null!=s&&s.startsWith("inProgressSurvey_"))&&t.push(s)}
1t.forEach(e=>localStorage.removeItem(e))}catch(r){}}loadIfEnabled(){if(!this._surveyManager){if(this.La)n5.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)n5.info(oB);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())n5.info("Not loading surveys in cookieless mode without consent.");else{var e=null==g?void 0:g.__PosthogExtensions__;if(e){if(!ee(this.Fa)||this.Te.advanced_enable_surveys){var t=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var i=e.generateSurveys;if(i)return void this.Da(i,t);var s=e.loadExternalDependency;if(!s)return void this.qa(iQ);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.qa("Could not load surveys script",i):this.Da(e.generateSurveys,t)})}catch(r){throw this.qa("Error initializing surveys",r),r}finally{this.La=!1}}}else n5.error("PostHog Extensions not found.")}}}Da(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new oq(this._instance),n5.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(e,t){n5.error(e,t),this.ja({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$a.push(e),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Te.disable_surveys)return n5.info(oB),e([]);var i,s=this._instance.get_property(iO);if(s&&!t)return e(s,{isLoaded:!0}),void(this.Ha()&&this.getSurveys(()=>{},!0));"undefined"!=typeof Promise&&this.Aa?this.Aa.then(t=>e(t.surveys,t.context)):("undefined"!=typeof Promise&&(this.Aa=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:t=>{this.Aa=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;n5.error(r),this.Na=Date.now();var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}this.Na=null;var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,i,s;return!(!e.start_date||e.end_date)&&(n3(e)||!(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||!s.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[iO]:l,[iM]:Date.now()});var h={isLoaded:!0};e(l,h),null==i||i({surveys:l,context:h})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var e=this._instance.get_property(iM);return en(e)&&Date.now()-e>3e5}Ua(){return en(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(e,t){var i;n6({id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(s){}}ja(e){for(var t of this.$a)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){n5.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!er(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);n5.warn("init was not called")}za(e){var t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}Va(e){if(er(this._surveyManager))return{eligible:!1,reason:oz};var t="string"==typeof e?this.za(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(er(this._surveyManager))return n5.warn("init was not called"),{visible:!1,disabledReason:oz};var t=this.Va(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return er(this._surveyManager)?(n5.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:oz})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(r){var n=this.Va(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(er(this._surveyManager))n5.warn("init was not called");else{var r="string"==typeof e?this.za(e):e;if(null!=r&&r.id){if(n8.includes(r.type)){var n=null==o?void 0:o.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(n5.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;n5.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),n5.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);n5.warn("Survey element not found")}else n5.warn("Surveys of type "+r.type+" cannot be rendered in the app")}else n5.warn("Survey not found")}}displaySurvey(e,t){var i;if(er(this._surveyManager))n5.warn("init was not called");else{var s=this.za(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=b({},s,{appearance:b({},s.appearance,{surveyPopupDelaySeconds:0})}
1)),t.displayType!==rW.Popover&&t.initialResponses&&n5.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void n5.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==rW.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else n5.warn("Survey not found")}}cancelPendingSurvey(e){er(this._surveyManager)?n5.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}},o7),at=b({experiments:o2},o7),ai=b({},o7,{sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!(null==(e=this.io)||!e.isStarted)}get status(){var e,t;return this.no===oF||this.no===o$?this.no:null!==(e=null==(t=this.io)?void 0:t.status)&&void 0!==e?e:this.no}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=oT,this.so=void 0,this._instance=e,!this._instance.sessionManager)throw oI.error("started without valid sessionManager"),Error(oR+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===i1)throw Error(oR+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var e,t=!(null==(e=this._instance.get_property(id))||!e.enabled),i=!this.Te.disable_session_recording,r=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.oo||null==(t=this.io)||!t.isStarted){var i=!ee(Object.assign)&&!ee(Array.from);this.oo&&i?(this.ao(e),oI.info("starting")):(this.no=oT,this.stopRecording())}}ao(e){var t,i,s;this.oo&&(this.no!==oF&&this.no!==o$&&(this.no=oP),null!=g&&null!=(t=g.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=g.__PosthogExtensions__)&&i.initSessionRecording?this.lo(e):null==(s=g.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.uo,t=>{if(t)return oI.error("could not load recorder",t);this.lo(e)}))}stopRecording(){var e,t;null==(e=this.so)||e.call(this),this.so=void 0,null==(t=this.io)||t.stop()}ho(){var e,t;null==(e=this.so)||e.call(this),this.so=void 0,null==(t=this.io)||t.discard()}do(){var e,t;null==(e=this.mi)||e.unregister(ib),null==(t=this.mi)||t.unregister(ip)}co(e,t){if(er(e))return null;var i=en(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(oI.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}vo(e){if(this.mi){var t,i,s=this.mi,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.co(null==(t=this.Te.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.co(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;er(o)&&this.do();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[id]:b({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:b({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:ee(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.so)||t.call(this),this.so=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.vo(t),void this.ho()):(this.vo(t),void this.startIfEnabledOrStop()):(this.no===oF&&(this.no=o$,oI.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.io)&&i.log?this.io.log(e,t):oI.warn("log called before recorder was ready")}get uo(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(id);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}fo(){var e,t,i=this._instance.get_property(id);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(s){return oI.warn("persisted remote config for session recording is invali
1d and will be ignored",s),!1}var r=null!==(e=t.cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-r}lo(e){var t,i;if(null==(t=g.__PosthogExtensions__)||!t.initSessionRecording)return oI.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[iX]:!0});if(this.io||(this.io=null==(i=g.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo()){if(this.no===o$||this.no===oF)return;return this.no=oF,oI.info("persisted remote config is stale, requesting fresh config before starting"),void new rQ(this._instance).load()}this.no=oP,this.io.start(e)}onRRwebEmit(e){var t;null==(t=this.io)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.io||null==(t=this.mi)||t.register({[ig]:!0}),null==(e=this.io)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.io||null==(t=this.mi)||t.register({[iv]:!0}),null==(e=this.io)||e.overrideSampling()}overrideTrigger(e){var t,i;this.io||null==(i=this.mi)||i.register({["url"===e?i_:im]:!0}),null==(t=this.io)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.io)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.io)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=e,this.rageclicks=new of(e.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var e,t,i=X(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>RegExp(e)),i}wo(){if(this.isBrowserSupported()){if(s&&o){var e=e=>{e=e||(null==s?void 0:s.event);try{this.xo(e)}catch(t){oy.error("Failed to capture event",t)}};if(su(o,"submit",e,{capture:!0}),su(o,"change",e,{capture:!0}),su(o,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=e=>{e=e||(null==s?void 0:s.event);try{this.xo(e,om)}catch(t){oy.error("Failed to capture copy/cut event",t)}};su(o,"copy",t,{capture:!0}),su(o,"cut",t,{capture:!0})}}}else oy.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(e){if(this.yo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.bo=t.elementsChainAsString);var i=t.autocapture_opt_out;ea(i)&&(this.instance.persistence&&this.instance.persistence.register({[ii]:i}),this.mo=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._o=e}getElementSelectors(e){var t,i=[];return null==(t=this._o)||t.forEach(t=>{var s=null==o?void 0:o.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[ii],s=this.mo,r=this.instance.Ur()&&!this.yo;if(es(s)&&!ea(i)&&!r)return!1;var n=null!==(t=this.mo)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!n}xo(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=sV(e);sN(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&s1(r,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var n=t===om;if(r&&function(e,t,i,r,n,o){if(!s||s2(e)||null!=i&&i.url_allowlist&&!sj(i.url_allowlist,o)||null!=i&&i.url_ignorelist&&sj(i.url_ignorelist,o))return!1;if(null!=i&&i.dom_event_allowlist){var a,l=i.dom_event_allowlist;if(l&&!l.some(e=>t.type===e))return!1}var u=s3(e,r),h=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(ee(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(c,i)||!sW(c,null==i?void 0:i.css_selector_allowlist)||sW(c,null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:sJ))return!1;try{var d=s.getComputedStyle(e);
1if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(p){}var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(sG.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.Te,n,n?["copy","cut"]:void 0,this.instance)){var o=function(e,t){var i,r,n,o,a=t.e,l=t.maskAllElementAttributes,u=t.maskAllText,h=t.elementAttributeIgnoreList,c=t.elementsChainAsString,d=t.disableCaptureUrlHashes;if(!sL(e))return{props:{}};for(var p=[e],v=new Set([e]),g=e;g.parentNode&&!sD(g,"body")&&1e3>p.length;)if(sU(g.parentNode)){var _=g.parentNode.host;if(v.has(_))break;v.add(_),p.push(_),g=_}else{if(!sL(g.parentNode)||v.has(g.parentNode))break;v.add(g.parentNode),p.push(g.parentNode),g=g.parentNode}var f,m=[],y={},w=!1,E=!1;if(si(p,e=>{var t=s5(e);if(sD(e,"a")){var i=e.getAttribute("href");w=!!(t&&i&&ri(i))&&(d?tp(i):i)}z(sq(e),"ph-no-capture")&&(E=!0),m.push(function(e,t,i,s,r){void 0===r&&(r=!1);var n=e.tagName.toLowerCase(),o={tag_name:n};sG.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ob(1024,rs(e)):ob(1024,sB(e)));var a=sq(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),si(e.attributes,function(i){var n;if((!s4(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&ri(i.value)&&(!et(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=sH(a).join(" ")),o["attr__"+i.name]=ob(1024,"href"===i.name&&r?tp(a):a)}});for(var l=1,u=1,h=e;h=ow(h);)l++,h.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,l,u,h,d));var s=function(e){if(!s5(e))return{};var t={};return si(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&ri(s)&&(t[i]=s)}}),t}(e);ss(y,s)}),E)return{props:{},explicitNoCapture:E};if(u||(m[0].$el_text=sD(e,"a")||sD(e,"button")?rs(e):sB(e)),w){m[0].attr__href=w;var x,S,k=null==(x=ry(w))?void 0:x.host,T=null==s||null==(S=s.location)?void 0:S.host;k&&T&&k!==T&&(f=w)}return{props:ss({$event_type:a.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:m.map(e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:function(e){var t=e.attr__class;if(t)return Y(t)?t:sH(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sr(e).filter(e=>0===e[0].indexOf("attr__")).forEach(e=>s.attributes[e[0]]=e[1]),s}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=b({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return sr(n).sort((e,t)=>e[0].localeCompare(t[0])).forEach(e=>{var t=e[1];return o[rr(e[0].toString())]=rr(t.toString())}),(s+=":")+sr(o).map(e=>e[0]+'="'+e[1]+'"').join("")}).join(";")},null!=(n=m[0])&&n.$el_text?{$el_text:null==(o=m[0])?void 0:o.$el_text}:{},f&&"click"===a.type?{$external_click_url:f}:{},y)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=o.props;if(o.explicitNoCapture)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),t===om){var u,h=sz(null==s||null==(u=s.getSelection())?void 0:u.toString()),c=e.type||"clipboard";if(!h)return!1;a.$selected_content=h,a.$copy_type=c}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Z(null==o?void 0:o.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ko=(null==s||null==(t=s.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(t2.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,t2.info("History API monitoring stopped")}monitorHistoryChanges(){s&&s.history&&(this.Co("pushState"),this.Co("replaceState"),this.Io())}Co(e){var t;if(s&&(null==(t=s.history[e])||!t.__posthog_wrapped__)){var i=this;!function(e,t,i){try{if(!(t in e))return ox;var s={next:e[t]},r=i(function(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return s.next.apply(this,t)});return Z(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]!==r)for(var i=e[t];Z(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===r)return void(n.next=s.next);i=n.next}else e[t]=s.next}}catch(n){return ox}}(s.history,e,t=>
1function(s,r,n){t.call(this,s,r,n),i.To(e)})}}To(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this.ko&&this.isEnabled&&this._instance.capture(i8,{navigation_type:e}),this.ko=i}catch(r){t2.error("Error capturing "+e+" pageview",r)}}Io(){if(!this.So){var e=()=>{this.To("popstate")};su(s,"popstate",e),this.So=()=>{s&&s.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=e,this.Mo=!(null==(t=this.instance.persistence)||!t.props[is]),this.rageclicks=new of(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return X(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return er(this.Te.capture_heatmaps)?er(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:!1!==this.Te.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.po||(oO.info("starting..."),this.Ro(),this.ke());else{var e;clearInterval(null!==(e=this.Eo)&&void 0!==e?e:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[is]:i}),this.Mo=i,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Oo(e){oM(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo="visible"===(null==o?void 0:o.visibilityState)?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){s&&o&&(this.Fo=this.oi.bind(this),su(s,i6,this.Fo),this.Lo=e=>this.pe(e||(null==s?void 0:s.event)),su(o,"click",this.Lo,{capture:!0}),this.$o=e=>this.Ao(e||(null==s?void 0:s.event)),su(o,"mousemove",this.$o,{capture:!0}),this.No=new rl(this.instance,ro,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),su(o,i4,this.Do),this.po=!0)}Po(){var e;s&&o&&(this.Fo&&s.removeEventListener(i6,this.Fo),this.Lo&&o.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&o.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&o.removeEventListener(i4,this.Do),clearTimeout(this.qo),null==(e=this.No)||e.stop(),this.po=!1)}jo(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var r=e;r&&sL(r)&&!sD(r,"body")&&r!==i;){var n,o,a,l=void 0;try{l=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:s)?void 0:n.getComputedStyle(r).position}catch(u){break}if(z(t,l))return!0;r=sK(r)}return!1}(sV(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:i),target_fixed:o,type:t}}pe(e,t){var i;if(void 0===t&&(t="click"),!sA(e.target)&&oM(e)){var s=this.jo(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&s1(sV(e),this.instance.config.rageclick)&&this.Wt(b({},s,{type:"rageclick"})),this.Wt(s)}}Ao(e){!sA(e.target)&&oM(e)&&(clearTimeout(this.qo),this.qo=setTimeout(()=>{this.Wt(this.jo(e,"mousemove"))},500))}Wt(e){if(s){var t=this.Te.disable_capture_url_hashes?tp(s.location.href):s.location.href,i=this.Te.custom_personal_data_properties,r=this.Te.mask_personal_data_properties?[...rT,...i||[]]:[],n=rw(t,r,rF);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(e)}}oi(){this.R&&!Q(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rl,webVitalsAutocapture:class{constructor(e){var t;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((e,t)=>b({},e,{["$web_vitals_"+t.name+"_event"]:b({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=e=>{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t,i=this.zo();if(!ee(i)){if(er(null==e?void 0:e.name)||er(null==e?void 0:e.value))ok.error("Invalid metric received",e);else if(!this.Vo||this.Vo>e.value){this.R.url!==i&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),ee(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=ee(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),r=b({},e,{$current_url:i,timestamp:Date.now()});ee(s)||(r.$session_id=s.sessionId,r.$window_id=s.windowId),this.R.metrics.push(r),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else ok.error("Ignoring metric with value >= "+this.Vo,e)}},this.Wo=()=>
1{if(!this.po){var e,t,i,s,r=g.__PosthogExtensions__;if(!ee(r)&&!ee(r.postHogWebVitalsCallbacks)){var n=r.postHogWebVitalsCallbacks;e=n.onLCP,t=n.onCLS,i=n.onFCP,s=n.onINP}e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uo.bind(this)),this.po=!0):ok.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Mo=!(null==(t=this._instance.persistence)||!t.props[il]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=X(this.Zo)?null==(e=this.Zo)?void 0:e.web_vitals_allowed_metrics:void 0;return er(i)?(null==(t=this._instance.persistence)?void 0:t.props[ic])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(X(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=X(this.Zo)?this.Zo.web_vitals_attribution:void 0;return null!=e&&e}get Vo(){var e=X(this.Zo)&&en(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==a?void 0:a.protocol;if("http:"!==e&&"https:"!==e)return ok.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=X(this.Zo)?this.Zo.web_vitals:ea(this.Zo)?this.Zo:void 0;return ea(t)?t:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(ok.info("enabled, starting..."),this.tr(this.Wo))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var i=X(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=X(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[il]:i}),this._instance.persistence.register({[ic]:s})),this.Mo=i,this.startIfEnabled()}}}tr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?ok.error("failed to load script",t):e()})}zo(){var e=s?this._instance.config.disable_capture_url_hashes?tp(s.location.href):s.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...rT,...t||[]]:[];return rw(e,i,rF)}ok.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,i,r,n,o,a;this.Wo=()=>{var e;if(s&&this.isEnabled&&null!=(e=g.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=t(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=i(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=r(this.captureException.bind(this)))}catch(n){oE.error("failed to start",n),this.Ko()}}},this._instance=e,this.Yo=!(null==(t=this._instance.persistence)||!t.props[ir]),this.Xo=new em(b({},(void 0===(i=this._instance.config.error_tracking)&&(i={}),{refillRate:null!==(r=null!==(n=i.exceptionRateLimiterRefillRate)&&void 0!==n?n:i.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(o=null!==(a=i.exceptionRateLimiterBucketSize)&&void 0!==a?a:i.__exceptionRateLimiterBucketSize)&&void 0!==o?o:10}),{refillInterval:1e4,it:oE})),this.Te=this.ta(),this.startIfEnabledOrStop()}ta(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return X(e)?t=b({},t,e):(ee(e)?this.Yo:e)&&(t=b({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(oE.info("enabled"),this.Ko(),this.tr(this.Wo)):this.Ko()}tr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return oE.error("failed to load script",t);e()})}Ko(){var e,t,i;null==(e=this.Go)||e.call(this),this.Go=void 0,null==(t=this.Qo)||t.call(this),this.Qo=void 0,null==(i=this.Jo)||i.call(this),this.Jo=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Yo=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[ir]:this.Yo}),this.Te=this.ta(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ta()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.Xo.consumeRateLimit(r)?oE.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.ea=[],this.ra=new tP([new tN,new tK,new tH,new tU,new tG,new tV,new tq,new tW],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=tD.test(a)?a.replace(tD,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,e);if(h){r.push(h);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>b({},e,{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"}))}(r)}}("web:javascript",tM,tL)),this._instance=e,this.ea=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(io))&&void 0!==t?t:[],this.ia=tQ(this.na()),this.sa=new t0(this.ia)}onConfigChange(){this.ia=tQ(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(e){var t,i,s;if(e.ok){var r=e.config;if("errorTracking"in r){var n=null!==(t=null==(i=r.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null==(s=r.errorTracking)?void 0:s.captureExtensionExceptions;this.ea=n,this._instance.persistence&&this._instance.persistence.register({[io]:this.ea,[ia]:o})}}}get oa(){var e,t=!!this._instance.get_property(ia),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.ra.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.ia.enabled)try{if(!et(e)||0===e.trim().length)return void oQ.warn("Ignoring exception step because message must be a non-empty string");var i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>tZ.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}}(this.aa(t)),s=i.sanitizedProperties,r=i.droppedKeys;r.length>0&&oQ.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.sa.add(b({[tJ]:e,[tY]:(new Date).toISOString()}
1,s))}catch(n){oQ.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.la(t)){if(this.ua(t))return this.ha("Exception dropped: matched a suppression rule"),void oQ.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(t))return this.ha("Exception dropped: thrown by a browser extension"),void oQ.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(t))return this.ha("Exception dropped: thrown by the PostHog SDK"),void oQ.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ia.enabled&&er(e.$exception_steps)?this.va(e):e;try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return s&&this.sa.clear(),s}catch(r){return oQ.error("Failed to capture exception event. Dropping this exception.",r),void this.sa.clear()}}catch(n){return void oQ.error("Failed to process exception event. Ignoring this exception.",n)}}va(e){try{var t=this.sa.getAttachable();return 0===t.length?e:b({},e,{$exception_steps:t})}catch(i){return oQ.error("Failed to read buffered exception steps. Capturing exception without steps.",i),e}}ha(e){this.ia.enabled&&this.sa.add({[tJ]:e,[tY]:(new Date).toISOString()})}aa(e){return X(e)?b({},e):{}}na(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}ua(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var i=t.type,s=t.value;return et(i)&&i.length>0&&e.$exception_types.push(i),et(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.ea.some(e=>{var i=e.values.map(e=>{var i,s=nY[e.operator],r=Y(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}da(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ca(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}la(e){return!er(e)&&Y(e)}}},o9,{siteApps:class{constructor(e){this.ma=0,this._instance=e,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(e,t){if(t){var i=this.globalsForEvent(t);this.ya.push(i),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{e(),this.ya=[],this._a=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,o,a,l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(h)){var d=c[0];l[d]={id:u[d],type:d,properties:c[1]}}var p=e.$set_once,v=e.$set;return{event:b({},w(e,oL),{properties:b({},e.properties,v?{$set:b({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:b({},null!==(s=null==(r=e.properties)?void 0:r.$set_once)&&void 0!==s?s:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}wa(e){var t,i=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(oD.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(oD.error("prepare_external_dependency_script returned null"),null):e}xa(){if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var e,t,i,s,r,n,a,l,u=null==o?void 0:o.defaultView,h=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!h)return()=>{};if(this.ma++,this.ka)return this.Sa();var c=[],d=this,p=new WeakSet,v=(e,t,i)=>{if(null!=e&&e[t]){var s=e[t];e[t]=i(s),c.push(()=>{e[t]=s})}},g=e=>{if(p.has(e))return e;var t=d.wa(e);return t&&p.add(t),t},_=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!es(e));return v(h,"appendChild",e=>function(t){var i=g(t);return i?e.call(this,i):t}),v(h,"insertBefore",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):t}),v(h,"replaceChild",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):i}),[null==(t=u.Element)?void 0:t.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach(e
vendor: 8,310 bytes, line 1
1=>{v(e,"append",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,_(i))}),v(e,"prepend",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,_(i))})}),[null==(r=u.Element)?void 0:r.prototype,null==(n=u.CharacterData)?void 0:n.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach(e=>{v(e,"before",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,_(i))}),v(e,"after",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,_(i))}),v(e,"replaceWith",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];var r=_(i);return i.length&&!r.length?void 0:e.apply(this,r)})}),v(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){var s=g(i);return s?e.call(this,t,s):null}),this.ka=()=>{c.forEach(e=>e()),this.ka=void 0},this.Sa()}Sa(){var e=!1;return()=>{var t;e||(e=!0,this.ma--,0===this.ma&&(null==(t=this.ka)||t.call(this)))}}Ca(e,t){void 0===t&&(t=!0);var i=this.xa();try{var s=e(i);return t&&i(),s}catch(r){throw i(),r}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.ya.length&&(oD.info("Processing "+this.ya.length+" events for site app with id "+e.id),this.ya.forEach(e=>this.Ca(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this._a)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,oD.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var n=this.Ca(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1).processEvent;n&&(t.processEvent=n),s=!0}catch(o){oD.error(oN+e.id,o),r(!1)}if(s&&t.loaded)try{i()}catch(a){oD.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Ia(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Ta(e){var t=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(e),s=function(s){try{t.Ca(()=>null==s.processEvent?void 0:s.processEvent(i))}catch(r){oD.error("Error while processing event "+e.event+" for site app "+s.id,r)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Ia(),void this._instance.on("eventCaptured",e=>this.Ta(e))):void oD.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._a)||i.call(this),e.ok){var n=e.config;if(null!=(s=n.siteApps)&&s.length){if(this.isEnabled)for(var o of n.siteApps)!function(){var e,t=o.id,i=o.url;g["__$$ph_site_app_"+t]=r._instance,null==(e=g.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(r._instance,i,e=>{if(e)return oD.error(oN+t,e)})}();else oD.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}}},ae,{tracingHeaders:class{constructor(e){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var e,t,i=this.Pa();i?(ee(this.Ma)&&(this.Ma=null==(e=g.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),ee(this.Ea)&&(this.Ea=null==(t=g.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Ko()},this._instance=e}initialize(){this.startIfEnabledOrStop()}tr(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return oS.error("failed to load script",t);e()})}Oa(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}Pa(){var e=this.Oa();return Y(e)?(Y(this.Ra)?this.Ra.splice(0,this.Ra.length,...e):this.Ra=[...e],e.length>0?this.Ra:void 0):(Y(this.Ra)&&this.Ra.splice(0),this.Ra=e||void 0,this.Ra)}Ko(){var e,t;null==(e=this.Ma)||e.call(this),null==(t=this.Ea)||t.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.tr(this.Wo):this.Ko()}}},{toolbar:class{constructor(e){this.instance=e}Wa(e){g.ph_toolbar_state=e}Za(){var e;return null!==(e=g.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),sh(this.instance.config)||!s||!o)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(r){return!1}t=null==s?void 0:s.localStorage}var n,a=oV||rE(e.hash,"__posthog")||rE(e.hash,"state"),l=a?sn(()=>JSON.parse(atob(decodeURIComponent(a))))||sn(()=>JSON.parse(decodeURIComponent(a))):null;return l&&"ph_authorize"===l.action?((n=l).source="url",n&&Object.keys(n).length>0&&(l.desiredHash?e.hash=l.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(t.getItem(oG)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(u){return!1}}Ga(e){var t=g.ph_load_toolbar||g.ph_load_editor;!er(t)&&Z(t)?t(e,this.instance):oW.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==o||!o.getElementById(sC));if(!s||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=b({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(s.localStorage.setItem(oG,JSON.stringify(b({},n,{source:void 0}))),2===this.Za())?this.Ga(n):0===this.Za()&&(this.Wa(1),null==(t=g.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return oW.error("[Toolbar] Failed to load",e),void this.Wa(0);this.Wa(2),this.Ga(n)}),su(s,"turbolinks:load",()=>{this.Wa(0),this.loadToolbar(n)})),!0}Qa(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},at,{conversations:class{constructor(e){this.Ja=void 0,this._conversationsManager=null,this.Ka=!1,this.Ya=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;er(t)||(ea(t)?this.Ja=t:(this.Ja=t.enabled,this.Ya=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Ja=void 0,this.Ya=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ka||this._instance.config.disable_conversations||sh(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==g?void 0:g.__PosthogExtensions__;if(e&&!ee(this.Ja)&&this.Ja){if(this.Ya&&this.Ya.token){this.Ka=!0;try{var t=e.initConversations;if(t)return this.Xa(t),void(this.Ka=!1);var i=e.loadExternalDependency;if(!i)return void this.tl(iQ);i(this._instance,"conversations",t=>{t||!e.initConversations?this.tl("Could not load conversations script",t):this.Xa(e.initConversations),this.Ka=!1})}catch(s){this.tl("Error initializing conversations",s),this.Ka=!1}}else o4.error("Conversations enabled but missing token in remote config.")}}}Xa(e){if(this.Ya)try{this._conversationsManager=e(this.Ya,this._instance),o4.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else o4.error("Cannot complete initialization: remote config is null")}tl(e,t){o4.error(e,t),this._conversationsManager=null,this.Ka=!1}show(){this._conversationsManager?this._conversationsManager.show():o4.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ja&&!es(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}
1sendMessage(e,t,i){var s=this;return y(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(o4.warn(o6),null)})()}getMessages(e,t){var i=this;return y(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(o4.warn(o6),null)})()}markAsRead(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(o4.warn(o6),null)})()}getTickets(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(o4.warn(o6),null)})()}requestRestoreLink(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(o4.warn(o6),null)})()}restoreFromToken(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(o4.warn(o6),null)})()}restoreFromUrlToken(){var e=this;return y(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(o4.warn(o6),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}En(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Rn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.el=!1,this.rl=!1,this.it=t3("[logs]"),this.Gr=[],this.il=[],this.Hs=0,this.nl=()=>{var e,t;this.Hs=0,null==(e=this.sl)||e.onReconnect(),null==(t=this.ol)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.el=!0),s&&su(s,"online",this.nl)}al(e,t,i,s){var r,n,o,a,l,u,h,c,d,p,v,g,_,f,m,y=(p=null!==(o=null==(r=null==(m=this._instance)||null==(m=m.config)?void 0:m.logs)?void 0:r.flushIntervalMs)&&void 0!==o?o:3e3,v=null!==(a=null==r?void 0:r.maxBufferSize)&&void 0!==a?a:100,g=null!=i&&i.consoleCapture?void 0:null!==(l=null==r?void 0:r.maxLogsPerInterval)&&void 0!==l?l:1e3,_=ee(g)?Math.max(v,2048):Math.max(v,g),{serviceName:null!==(u=null!==(h=null==(f=null==r?void 0:r.resourceAttributes)?void 0:f["service.name"])&&void 0!==h?h:null==r?void 0:r.serviceName)&&void 0!==u?u:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(c=null==f?void 0:f["service.version"])&&void 0!==c?c:null==r?void 0:r.serviceVersion,environment:null!==(d=null==f?void 0:f["deployment.environment"])&&void 0!==d?d:null==r?void 0:r.environment,resourceAttributes:f,beforeSend:null==r?void 0:r.beforeSend,flushIntervalMs:p,maxBufferSize:v,maxQueueSize:_,maxBatchRecordsPerPost:100,rateCapWindowMs:p,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new tE(this.ll(e,t),y,this.it,()=>this.ul(),e=>e(),void 0,s),y]}hl(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.sl||this.dl!==t){null==(i=this.sl)||i.reset(),this.dl=t;var i,s=this.al(()=>this.Gr,e=>{this.Gr=e});this.sl=s[0],this.cl=s[1]}return this.sl}vl(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.ol||this.fl!==t){null==(i=this.ol)||i.reset(),this.fl=t;var i,s=this.al(()=>this.il,e=>{this.il=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},o8);this.ol=s[0],this.pl=s[1]}return this.ol}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var i=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!er(i)&&i&&(this.el=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],null==(e=this.sl)||e.reset(),this.il=[],null==(t=this.ol)||t.reset(),this.Hs=0}captureLog(e){this.hl().captureLog(e)}le(e){this.vl().captureLog(e)}get logger(){return this.gl||(this.gl={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.gl}flushLogs(e){e?this.ml(e):(this.sl&&this.sl.flush().catch(e=>this.it.error("PostHog logs flush failed:",e)),this.ol&&this.ol.flush().catch(e=>this.it.error("PostHog logs flush failed:",e)))}loadIfEnabled(){if(this.el&&!this.rl){var e=null==g?void 0:g.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.it.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.rl=!0)}):this.it.error(iQ)}else this.it.error("PostHog Extensions not found.")}}ll(e,t){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===R.LogsQueue?e():void 0,setPersistedProperty(e,i){e===R.LogsQueue&&t(null!=i?i:[])},$t:e=>this.$t(e),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}$t(e){return new Promise(t=>{if(rx(this.Hs,3))t({kind:"fatal",error:Error("logs endpoint is unreachable, dropping batch")});else{var i=!1,s=e=>{i||(i=!0,clearTimeout(r),t(e))},r=setTimeout(()=>s({kind:"retry-later",error:Error("logs request timed out")}),9e4);this._instance._send_request({method:"POST",url:this.yl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t,i=e.statusCode;(this.bl(i),i>=200&&300>i)?s({kind:"ok"}
1):413===i?s({kind:"too-large"}):0!==i&&429!==i&&500>i?s({kind:"fatal",error:Error("logs request failed with status "+i)}):s({kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:Error("logs request failed with status "+i)})}})}})}bl(e){(0!==e||this._instance.__loaded)&&(this.Hs=rS(e,this.Hs,3,()=>this.it.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.")))}ml(e){this.Gr.length>0&&this._l(e,this.Gr,this.cl,f.LIB_NAME,e=>{this.Gr=e}),this.il.length>0&&this._l(e,this.il,this.pl,o8,e=>{this.il=e})}_l(e,t,i,s,r){if(0!==t.length){var n=t.map(e=>e.record);r([]);var o=tw(n,tb(i,f.LIB_NAME,f.LIB_VERSION),s,f.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}yl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}ul(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=i.windowId,r=i.sessionStartTimestamp,n=i.lastActivityTimestamp;t.sessionId=i.sessionId,t.windowId=s,er(r)||(t.sessionStartTimestamp=r),er(n)||(t.lastActivityTimestamp=n)}if(null!=g&&null!=(e=g.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tp(g.location.href):g.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.it=t3("[metrics]"),this._instance=e}initialize(){}hl(){var e,t,i,s,r,n,o,a,l,u=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this.sl&&this.dl===u||(null==(t=this.sl)||t.reset(),this.dl=u,this.sl=new tT(this.ll(),{serviceName:null!==(s=null==(l=null==u?void 0:u.resourceAttributes)?void 0:l["service.name"])&&void 0!==s?s:null==u?void 0:u.serviceName,serviceVersion:null!==(r=null==l?void 0:l["service.version"])&&void 0!==r?r:null==u?void 0:u.serviceVersion,environment:null!==(n=null==l?void 0:l["deployment.environment"])&&void 0!==n?n:null==u?void 0:u.environment,resourceAttributes:l,beforeSend:null==u?void 0:u.beforeSend,flushIntervalMs:null!==(o=null==u?void 0:u.flushIntervalMs)&&void 0!==o?o:1e4,maxSeriesPerFlush:null!==(a=null==u?void 0:u.maxSeriesPerFlush)&&void 0!==a?a:1e3},this.it)),this.sl}count(e,t,i){void 0===t&&(t=1),this.hl().count(e,t,i)}gauge(e,t,i){this.hl().gauge(e,t,i)}histogram(e,t,i){this.hl().histogram(e,t,i)}flush(e){if(!this.sl)return Promise.resolve();if(e){var t=this.sl.drainWindow();return t&&this.Kt(t,e),Promise.resolve()}return this.sl.flush().catch(e=>this.it.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.sl)||e.reset()}ll(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Kt:e=>t.Kt(e),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}Kt(e,t){return new Promise(i=>{var s=!1,r=e=>{s||(s=!0,clearTimeout(n),i(e))},n=setTimeout(()=>r({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(b({method:"POST",url:this.wl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,i=e.statusCode;i>=200&&300>i?r({kind:"ok"}):413===i?r({kind:"too-large"}):0!==i&&429!==i&&500>i?r({kind:"fatal",error:Error("metrics request failed with status "+i)}):r({kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:Error("metrics request failed with status "+i)})}}))})}wl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});o_.__defaultExtensionClasses=b({},ai);var as=(f.SDK_DIST_CHANNEL="npm",o5=oi[oh]=new o_,function(){function e(){e.done||(e.done=!0,oc=!1,si(oi,function(e){e._dom_loaded()}))}null!=o&&o.addEventListener?"complete"===o.readyState?e():su(o,"DOMContentLoaded",e,{capture:!1}):s&&t2.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),o5)}}]);

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.