posthog-js 1.421.1 → 1.422.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/crisp-chat-integration.js.map +1 -1
- package/dist/customizations.d.ts +23 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/exception-autocapture.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/intercom-integration.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/logs.js +1 -1
- package/dist/logs.js.map +1 -1
- package/dist/main.d.ts +23 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +23 -1
- package/dist/module.full.d.ts +23 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +23 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +23 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +23 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours-preview.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/recorder-v2.js +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/rrweb-plugin-console-record.js +1 -1
- package/dist/rrweb-plugin-console-record.js.map +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
- package/dist/src/extensions/replay/external/mutation-throttler.d.ts +1 -0
- package/dist/src/logs-types.d.ts +24 -0
- package/dist/src/posthog-logs.d.ts +24 -1
- package/dist/src/utils/console-original.d.ts +6 -0
- package/dist/src/utils/globals.d.ts +2 -0
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/dist/tracing-headers.js +1 -1
- package/dist/tracing-headers.js.map +1 -1
- package/dist/web-vitals-soft-navs.js.map +1 -1
- package/dist/web-vitals-with-attribution-soft-navs.js.map +1 -1
- package/dist/web-vitals-with-attribution.js.map +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/constants.d.ts +1 -0
- package/lib/src/constants.js +4 -3
- package/lib/src/constants.js.map +1 -1
- package/lib/src/entrypoints/logs.js +47 -18
- package/lib/src/entrypoints/logs.js.map +1 -1
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +9 -0
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
- package/lib/src/extensions/replay/external/mutation-throttler.d.ts +1 -0
- package/lib/src/extensions/replay/external/mutation-throttler.js +9 -0
- package/lib/src/extensions/replay/external/mutation-throttler.js.map +1 -1
- package/lib/src/extensions/replay/rrweb-plugins/patch.js +16 -5
- package/lib/src/extensions/replay/rrweb-plugins/patch.js.map +1 -1
- package/lib/src/logs-types.d.ts +24 -0
- package/lib/src/logs-types.js +11 -0
- package/lib/src/logs-types.js.map +1 -0
- package/lib/src/persistence-key-policy.js +1 -0
- package/lib/src/persistence-key-policy.js.map +1 -1
- package/lib/src/posthog-core.js +10 -5
- package/lib/src/posthog-core.js.map +1 -1
- package/lib/src/posthog-logs.d.ts +24 -1
- package/lib/src/posthog-logs.js +266 -10
- package/lib/src/posthog-logs.js.map +1 -1
- package/lib/src/request.js +1 -3
- package/lib/src/request.js.map +1 -1
- package/lib/src/utils/console-original.d.ts +6 -0
- package/lib/src/utils/console-original.js +16 -0
- package/lib/src/utils/console-original.js.map +1 -0
- package/lib/src/utils/globals.d.ts +2 -0
- package/lib/src/utils/globals.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,r=null==t?void 0:t.navigator,i=null==t?void 0:t.document,n=null==t?void 0:t.location,s=null==t?void 0:t.fetch,o=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,u=null==r?void 0:r.userAgent;function c(){return!(!e||!1===e.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var h=null!=e?e:{};function p(e,t,r,i,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,n)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var s=e.apply(t,r);function o(e){p(s,i,n,o,a,"next",e)}function a(e){p(s,i,n,o,a,"throw",e)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},g.apply(null,arguments)}function _(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}var f={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},m={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},y=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function b(e){return"string"==typeof e||e}function S(e){return"string"==typeof e?e:void 0}var w,k=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],C=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),E=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),T="min_length",x="max_length",I=["$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"],R="NativeGzipValidationError",P=e=>e.length>=2&&31===e[0]&&139===e[1],F=(e,t)=>e===E.GZipJS||t===E.GZipJS||"gzip"===t,L=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),A=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return L(e)||t===R},O=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=R,t},D=function(){var e=v((function*(e,t){18>e.size&&O("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());P(r)&&8===r[2]||O("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(w)return w;w=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;w[e]=t>>>0}return w})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&O("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&O("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function N(e,t,r){return B.apply(this,arguments)}function B(){return B=v((function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),o=s.write(i).then((()=>s.close())).catch(function(){var e=v((function*(e){try{yield s.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),a=new Response(n.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield D(l,i),l}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})),B.apply(this,arguments)}var q=20,H=1e3,U=1e4,W="[Circular]",z="[Truncated]",V="[Unserializable]",j="[Function]";function G(e){for(var t="",r=0;e.length>r;r++){var i=e.charCodeAt(r);if(55296>i||i>56319)t+=56320>i||i>57343?e[r]:"�";else{var n=e.charCodeAt(r+1);56320>n||n>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}var Q=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],K=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return Q.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function Z(e,t){return-1!==e.indexOf(t)}var Y=function(e){return e.trim()},J=function(e){return e.replace(/^\$/,"")};function X(e){var t,r=[];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(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}})))&&void 0!==t?t:"null"}var ee=Object.prototype,te=ee.hasOwnProperty,re=ee.toString,ie=Array.isArray||function(e){return"[object Array]"===re.call(e)},ne=e=>"function"==typeof e,se=e=>e===Object(e)&&!ie(e),oe=e=>{if(se(e)){for(var t in e)if(te.call(e,t))return!1;return!0}return!1},ae=e=>void 0===e,le=e=>"[object String]"==re.call(e),ue=e=>le(e)&&0===e.trim().length,ce=e=>null===e,de=e=>ae(e)||ce(e),he=e=>"[object Number]"==re.call(e)&&e==e,pe=e=>he(e)&&e>0,ve=e=>"[object Boolean]"===re.call(e),ge=e=>e instanceof FormData,_e=e=>Z(I,e),fe=e=>Z(M,e);function me(e){return null===e||"object"!=typeof e}function ye(e,t){return{}.toString.call(e)==="[object "+t+"]"}function be(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return we(e,Error)}}function Se(e){return"undefined"!=typeof Event&&we(e,Event)}function we(e,t){try{return e instanceof t}catch(e){return!1}}var ke=[!0,"true",1,"1","yes"],Ce=e=>Z(ke,e),Ee=[!1,"false",0,"0","no"];function Te(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),he(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),Te(n||r,t,r,i))}class xe{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Te(e.bucketSize,0,100,e._logger),this._refillRate=Te(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Te(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),n=this._buckets[i];return n?this._applyRefill(n,r):this._buckets[i]=n={tokens:this._bucketSize,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}}var Ie="Mobile",Me="iOS",Re="Android",Pe="Tablet",Fe=Re+" "+Pe,Le="iPad",Ae="Apple",Oe=Ae+" Watch",De="Safari",Ne="BlackBerry",Be="Samsung",qe=Be+"Browser",He=Be+" Internet",$e="Chrome",Ue=$e+" OS",We=$e+" "+Me,ze="Internet Explorer",Ve=ze+" "+Ie,je="Opera",Ge=je+" Mini",Qe="Edge",Ke="Microsoft "+Qe,Ze="Firefox",Ye=Ze+" "+Me,Je="Nintendo",Xe="PlayStation",et="Xbox",tt=Re+" "+Ie,rt=Ie+" "+De,it="Windows",nt=it+" Phone",st="Nokia",ot="Ouya",at="Generic",lt=at+" "+Ie.toLowerCase(),ut=at+" "+Pe.toLowerCase(),ct="Konqueror",dt="Oculus Browser",ht="Vivaldi",pt="Yandex",vt="Whale",gt="DuckDuckGo",_t="Pale Moon",ft="Waterfox",mt="Brave",yt="Google Search App",bt="(\\d+(\\.\\d+)?)",St=new RegExp("Version/"+bt),wt=new RegExp(et,"i"),kt=new RegExp(Xe+" \\w+","i"),Ct=new RegExp(Je+" \\w+","i"),Et=new RegExp(Ne+"|PlayBook|BB10","i"),Tt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},xt=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?mt:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&Z(e,"GSA/")?yt:Z(e," OPR/")&&Z(e,"Mini")?Ge:Z(e," OPR/")?je:Et.test(e)?Ne:Z(e,"IE"+Ie)||Z(e,"WPDesktop")?Ve:Z(e,"OculusBrowser")?dt:Z(e,qe)?He:Z(e,Qe)||Z(e,"Edg/")?Ke:Z(e,ht+"/")?ht:Z(e,"YaBrowser/")?pt:Z(e,vt+"/")?vt:Z(e,gt+"/")||Z(e,"Ddg/")?gt:Z(e,"FBIOS")?"Facebook "+Ie:Z(e,"UCWEB")||Z(e,"UCBrowser")?"UC Browser":Z(e,"CriOS")?We:Z(e,"CrMo")||Z(e,$e)?$e:Z(e,Re)&&Z(e,De)?tt:Z(e,"FxiOS")?Ye:Z(e.toLowerCase(),ct.toLowerCase())?ct:Z(e,mt+"/")?mt:((e,t)=>t&&Z(t,Ae)||function(e){return Z(e,De)&&!Z(e,$e)&&!Z(e,Re)}(e))(e,t)?Z(e,Ie)?rt:De:Z(e,"PaleMoon/")?_t:Z(e,ft+"/")?ft:Z(e,Ze)?Ze:Z(e,"MSIE")||Z(e,"Trident/")?ze:Z(e,"Gecko")?Ze:"")},It={[Ve]:[new RegExp("rv:"+bt)],[Ke]:[new RegExp(Qe+"?\\/"+bt)],[$e]:[new RegExp("("+$e+"|CrMo)\\/"+bt)],[We]:[new RegExp("CriOS\\/"+bt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+bt)],[De]:[St],[rt]:[St],[je]:[new RegExp("(Opera|OPR)\\/"+bt)],[Ze]:[new RegExp(Ze+"\\/"+bt)],[Ye]:[new RegExp("FxiOS\\/"+bt)],[ct]:[new RegExp("Konqueror[:/]?"+bt,"i")],[Ne]:[new RegExp(Ne+" "+bt),St],[tt]:[new RegExp("android\\s"+bt,"i")],[He]:[new RegExp(qe+"\\/"+bt)],[dt]:[new RegExp("OculusBrowser\\/"+bt)],[ht]:[new RegExp(ht+"\\/"+bt)],[pt]:[new RegExp("YaBrowser\\/"+bt)],[vt]:[new RegExp(vt+"\\/"+bt)],[mt]:[new RegExp(mt+"\\/"+bt)],[gt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+bt)],[_t]:[new RegExp("PaleMoon\\/"+bt)],[ft]:[new RegExp(ft+"\\/"+bt)],[yt]:[new RegExp("GSA\\/"+bt)],[ze]:[new RegExp("(rv:|MSIE )"+bt)],Mozilla:[new RegExp("rv:"+bt)]},Mt=function(e,t,r,i){var n=xt(e,t,r,i),s=It[n];if(ae(s))return null;for(var o=0;s.length>o;o++){var a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},Rt=[[new RegExp(et+"; "+et+" (.*?)[);]","i"),e=>[et,e&&e[1]||""]],[new RegExp(Je,"i"),[Je,""]],[new RegExp(Xe,"i"),[Xe,""]],[Et,[Ne,""]],[new RegExp(it,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[nt,""];if(new RegExp(Ie).test(t)&&!/IEMobile\b/.test(t))return[it+" "+Ie,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Tt[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[it,i]}return[it,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Me,[e[3],e[4],e[5]||"0"].join(".")]:[Me,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ae(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Re+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Re+")","i"),e=>e&&e[2]?[Re,[e[2],e[3],e[4]||"0"].join(".")]:[Re,""]],[/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/,[Ue,""]],[/Linux|debian/i,["Linux",""]]],Pt=function(e){return Ct.test(e)?Je:kt.test(e)?Xe:wt.test(e)?et:new RegExp(ot,"i").test(e)?ot:new RegExp("("+nt+"|WPDesktop)","i").test(e)?nt:/iPad/.test(e)?Le:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Oe:Et.test(e)?Ne:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(st,"i").test(e)?st:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Ie).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)?Re:Fe:new RegExp("(pda|"+Ie+")","i").test(e)?lt:new RegExp(Pe,"i").test(e)&&!new RegExp(Pe+" pc","i").test(e)?ut:""},Ft=function(e,t){var r,i,n,s,o=Pt(e);return o===Le||o===Fe||"Kobo"===o||"Kindle Fire"===o||o===ut?Pe:o===Je||o===et||o===Xe||o===ot?"Console":o===Oe?"Wearable":o?Ie:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(n=null==t?void 0:t.screenHeight)&&void 0!==n?n:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?Ie:Pe:"Desktop"},Lt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function At(e,t){return"string"==typeof(r=e)&&Lt.test(r)?e:t();var r}function Ot(e){return e?e.split("#")[0]:e}function Dt(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function Nt(e,t,r){return Bt.apply(this,arguments)}function Bt(){return(Bt=v((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,n)=>{i=Dt((()=>{try{null==r||r(),e()}catch(e){n(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var qt={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Ht=qt.info,$t=0x8000000000000000,Ut={}.propertyIsEnumerable;function Wt(e,t){try{return jt(e,t,{ancestors:new WeakSet,remainingNodes:U},0)}catch(e){return[]}}function zt(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:z};if(r.remainingNodes--,ve(e))return{boolValue:e};if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if("undefined"==typeof BigInt)return{stringValue:String(e)};var n=BigInt(e).toString();return e>=$t||-$t>e?(null==t||t.debug("Attribute "+n+" is outside the int64 range; encoding it as a string"),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:G(e)};if("function"==typeof e)return{stringValue:j};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(r.ancestors.has(e))return{stringValue:W};if(i>=q)return{stringValue:z};if(e instanceof Date){var s=e.getTime(),o=Number.isFinite(s)?e.toISOString():String(e);return{stringValue:"string"==typeof o?G(o):String(o)}}r.ancestors.add(e);try{try{var a=e.toJSON;if("function"==typeof a)return zt(a.call(e),t,r,i+1)}catch(e){}return ie(e)?{arrayValue:{values:Vt(e,t,r,i+1)}}:{kvlistValue:{values:jt(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:G(String(e))}}function Vt(e,t,r,i){for(var n=[],s=Math.min(e.length,H),o=0;s>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(de(a))continue;n.push(zt(a,t,r,i))}catch(e){n.push({stringValue:V})}return e.length>o&&n.push({stringValue:z}),n}function jt(e,t,r,i){var n=[];for(var s in e)if(Ut.call(e,s)){if(n.length>=H||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[s];if(ce(o)||ae(o))continue;n.push({key:G(s),value:zt(o,t,r,i)})}catch(e){n.push({key:G(s),value:{stringValue:V}})}}return n}function Gt(e){try{return G(String(e))}catch(e){return V}}function Qt(e,t,r){var i=qt[e.level||"info"]||Ht,n=i.text,s=i.number,o=String(Date.now())+"000000",a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),de(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),de(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);var l=g({},a),u=e.attributes;if(u){var c=[];try{c=Object.keys(u)}catch(e){c=[]}for(var d of c){var h=void 0;try{h=u[d]}catch(e){h=V}Object.defineProperty(l,d,{value:h,enumerable:!0,writable:!0,configurable:!0})}}var p={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:s,severityText:n,body:{stringValue:Gt(e.body)},attributes:Wt(l,r)};return e.trace_id&&(p.traceId=e.trace_id),e.span_id&&(p.spanId=e.span_id),ae(e.trace_flags)||(p.flags=e.trace_flags),p}function Kt(e,t,r){return g({},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":r})}function Zt(e,t,r,i){return{resourceLogs:[{resource:{attributes:Wt(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let Yt=class{constructor(e,t,r,i,n,s,o){var a;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=n,this._waitForStoragePersist=s,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}reset(){this._clearFlushTimer(),this._flushPromise=null,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._evictedSinceAdvance=0,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this._runBeforeSend(e);if(null!==t)if(t.body){if(this._checkRateLimit()){var r={record:Qt(t,this._getContext(),this._logger)};this._onReady((()=>this._enqueue(r)))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=ie(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Log was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return v((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return v((function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(C.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o;e._evictedSinceAdvance=0;var a=Math.min(r.length,e._maxBatchRecordsPerPost),l=r.slice(0,a),u=l.map((e=>e.record)),c=Zt(u,e._buildResourceAttributes(),null!==(s=e._scopeName)&&void 0!==s?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance._sendLogsBatch(c);if("too-large"===d.kind&&l.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(l.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?e._logger.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"===d.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(l.length),r=null!==(o=e._instance.getPersistedProperty(C.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===d.kind)throw d.error}}}))()}_persistQueueAdvance(e){var t=this;return v((function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),n=null!==(r=t._instance.getPersistedProperty(C.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(C.LogsQueue,n.slice(i)),yield t._waitForStoragePersist()}))()}_buildResourceAttributes(){return Kt(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(C.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(C.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=Dt((()=>{this._flushTimer=void 0,this._flushInBackground()}),e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(C.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return v((function*(){t._clearFlushTimer();var r=t.flush().catch((()=>{}));void 0!==e?yield Nt(r,e):yield r}))()}flushWithTimeout(e){var t=this;return v((function*(){var r=t.flush();yield Nt(r,e,(()=>{r.catch((()=>{}))}))}))()}_flushInBackground(){this.flush().then((()=>{this._consecutiveFlushFailures=0}),(e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())}))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}};var Jt=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Xt(e){return String(e)+"000000"}function er(e,t,r,i){var n="";return i&&(n=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+n}let tr=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,t=this._flushPromise,r=function(){var r=v((function*(){t&&(yield t.catch((()=>{}))),yield e._doFlush()}));return function(){return r.apply(this,arguments)}}(),i=r().finally((()=>{this._flushPromise===i&&(this._flushPromise=null)}));return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(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._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=t.attributes?g({},t.attributes):void 0,i=er(t.type,t.name,t.unit,r)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var n=this._series.get(i);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,n)}var s=this._typeByName.get(t.name);void 0===s?this._typeByName.set(t.name,t.type):s===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+s+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(n,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Jt.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,Jt)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=ie(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Metric was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=Dt((()=>{this._flushTimer=void 0,this.flush().catch((e=>{this._logger.error("Metrics flush failed:",e)}))}),this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return v((function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}}))()}_buildPayload(e){return t=this._buildMetrics(e),r=function(e,t,r){return g({},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":r})}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Wt(r)},scopeMetrics:[{scope:{name:i,version:n},metrics:t}]}]};var t,r,i,n}_buildMetrics(e){var t=Xt(Date.now()),r=new Map;for(var i of e.values()){var n,s=er(i.type,i.name,i.unit,void 0),o=r.get(s);o||(o=g({name:i.name},i.unit&&{unit:i.unit}),"count"===i.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===i.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=Wt(null!==(n=i.attributes)&&void 0!==n?n:{},this._logger),l=Xt(i.windowStartMs);if("count"===i.type){var u,c={attributes:a,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!==(u=i.total)&&void 0!==u?u:0};o.sum.dataPoints.push(c)}else if("gauge"===i.type){var d,h={attributes:a,timeUnixNano:t,asDouble:null!==(d=i.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(h)}else i.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Jt})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var n=i[0],s=i[1],o=this._series.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=s.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this._admitNewSeries()&&this._series.set(n,s)}}};function rr(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var ir,nr,sr;function or(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return sr&&r.length===nr||(nr=r.length,sr=r.reduce(((r,i)=>{ir||(ir={});var n=ir[i];if(n)r[n[0]]=n[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,ir[i]=[l,u];break}}return r}),{})),sr}}class ar{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),s=this.parseStacktrace(i,n);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var t=this;return v((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&ie(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.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 r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),g({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return v((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,n,s={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(i=t.handled)||void 0===i||i,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,g({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:or(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var n=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,n)}};return g({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}var lr="?";function ur(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?lr:r,in_app:!(null!=t&&t.startsWith("webkit-masked-url://"))&&"<anonymous>"!==t};return ae(i)||(s.lineno=i),ae(n)||(s.colno=n),s}var cr=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:lr,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},dr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pr=/\((\S*)(?::(\d+))(?::(\d+))\)/,vr=(e,t)=>{var r=dr.exec(e);if(r)return ur(t,r[1],lr,+r[2],+r[3]);var i=hr.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var n=pr.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=cr(i[1]||lr,i[2]);return ur(t,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},gr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_r=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fr=(e,t)=>{var r=gr.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=_r.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||lr,o=cr(s,n);return ur(t,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},mr=/\(error: (.*)\)/,yr=50;class br{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=le(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?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 ye(e,"DOMException")}isDOMError(e){return ye(e,"DOMError")}}class Sr{match(e){return be(e)}coerce(e,t){var r,i=this.getStack(e),n=void 0===i;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=i?i:null==(r=t.syntheticException)?void 0:r.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class wr{constructor(){}match(e){return!!ye(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var r;if(null!=e.error)return t.apply(e.error);var i=t.apply(e.message);return g({},i,{stack:null!==(r=this._buildLocationStack(e))&&void 0!==r?r:i.stack,synthetic:!0})}_hasUsableMessage(e){return le(e.message)&&e.message.length>0}_buildLocationStack(e){var t,r,i=e,n=null!==(t=i.lineno)&&void 0!==t?t:0,s=null!==(r=i.colno)&&void 0!==r?r:0;if(le(i.filename)&&0!==i.filename.length&&0!==n)return"Error\n at "+i.filename+":"+n+":"+s}}var kr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Cr{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),n=i[0],s=i[1];return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(kr);return i&&(t=i[1],r=i[2]),[t,r]}}var Er=["fatal","error","warning","log","info","debug"];function Tr(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(t>=n.length)return i===r.length?n:n.length>t?n.slice(0,t)+"...":n}return""}class xr{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(r=this.getStack(e))&&void 0!==r?r:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Se(e))return e.constructor.name;var t="name"in e?e.name:void 0;return le(t)&&!ue(t)?t:"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 r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+Tr(e)}isSeverityLevel(e){return le(e)&&!ue(e)&&Er.indexOf(e)>=0}getStack(e){try{return le(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:le(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(be(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Ir{match(e){return Se(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Tr(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Mr{match(e){return me(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Rr{match(e){return ye(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Se(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return me(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}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(e){}return e}}var Pr="$message",Fr="$timestamp",Lr=new Set([Pr,Fr]),Ar={enabled:!0,max_bytes:32768};function Or(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ar.enabled,max_bytes:Nr(e.max_bytes,Ar.max_bytes)}:g({},Ar)}class Dr{constructor(e){this._entries=[],this._totalBytes=0,this._config=Or(e)}setConfig(e){this._config=Or(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=X(e)}catch(e){return}try{var r=JSON.parse(t);if(!se(r))return;var i=r,n=i[Pr],s=i[Fr];if(!le(n)||0===n.trim().length)return;if(!le(s)&&!he(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function Nr(e,t){if(!he(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var Br={DEBUG:!1,LIB_VERSION:"0.6.0",LIB_NAME:"browser-common"},qr=function(t,r){var i=(void 0===r?{}:r).debugEnabled,n={_log(r){if(e&&(Br.DEBUG||e.POSTHOG_DEBUG||i)&&!ae(e.console)&&e.console){for(var n=("__rrweb_original__"in e.console[r]?e.console[r].__rrweb_original__:e.console[r]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];n(t,...o)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("error",...t)},critical(){for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning(e){n.error("You must initialize PostHog before calling "+e)},createLogger:(e,r)=>qr(t+" "+e,r)};return n},Hr=qr("[PostHog.js]"),$r=Hr.createLogger;function Ur(e,t){ie(e)&&e.forEach(t)}function Wr(e,t){if(!de(e))if(ie(e))e.forEach(t);else if(ge(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)te.call(e,r)&&t(e[r],r)}var zr=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)void 0!==n[s]&&(e[s]=n[s]);return e};function Vr(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var jr=function(e){try{return e()}catch(e){return}},Gr=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){Hr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Hr.critical(e)}}},Qr=function(e){var t={};return Wr(e,(function(e,r){(le(e)&&e.length>0||he(e))&&(t[r]=e)})),t};var Kr=["herokuapp.com","vercel.app","netlify.app"];function Zr(e){var t=null==e?void 0:e.hostname;if(!le(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Kr)if(r===i)return!1;return!0}function Yr(e,t,r,i){var n=null!=i?i:{},s=n.capture,o=n.passive;null==e||e.addEventListener(t,r,{capture:void 0!==s&&s,passive:void 0===o||o})}function Jr(e){return"ph_toolbar_internal"===e.name}var Xr=["localhost","127.0.0.1"],ei=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return X(e)}},ti=e=>{var t=null==i?void 0:i.createElement("a");return ae(t)?null:(t.href=e,t)},ri=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return Wr(e,(function(e,t){ae(e)||ae(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},ii=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===t){r=s;break}}if(!ie(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){Hr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ni=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");ie(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},si=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},oi=(e,t)=>e>=t&&c(),ai=(e,t,r,i)=>{if(0===e){if(c()){var n=t+1;return n===r&&i(),n}return t}return 0};function li(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!ne(i))return t;try{var n=i(t);return le(n)&&n?n:t}catch(e){return Hr.error("Error in get_current_url, falling back to window.location.href",e),t}}function ui(t){var r,i=null==e||null==(r=e.location)?void 0:r.href;return ae(i)?void 0:li(t,i)}var ci="__POSTHOG_TOOLBAR__",di=1,hi=3,pi=11;function vi(e){return e instanceof Element&&(e.id===ci||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function gi(e){return!!e&&e.nodeType===di}function _i(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function fi(e){return!!e&&e.nodeType===hi}function mi(e){return!!e&&e.nodeType===pi&&gi(e.host)}var yi=1e3;function bi(e){return e?Y(e).split(/\s+/):[]}function Si(e,t){var r=ui(t);return!!(r&&e&&e.some((e=>r.match(e))))}function wi(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 bi(t)}function ki(e){return de(e)?null:Y(e).split(/(\s+)/).filter((e=>Qi(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ci(e){var t="";return qi(e)&&!Hi(e)&&e.childNodes&&e.childNodes.length&&Wr(e.childNodes,(function(e){var r;fi(e)&&e.textContent&&(t+=null!==(r=ki(e.textContent))&&void 0!==r?r:"")})),Y(t)}function Ei(e){var t;return ae(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Ti=["a","button","form","input","select","textarea","label"];function xi(e,t){if(ae(t))return!0;var r,i=function(e){if(t.some((t=>function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}(e,t))))return{v:!0}};for(var n of e)if(r=i(n))return r.v;return!1}function Ii(e){var t=e.parentNode;return!(!t||!gi(t))&&t}var Mi=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ri=["next","previous","prev",">","<"],Pi=[...Ri,"+","-","−","–"],Fi=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Li=[".ph-no-deadclick",".ph-no-capture"],Ai=[".ph-no-rageclick",".ph-no-capture"],Oi=["","text","search","email","password","url","tel","number"];function Di(t,r){if(!e||Ni(t))return!1;var i,n,s,o,a;if(ve(r)?(i=!!r&&Ai,n=void 0,s=!1):(i=null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:Ai,n=null==r?void 0:r.content_ignorelist,s=null!==(a=null==r?void 0:r.ignore_text_selection)&&void 0!==a&&a),!1===i)return!1;if(s&&function(e){return!(!e||!gi(e))&&(!!_i(e,"textarea")||(_i(e,"input")?Z(Oi,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(t))return!1;var l=Bi(t,!1).targetElementList;return!function(e,t){if(!1===e||ae(e))return!1;var r;if(!0===e)r=Ri;else{if(!ie(e))return!1;if(e.length>10)return Hr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map((e=>e.toLowerCase()))}return t.some((e=>{var t=e.safeText,i=e.ariaLabel;return r.some((e=>Fi(t,e)||Fi(i,e)))}))}(n,l.map((e=>{var t;return{safeText:Ci(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!xi(l,i)}var Ni=e=>!e||_i(e,"html")||!gi(e),Bi=(t,r)=>{if(!e||Ni(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,n=[t],s=t;s.parentNode&&!_i(s,"body");)if(mi(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var o=Ii(s);if(!o)break;if(r||Ti.indexOf(o.tagName.toLowerCase())>-1)i=!0;else try{var a=e.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}catch(e){}n.push(o),s=o}return{parentIsUsefulElement:i,targetElementList:n}};function qi(e){for(var t=new Set,r=0,i=e;i.parentNode&&!_i(i,"body");i=i.parentNode){if(r++>=yi||t.has(i))return!1;t.add(i);var n=wi(i);if(Z(n,"ph-sensitive")||Z(n,"ph-no-capture"))return!1}if(Z(wi(e),"ph-include"))return!0;var s=e.type||"";if(le(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!le(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 Hi(e){return!!(_i(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||_i(e,"select")||_i(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var $i=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Ui=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Wi=[16,15,14,13],zi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Vi=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ji=/[0-9A-Za-z_]/;function Gi(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var n=e.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),t+=n,r=!r}return t%10==0}function Qi(e,t){if(void 0===t&&(t=!0),de(e))return!1;if(le(e)){e=Y(e);var r=t?$i.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Ui.lastIndex=0;t=Ui.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of Wi){var o=n+s;if(i.length>=o){var a=i.slice(n,o);if($i.test(a)&&Gi(a))return!0}}}return!1}(e);if(r)return!1;var i=t?zi.test(e):function(e){var t;for(Vi.lastIndex=0;t=Vi.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&ji.test(r)&&ji.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function Ki(e){var t=Ci(e);return Qi(t=(t+" "+Zi(e)).trim())?t:""}function Zi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Wr(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=Ci(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Zi(e)).trim())}catch(e){Hr.error("[AutoCapture]",e)}})),t}function Yi(e){return e.replace(/"|\\"/g,'\\"')}function Ji(e){var t=e.attr__class;if(t)return ie(t)?t:bi(t)}var Xi="[SessionRecording]",en="redacted",tn=1e6;function rn(e){var t;return Math.min(tn,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:tn)}var nn={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:tn,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},sn=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],on=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],an=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],ln=e=>{de(e)||Wr(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return sn.includes(t)||an.some((e=>t.includes(e)))})(t)&&(e[t]=en)}))},un=["/s/","/e/","/i/"];function cn(e,t,r,i){if(de(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return le(n)&&(n=parseInt(n)),n>r?Xi+" "+i+" body too large to record ("+n+" bytes)":e}function dn(e,t){if(de(e))return e;var r=e;return Qi(r,!1)||(r=Xi+" "+t+" body "+en),Wr(on,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=Xi+" "+t+" body "+en+" as might contain: "+e)})),r}var hn=new WeakSet,pn="$people_distinct_id",vn="distinct_id",gn="$device_id",_n="$device_model",fn="__alias",mn="__timers",yn="$autocapture_disabled_server_side",bn="$heatmaps_enabled_server_side",Sn="$exception_capture_enabled_server_side",wn="$error_tracking_suppression_rules",kn="$error_tracking_capture_extension_exceptions",Cn="$web_vitals_enabled_server_side",En="$dead_clicks_enabled_server_side",Tn="$product_tours_enabled_server_side",xn="$web_vitals_allowed_metrics",In="$session_recording_remote_config",Mn="$replay_sample_rate",Rn="$replay_override_sampling",Pn="$replay_override_linked_flag",Fn="$replay_override_url_trigger",Ln="$replay_override_event_trigger",An="$sesid",On="$session_is_sampled",Dn="$session_past_minimum_duration",Nn="$session_recording_url_trigger_activated_session",Bn="$session_recording_event_trigger_activated_session",qn="$posthog_sr_group_event_trigger_",Hn="$posthog_sr_group_url_trigger_",$n="$posthog_sr_group_sampling_",Un="$debug_first_full_snapshot_timestamp",Wn="$sess_rec_flush_size",zn="$enabled_feature_flags",Vn="$active_feature_flags",jn="$early_access_features",Gn="$feature_flag_details",Qn="$feature_flag_payloads",Kn="$feature_flag_request_id",Zn="$minimal_flag_called_events",Yn="$override_feature_flags",Jn="$override_feature_flag_payloads",Xn="$stored_person_properties",es="$stored_group_properties",ts="$groups",rs="$surveys",is="$surveys_loaded_at",ns="$surveys_activated",ss="$surveys_activated_session",os="$surveys_activated_timestamps",as="ph_product_tours",ls="$flag_call_reported",us="$flag_call_reported_session_id",cs="$feature_flag_errors",ds="$feature_flag_evaluated_at",hs="$user_state",ps="$client_session_props",vs="$capture_rate_limit",gs="$initial_campaign_params",_s="$initial_referrer_info",fs="$initial_person_info",ms="$epp",ys="$posthog_cookieless",bs="$cookieless_mode",Ss="$sdk_debug_extensions_init_method",ws="$sdk_debug_extensions_init_time_ms",ks="$sdk_debug_recording_script_not_loaded",Cs="$sdk_debug_replay_event_trigger_status",Es="$sdk_debug_replay_linked_flag_trigger_status",Ts="$sdk_debug_replay_matched_recording_trigger_groups",xs="$sdk_debug_replay_pending_trigger_conditions",Is="$sdk_debug_replay_remote_trigger_matching_config",Ms="$sdk_debug_replay_trigger_groups_count",Rs="$sdk_debug_replay_url_trigger_status",Ps="$session_recording_start_reason",Fs="PostHog loadExternalDependency extension not found.",Ls="on_reject",As="always",Os="anonymous",Ds="identified",Ns="identified_only",Bs="visibilitychange",qs="beforeunload",Hs="$pageview",$s="$pageleave",Us="$identify",Ws="$groupidentify",zs="disabled",Vs="sampled",js="active",Gs="buffering",Qs="paused",Ks="lazy_loading",Zs="awaiting_config",Ys="missing_config",Js="rrweb_error",Xs="trigger",eo=Xs+"_activated",to=Xs+"_pending",ro=Xs+"_"+zs;function io(e,t,r,i,n,s){return 0===t?ro:(null==e?void 0:e.get_property(r?i+r:n))===s?eo:to}function no(e,t,r){return t.some((t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)}))}function so(e){return e.includes(eo)?eo:e.includes(to)?to:ro}function oo(e){var t=new Set(e);switch(t.delete(ro),t.size){case 0:return ro;case 1:return Array.from(t)[0];default:return to}}class ao{constructor(e){this._matchers=e}triggerStatus(e){return so(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return so(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class lo{constructor(e){this._matchers=e}triggerStatus(e){return oo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return oo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class uo{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return eo}stop(){}}var co=e=>"sessionRecording"in e;class ho{constructor(e,t){this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._instance=e,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(co(e)?se(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(co(e)?se(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Hr.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){Hr.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return io(this._instance,this._urlTriggers.length,this._groupId,Hn,Nn,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Rs]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=ui(this._instance);if(!e)return!1;try{return no(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=ui(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=no(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=ui(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=no(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===eo,l=no(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class po{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Es]:e}),e}triggerStatusNoSideEffects(){var e=to;return de(this.linkedFlag)&&(e=ro),this.linkedFlagSeen&&(e=eo),e}onConfig(e,t){var r;if(this.linkedFlag=(co(e)?se(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!de(this.linkedFlag)&&!this.linkedFlagSeen){var i=le(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=le(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(se(r)&&i in r){var o=r[i];s=ve(o)?!0===o:n?o===n:!!o}var a=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,a&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class vo{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(co(e)?se(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return io(this._instance,this._eventTriggers.length,this._groupId,qn,Bn,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Cs]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===eo,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class go{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new ho(e,t.id),this._eventTriggerMatching=new vo(e,t.id),this._linkedFlagMatching=new po(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map((e=>e.name)),n={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,r);var s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new ao(s):new lo(s)}else this._combinedMatching=new uo}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return this.triggerStatusNoSideEffects(e)!==to?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter((e=>e.status===to)).map((e=>e.label))}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Hn+this.group.id:qn+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function _o(e){if(e.rrwebError)return Js;if(!e.receivedFlags)return Gs;if(!e.isRecordingEnabled)return zs;if(e.urlTriggerMatching.urlBlocked)return Qs;var t=!0===e.isSampled,r=new ao([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?Vs:r===eo?js:r===to?Gs:!1===e.isSampled?zs:js}function fo(e){if(e.rrwebError)return Js;if(!e.receivedFlags)return Gs;if(!e.isRecordingEnabled)return zs;if(e.urlTriggerMatching.urlBlocked)return Qs;var t=new lo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==ro,i=ve(e.isSampled);return r&&t===to?Gs:r&&t===ro||i&&!e.isSampled?zs:!0===e.isSampled?Vs:js}function mo(){var e=[];return function(t,r){if(se(r)||ie(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function yo(e){var t=JSON.stringify(e,mo());return t?new Blob([t]).size:0}function bo(e){if(ce(e))return 4;if(ae(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(ie(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=ae(i)||ce(i)?4:bo(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];ae(l)||(o||(s+=1),o=!1,s+=a.length+3+bo(l))}return s;default:return 0}}function So(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),n=e.sizes.slice(r);return[So({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),So({size:n.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var wo=Uint8Array,ko=Uint16Array,Co=Uint32Array,Eo=new wo([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]),To=new wo([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]),xo=new wo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Io=function(e,t){for(var r=new ko(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new Co(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Mo=Io(Eo,2),Ro=Mo[1];Mo[0][28]=258,Ro[258]=28;for(var Po=Io(To,0)[1],Fo=new ko(32768),Lo=0;32768>Lo;++Lo){var Ao=(43690&Lo)>>>1|(21845&Lo)<<1;Fo[Lo]=((65280&(Ao=(61680&(Ao=(52428&Ao)>>>2|(13107&Ao)<<2))>>>4|(3855&Ao)<<4))>>>8|(255&Ao)<<8)>>>1}var Oo=function(e,t,r){for(var i=e.length,n=0,s=new ko(t);i>n;++n)++s[e[n]-1];var o,a=new ko(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new ko(1<<t);var l=15-t;for(n=0;i>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[Fo[d]>>>l]=u}else for(o=new ko(i),n=0;i>n;++n)o[n]=Fo[a[e[n]-1]++]>>>15-e[n];return o},Do=new wo(288);for(Lo=0;144>Lo;++Lo)Do[Lo]=8;for(Lo=144;256>Lo;++Lo)Do[Lo]=9;for(Lo=256;280>Lo;++Lo)Do[Lo]=7;for(Lo=280;288>Lo;++Lo)Do[Lo]=8;var No=new wo(32);for(Lo=0;32>Lo;++Lo)No[Lo]=5;var Bo=Oo(Do,9,0),qo=Oo(No,5,0),Ho=function(e){return(e/8>>0)+(7&e&&1)},$o=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof ko?ko:e instanceof Co?Co:wo)(r-t);return i.set(e.subarray(t,r)),i},Uo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Wo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},zo=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,s=r.slice();if(!n)return[new wo(0),0];if(1==n){var o=new wo(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(i=1;n>i;++i)s[i].s>h&&(h=s[i].s);var p=new ko(h+1),v=Vo(r[c-1],p,0);if(v>t){i=0;var g=0,_=v-t,f=1<<_;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n>i;++i){var m=s[i].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=s[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=s[i].s;p[b]==t&&(--p[b],++g)}v=t}return[new wo(p),v]},Vo=function(e,t,r){return-1==e.s?Math.max(Vo(e.l,t,r+1),Vo(e.r,t,r+1)):t[e.s]=r},jo=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new ko(++t),i=0,n=e[0],s=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[r.subarray(0,i),t]},Go=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},Qo=function(e,t,r){var i=r.length,n=Ho(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;i>s;++s)e[n+s+4]=r[s];return 8*(n+4+i)},Ko=function(e,t,r,i,n,s,o,a,l,u,c){Uo(t,c++,r),++n[256];for(var d=zo(n,15),h=d[0],p=d[1],v=zo(s,15),g=v[0],_=v[1],f=jo(h),m=f[0],y=f[1],b=jo(g),S=b[0],w=b[1],k=new ko(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var E=zo(k,7),T=E[0],x=E[1],I=19;I>4&&!T[xo[I-1]];--I);var M,R,P,F,L=u+5<<3,A=Go(n,Do)+Go(s,No)+o,O=Go(n,h)+Go(s,g)+o+14+3*I+Go(k,T)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return Qo(t,c,e.subarray(l,l+u));if(Uo(t,c,1+(A>O)),c+=2,A>O){M=Oo(h,p,0),R=h,P=Oo(g,_,0),F=g;var D=Oo(T,x,0);for(Uo(t,c,y-257),Uo(t,c+5,w-1),Uo(t,c+10,I-4),c+=14,C=0;I>C;++C)Uo(t,c+3*C,T[xo[C]]);c+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Uo(t,c,D[H=31&q[C]]),c+=T[H],H>15&&(Uo(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}else M=Bo,R=Do,P=qo,F=No;for(C=0;a>C;++C)if(i[C]>255){var H;Wo(t,c,M[257+(H=i[C]>>>18&31)]),c+=R[H+257],H>7&&(Uo(t,c,i[C]>>>23&31),c+=Eo[H]);var U=31&i[C];Wo(t,c,P[U]),c+=F[U],U>3&&(Wo(t,c,i[C]>>>5&8191),c+=To[U])}else Wo(t,c,M[i[C]]),c+=R[i[C]];return Wo(t,c,M[256]),c+R[256]},Zo=new Co([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yo=function(){for(var e=new Co(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Jo=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=Yo[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},Xo=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new wo(i+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(i,a.length-n),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=Qo(l,u,e.subarray(c,d)):(l[c]=true,u=Qo(l,u,e.subarray(c,o)))}else{for(var h=Zo[t-1],p=h>>>13,v=8191&h,g=(1<<r)-1,_=new ko(32768),f=new ko(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Co(25e3),w=new ko(288),k=new ko(32),C=0,E=0,T=(c=0,0),x=0,I=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(_[R]=P,f[M]=R,c>=x){var F=o-c;if((C>7e3||T>24576)&&F>423){u=Ko(e,l,0,S,w,k,E,T,I,c-I,u),T=C=E=0,I=c;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=v,N=R-P&32767;if(F>2&&M==b(c-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,c),H=Math.min(258,F);q>=N&&--D&&R!=P;){if(e[c+A]==e[c+A-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var W=Math.min(N,U-2),z=0;for(L=0;W>L;++L){var V=c-N+L+32768&32767,j=V-_[V]+32768&32767;j>z&&(z=j,P=V)}}}N+=(R=P)-(P=_[R])+32768&32767}if(O){S[T++]=268435456|Ro[A]<<18|Po[O];var G=31&Ro[A],Q=31&Po[O];E+=Eo[G]+To[Q],++w[257+G],++k[Q],x=c+A,++C}else S[T++]=e[c],++w[e[c]]}}u=Ko(e,l,true,S,w,k,E,T,I,c-I,u)}return $o(a,0,i+Ho(u)+n)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,i)},ea=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},ta=function(e,t){var r=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&&ea(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}},ra=function(e){return 10+(e.filename&&e.filename.length+1||0)};function ia(e,t){void 0===t&&(t={});var r=Jo(),i=e.length;r.p(e);var n=Xo(e,t,ra(t),8),s=n.length;return ta(n,t),ea(n,s-8,r.d()),ea(n,s-4,i),n}function na(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new wo(e.length+(e.length>>>1)),n=0,s=function(e){i[n++]=e},o=0;r>o;++o){if(n+5>i.length){var a=new wo(n+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?s(l):2048>l?(s(192|l>>>6),s(128|63&l)):l>55295&&57344>l?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return $o(i,0,n)}function sa(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}class oa{constructor(e,t){var r,i;void 0===t&&(t={}),this._loggedTracker={},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,n,s,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(n=e.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(o=e.texts)?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);t.attributes&&(t.attributes=t.attributes.filter((e=>{var t=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t[0])&&e})));var i=this._numberOfChanges(t);return 0!==i||r===i?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new xe({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Hr})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}Br.DEBUG=!1,Br.LIB_VERSION="1.421.1",Br.LIB_NAME="web";class aa{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(Wn,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Wn);return se(t=r)&&le(t.sessionId)&&he(t.size)&&r.sessionId===e?r.size:0}}function la(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<Te(100*t,0,100,Hr)}function ua(e){return"$survey_response_"+e}function ca(e,t){if(!t)return null;var r=e[ua(t)];return ie(r)?[...r]:r}function da(e,t){void 0===e&&(e={});var r={};return t.questions.forEach((t=>{if(!ae(t.originalQuestionIndex)){var i,n=0===(i=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+i,s=ca(e,t.id);ae(s)||(r[n]=s)}})),g({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:ca(e,t.id)})))},e,r)}function ha(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function pa(e){return"string"==typeof e&&e.trim()?e.trim():null}function va(e){return e.toLowerCase()}function ga(e,t,r){if(!e||!t)return null;var i=va(t),n=Object.keys(e).find((e=>va(e)===i));if(n)return null==r||r.debug("Found exact translation match: "+n),n;if(i.includes("-")){var s=i.split("-")[0],o=Object.keys(e).find((e=>va(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var _a=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function fa(e,t,r){var i,n=ga(e.translations,t,r),s=g({},e),o=!1;if(n){var a,l=null==(a=e.translations)?void 0:a[n];if(l)if(null==r||r.info("Applying survey-level translation for language: "+n),ae(l.name)||(s.name=l.name,o=!0),s.appearance){var u=g({},s.appearance);for(var c of _a){var d=l[c];ae(d)||(u[c]=d,o=!0)}s.appearance=u}else(function(e){return _a.some((t=>!ae(e[t])))})(l)&&(o=!0)}var h=e.questions.map((e=>function(e,t,r){var i,n=ga(e.translations,t,r);if(!n)return{question:e,matchedKey:null,hasChanges:!1};var s=null==(i=e.translations)?void 0:i[n];if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=g({},e),a=!1;return ae(s.question)||(o.question=s.question,a=!0),ae(s.description)||(o.description=s.description,a=!0),ae(s.buttonText)||(o.buttonText=s.buttonText,a=!0),"link"in o&&!ae(s.link)&&(o.link=s.link,a=!0),"lowerBoundLabel"in o&&!ae(s.lowerBoundLabel)&&(o.lowerBoundLabel=s.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!ae(s.upperBoundLabel)&&(o.upperBoundLabel=s.upperBoundLabel,a=!0),"choices"in o&&function(e){return ie(e.choices)}(s)&&(o.choices=s.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,r))),p=h.map((e=>e.question)),v=h.some((e=>e.hasChanges)),_=null;return n||(_=(null==(i=h.find((e=>e.matchedKey)))?void 0:i.matchedKey)||null),v&&(s.questions=p,o=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:s,matchedKey:o?n||_:null}}function ma(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function ya(e){var t;return ma(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var ba=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},Sa=e=>e.toLowerCase(),wa={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=>ba(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!ba(t,e))))),icontains:(e,t)=>t.map(Sa).some((t=>e.map(Sa).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Sa).every((t=>e.map(Sa).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r<parseFloat(e)))}))};function ka(e,t){return!e||Object.entries(e).every((e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(null==i)return!1;var n=wa[r.operator];return!!n&&n(r.values,[String(i)])}))}function Ca(e,t,r){return ei({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var Ea=new Set(["is_not","not_icontains","not_regex"]);function Ta(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,n=null==i?void 0:i[e.key],s=e.operator||"exact";if(ae(n)||ce(n))return Ea.has(s);var o=wa[s];return!!o&&!ae(e.value)&&!ce(e.value)&&o(ie(e.value)?e.value.map(String):[String(e.value)],ie(n)?n.map(String):[String(n)])}))}var xa=$r("[SessionRecording]");function Ia(e,t){return t?e:"!"+e}function Ma(e,t){return e===t||e!=="!"+t&&null}class Ra{constructor(e,t,r,i,n,s,o){this._sampleRate=null,this._recordingStatusFunction=fo,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=he(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new ao([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=_o):(this._triggerStatusMatcher=new lo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=fo),this._instance.register_for_session({[Is]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,((e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()}))}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return he(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&de(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){xa.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!he(n))return null==(r=this._instance.persistence)||r.unregister(On),void(null==(i=this._instance.persistence)||i.unregister(Mn));var s=this._instance.get_property(On),o=this._instance.get_property(Mn),a=Ma(s,e),l=he(o)&&o!==n,u=ae(o)&&s===e,c=l||u||!ve(a),d=c?la(e,n):a;c&&(d?this._reportStarted("sampled"):xa.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[On]:Ia(e,d),[Mn]:ce(o)&&s===e?null:n})}ensureSamplingDecision(e){if(he(this._sampleRate)){var t=this._instance.get_property(On);ve(Ma(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Bn),null==(t=this._instance.persistence)||t.unregister(Nn),null==(r=this._instance.persistence)||r.unregister(On),null==(i=this._instance.persistence)||i.unregister(Mn),null==(n=this._instance.persistence)||n.unregister(Dn)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===to}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter((e=>e.status===to)).map((e=>e.label))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class Pa{constructor(e,t,r,i,n){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Is]:"v2_trigger_groups",[Ms]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):xa.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return Js;if(e.urlTriggerMatching.urlBlocked)return Qs;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return zs;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===eo){var a=s.group.id,l=r.get(a);ae(l)?Hr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===to&&(i=!0)}return n?Vs:i?Gs:zs}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;he(i)&&(ce(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var n=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var s=function(i){i.checkUrlTriggerConditions(t,r,(t=>{n._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),n.updateActiveTriggers(e),n._onTriggerActivated(t))}),e)};for(var o of this._triggerGroupMatchers)s(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return xa.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var n=function(r){r.checkEventTriggerConditions(e.event,(n=>{if(i._checkGroupLevelProperties(r,e.properties)){var s=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(Xn),a=s.some((t=>!t.properties||0===t.properties.length||Ta(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t),i._onTriggerActivated(n))}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){xa.error("Could not activate event trigger for trigger groups",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,n=i.id,s=i.sampleRate,o=$n+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(se(a)){var h=a.sessionId,p=a.sampleRate,v=a.sampled;u="string"==typeof h&&h!==e,c=he(p)&&p!==s,l=h===e&&he(p)&&p===s&&ve(v)?v:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var g=u||c||d||!ve(l),_=g?la(e+n,s):l;g&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:_}),this._triggerGroupSamplingResults.set(n,_),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:s,sampled:_}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(On),null==(t=this._instance.persistence)||t.unregister(Mn),null==(r=this._instance.persistence)||r.unregister(Dn),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister(qn+a),null==(s=this._instance.persistence)||s.unregister(Hn+a),null==(o=this._instance.persistence)||o.unregister($n+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);s&&t.push({id:n,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Ts]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===to)return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap((t=>t.triggerStatusNoSideEffects(e)!==to?[]:t.getPendingTriggerConditions(e).map((e=>'trigger group "'+t.group.name+'": '+e))))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||Ta(r,t,this._instance.get_property(Xn))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new go(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}var Fa=e=>{if(i){try{for(var t=e+"=",r=i.cookie.split(";").filter((e=>e.length)),n=0;r.length>n;n++){for(var s=r[n];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},La="https?://(.*)",Aa=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oa=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Aa],Da="<masked>",Na=["li_fat_id"];function Ba(e,t,r){if(!i)return{};var n,s=t?[...Aa,...r||[]]:[],o=qa(ni(i.URL,s,Da),e),a=(n={},Wr(Na,(function(e){var t=Fa(e);n[e]=t||null})),n);return zr(a,o)}function qa(e,t){var r=Oa.concat(t||[]),i={};return Wr(r,(function(t){var r=ii(e,t);i[t]=r||null})),i}function Ha(e){var t=function(e){return e?0===e.search(La+"google.([^/?]*)")?"google":0===e.search(La+"bing.com")?"bing":0===e.search(La+"yahoo.com")?"yahoo":0===e.search(La+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",n={};if(!ce(t)){n.$search_engine=t;var s=i?ii(i.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function $a(){return navigator.language||navigator.userLanguage}var Ua="$direct";function Wa(){return(null==i?void 0:i.referrer)||Ua}function za(e,t,r){void 0===r&&(r=!1);var i=e?[...Aa,...t||[]]:[],s=r?Ot(null==n?void 0:n.href):null==n?void 0:n.href,o=null==s?void 0:s.substring(0,1e3);return{r:Wa().substring(0,1e3),u:o?ni(o,i,Da):void 0}}function Va(e,t){var r;void 0===t&&(t=!1);var i=e.r,n=e.u,s=t?Ot(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==Ua?Ua:null==(r=ti(i))?void 0:r.host};if(s){o.$current_url=s;var a=ti(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=qa(s);zr(o,l)}if(i){var u=Ha(i);zr(o,u)}return o}function ja(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ga(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Qa=1e5,Ka="https://schema.org",Za=[],Ya="actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),Ja="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Xa="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),el="Accommodation AdministrativeArea Country Place State".split(" "),tl={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:Ja,publisher:Xa},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Za},Offer:{seller:Xa},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Person:{},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Xa,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Xa,areaServed:el,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Za}},rl={},il=[[Ja,rl],["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),tl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),tl.Event],[Xa,tl.Organization],[el,tl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),tl.Product],["AggregateRating EmployerAggregateRating Rating".split(" "),rl]],nl="AlignmentObject BedDetails Certification ContactPoint CreditCard DefinedRegion EducationalOccupationalCredential EntryPoint GeoCoordinates GeoShape InteractionCounter JobPosting LocationFeatureSpecification MathSolver MemberProgram MemberProgramTier MerchantReturnPolicy MerchantReturnPolicySeasonalOverride MonetaryAmount NutritionInformation OccupationalExperienceRequirements OfferShippingDetails OpeningHoursSpecification PeopleAudience PostalAddress PriceSpecification PropertyValue QuantitativeValue ServicePeriod ShippingConditions ShippingDeliveryTime ShippingRateSettings ShippingService SpeakableSpecification Thing UnitPriceSpecification".split(" ");function sl(e,t){return te.call(e,t)?e[t]:void 0}function ol(e){var t=typeof e;return ce(e)||"string"===t||"number"===t||"boolean"===t}function al(e){return ol(e)||ie(e)&&e.every(ol)?e:void 0}function ll(e){if(te.call(tl,e))return tl[e];for(var t of il){var r=t[1];if(t[0].includes(e))return r}return nl.includes(e)?rl:void 0}function ul(e,t){if(!se(e))return null;var r=sl(e,"@type"),i=function(e){return("string"==typeof e?[e]:ie(e)?e:[]).filter((e=>"string"==typeof e)).map((e=>e.replace(/^https?:\/\/schema\.org\//,""))).filter((e=>!!ll(e)))}(r).filter((e=>!t||!t.length||t.includes(e)));if(!i.length)return null;var n={"@type":"string"==typeof r?i[0]:i},s=al(sl(e,"@id"));for(var o of(ae(s)||(n["@id"]=s),Ya)){var a=al(sl(e,o));ae(a)||(n[o]=a)}for(var l of i){var u=ll(l),c=function(){var t=sl(e,d),r=u[d];if(!0===r){var i=al(t);ae(i)||(n[d]=i)}else if(ie(t)){var s=t.map((e=>ul(e,r))).filter(se);s.length&&(n[d]=s)}else{var o=ul(t,r);o&&(n[d]=o)}};for(var d of Object.keys(u))c()}return n}function cl(e){if(!se(e))return null;var t=sl(e,"@context");if("string"!=typeof t||!/^https?:\/\/schema\.org\/?$/.test(t))return null;var r=ul(e);if(r)return g({"@context":Ka},r);var i=sl(e,"@graph");if(!ie(i))return null;var n=i.map((e=>ul(e))).filter(se);return n.length?{"@context":Ka,"@graph":n}:null}function dl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function hl(e,t,r){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some((e=>(t.lastIndex=0,t.test(e)))))return!0;try{return!!r&&e.matches(r)}catch(e){return!1}}function pl(e){return dl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(dl)}function vl(e){return ae(e)?void 0:Math.round(e)}function gl(e){return se(e)?e.network_timing:e}var _l,fl,ml=36e5,yl=943718.4,bl="[SessionRecording]",Sl=$r(bl),wl=[m.MouseMove,m.MouseInteraction,m.Scroll,m.ViewportResize,m.Input,m.TouchMove,m.MediaInteraction,m.Drag],kl=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Cl(){var e;return null==h||null==(e=h.__PosthogExtensions__)?void 0:e.rrweb}function El(){var e;return null==(e=Cl())?void 0:e.record}function Tl(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,mo())}}function xl(e){return sa(ia(na(Tl(e))))}function Il(e){return Ml.apply(this,arguments)}function Ml(){return(Ml=v((function*(e){var t=Tl(e),r=yield N(t,Br.DEBUG,{rethrow:!0});return sa(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Rl="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Pl=!1;function Fl(e){return ie(e)&&0===e.length?_l=null!=_l?_l:xl([]):xl(e)}function Ll(e){return Al.apply(this,arguments)}function Al(){return(Al=v((function*(e){return ie(e)&&0===e.length?_l||(fl=null!=fl?fl:Il([]).then((e=>(_l=e,e))).catch((e=>{throw _l=void 0,fl=void 0,e}))):Il(e)}))).apply(this,arguments)}function Ol(e){return Rl&&!Pl&&function(e){return e.type===f.FullSnapshot||e.type===f.IncrementalSnapshot&&(e.data.source===m.Mutation||e.data.source===m.StyleSheetRule)}(e)}function Dl(e){return{event:e,size:bo(e)}}function Nl(e,t){return g({},e,{data:t,cv:"2024-10"})}function Bl(e,t){return g({},e,{cv:"2024-10",data:g({},e.data,t)})}function ql(e){try{if(e.type===f.FullSnapshot)return Dl(Nl(e,xl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation)return Dl(Bl(e,{texts:Fl(e.data.texts),attributes:Fl(e.data.attributes),removes:Fl(e.data.removes),adds:Fl(e.data.adds)}));if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule)return Dl(Bl(e,{adds:e.data.adds?xl(e.data.adds):void 0,removes:e.data.removes?xl(e.data.removes):void 0}))}catch(e){Sl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:yo(e)}}function Hl(){return Hl=v((function*(e){try{if(e.type===f.FullSnapshot)return Dl(Nl(e,yield Il(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation){var t=yield Promise.all([Ll(e.data.texts),Ll(e.data.attributes),Ll(e.data.removes),Ll(e.data.adds)]);return Dl(Bl(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule){var r=yield Promise.all([e.data.adds?Il(e.data.adds):void 0,e.data.removes?Il(e.data.removes):void 0]);return Dl(Bl(e,{adds:r[0],removes:r[1]}))}}catch(t){return A(t)&&(Pl=!0),Sl.error("could not compress event asynchronously - trying synchronous compression",t),ql(e)}return{event:e,size:yo(e)}})),Hl.apply(this,arguments)}function $l(e,t){return e.type===f.Custom&&e.data.tag===t}function Ul(e){return $l(e,"sessionIdle")}function Wl(e){return $l(e,"$session_ending")}function zl(e){return $l(e,"$session_starting")}class Vl{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(bl+" must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Ma(this._instance.get_property(On),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return he(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,n,s;if(r&&(e!==this._sessionId||t!==this._windowId)){var o,a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(o=this._flushedSizeTracker)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(Un),this._maxDepthExceeded=!1,null==(n=Cl())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){var c=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(c)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(s=this._strategy)||s.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Dn])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return he(r)&&he(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!he(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return he(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!ce(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Dn]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==Gs?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&(this._holdFlushUntilInteraction=!1),this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=i&&i.visibilityState&&("visible"===i.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+i.visibilityState,{}))},this._instance=e,this._documentWasEverVisible=null==t||t;var r=this._sessionManager.checkAndGetSessionAndWindowId(),n=r.windowId;this._sessionId=r.sessionId,this._windowId=n,this._linkedFlagMatching=new po(this._instance),this._urlTriggerMatching=new ho(this._instance),this._eventTriggerMatching=new vo(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||Sl.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new aa(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,n,s,o,a,l,u=null==(e=this._remoteConfig)?void 0:e.masking,c={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector,maskAllElementAttributes:null==(n=this._instance.config.session_recording)?void 0:n.maskAllElementAttributes},d=null!==(s=null==c?void 0:c.maskAllInputs)&&void 0!==s?s:null==u?void 0:u.maskAllInputs,h=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,p=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,v=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return ae(d)&&ae(h)&&ae(p)&&ae(v)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:v}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!de(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter((e=>{var i=null==r?void 0:r[e],n=t[e];return!ae(i)&&i!==n}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,Sl.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector,maskAllElementAttributes:null==r?void 0:r.maskAllElementAttributes},project:t}))}}}get _canvasResolutionScale(){var e;return Te(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,$r("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,n,s,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,c=null!==(i=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:Te(c,0,12,$r("canvas recording fps"),4),quality:Te(d,0,1,$r("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,n={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),a=gl(this._instance.config.capture_performance),l=gl(null==i?void 0:i.capturePerformance),u=!!(ve(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,r=[],i=null==(e=h.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this._isConsoleLogCaptureEnabled&&r.push(i());var s=null==(t=h.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&ne(s))if(!Xr.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){var o=ne(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(s(((e,t,r)=>{var i,n={payloadSizeLimitBytes:nn.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...nn.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...nn.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=rn(n),e=>(null!=e&&e.requestBody&&(e.requestBody=cn(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=cn(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t,r)=>{var i;if(null==r||!r(e.name)){var n=ti(e.name),s=0===t.indexOf("http")?null==(i=ti(t))?void 0:i.pathname:t;"/"===s&&(s="");var o=null==n?void 0:n.pathname.replace(s||"","");if(!(n&&o&&un.some((e=>0===o.indexOf(e)))))return e}})((ln((i=t).requestHeaders),ln(i.responseHeaders),i),e.api_host,r));var i},c=ne(e.session_recording.maskNetworkRequestFn);return c&&ne(e.session_recording.maskCapturedNetworkRequestFn)&&Hr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var r=e.session_recording.maskNetworkRequestFn({url:t.name});return!r&&t.isInitial?r:g({},t,{name:null==r?void 0:r.url})}),n.maskRequestFn=ne(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r=u(t);if(r){var i=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,n=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return de(n)&&i?(hn.add(i),i):null!=n?n:void 0}}:e=>function(e){if(!ae(e))return e.requestBody=dn(e.requestBody,"Request"),e.responseBody=dn(e.responseBody,"Response"),e}(u(e)),g({},nn,n,{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else Sl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Ot(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Ot(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Aa,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(ni(r,i,Da))}_maskUrl(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,i=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(t.maskNetworkRequestFn){var n=t.maskNetworkRequestFn({url:e});return null==n?void 0:n.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):Sl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(kl((()=>El().addCustomEvent(e,t))))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{var t=El();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e){void 0===e&&(e=!1),Promise.resolve().then((()=>{var t;return null==(t=this._jsonLdCapture)?void 0:t.scan(e)}))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;var t=new URL(e.location.href),r=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==r&&(this._lastHref=r,this._tryAddCustomEvent("$url_changed",{href:r}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)}))}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(kl((()=>El().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return he(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null==(e=this._jsonLdCapture)||e.scan(),clearInterval(this._fullSnapshotTimer),Sl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null==(e=this._jsonLdCapture)||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Sl.info("recording resumed"))}_activateTrigger(e,t){var r;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===e?Nn:Bn]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(In);if(e){var t;try{t=se(e)?e:JSON.parse(e)}catch(e){return void Sl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,n=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>ml)return Sl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(In))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(t){var r,n,s=this._remoteConfig;if(s){this.isStarted||(this._holdFlushUntilInteraction=!1!==this._isIdle&&!this._suppressNextFreshStartHold,this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=this._holdFlushUntilInteraction,this._heldBufferOverflowed=!1),this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var o=this._sessionManager.checkAndGetSessionAndWindowId(),a=o.windowId;this._sessionId=o.sessionId,this._windowId=a,null==(r=this._instance.persistence)||r.unregister(Un),null!=s&&s.endpoint&&(this._endpoint=null==s?void 0:s.endpoint),this._strategy=2===(null==s?void 0:s.version)&&(null==s?void 0:s.triggerGroups)&&s.triggerGroups.length>0?new Pa(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Ra(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(s),null==(n=this._removeEventTriggerCaptureHook)||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(Rn,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Rn)})),this._checkOverride(Pn,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Pn)})),this._checkOverride(Ln,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ln)})),this._checkOverride(Fn,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Fn)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Yr(e,"beforeunload",this._onBeforeUnload),Yr(e,"pagehide",this._onPageHide),Yr(e,"offline",this._onOffline),Yr(e,"online",this._onOnline),Yr(i,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&ne(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&ne(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",(()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId(((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)}))})):ne(this._sessionManager.on)||Sl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),de(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Sl.error("Could not add $pageview to rrweb session",e)}}))),this.status===js&&this._reportStarted(t||"recording_initialized"))}else Sl.info("remote config must be stored in persistence before recording can start")}_teardown(){var t,r,n,s,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==i||i.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(t=this._removePageViewCaptureHook)||t.call(this),this._removePageViewCaptureHook=void 0,null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=void 0,null==(n=this._onSessionIdListener)||n.call(this),this._onSessionIdListener=void 0,null==(s=this._onSessionIdleResetForcedListener)||s.call(this),this._onSessionIdleResetForcedListener=void 0,null==(o=this._forceIdleSessionIdListener)||o.call(this),this._forceIdleSessionIdListener=void 0,null==(a=this._strategy)||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t,r;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._jsonLdCapture)||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1,null==(r=this._stopRrweb)||r.call(this),this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch((()=>{})).then((()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._teardown(),Sl.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),Sl.info("stopped")})),!0}stop(){this._stopRecordingProducers(),this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),Sl.info("stopped"))}_restartForSessionIdChange(e){var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,null==(t=Cl())||null==t.resetSnapshotCostState||t.resetSnapshotCostState(),this.start("session_id_changed"),this._holdFlushUntilInteraction=e,this._heldEpochShipsOnUnload=!1}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard(){this._clearBuffer(),this._teardown(),Sl.info("discarded")}_captureProcessedEvent(e,t,r,i,n){var s={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:n};this.status!==zs?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(s)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Sl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=Cl())||null==e.getLastSnapshotCost?void 0:e.getLastSnapshotCost();t&&t!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=t,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=t.durationMs||(this._slowestFullSnapshot=t),500>t.durationMs||Sl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(t.durationMs),stylesheetMs:Math.round(t.stylesheetMs),nodeCount:t.nodeCount,cssRuleCount:t.cssRuleCount,nonDeferrableCssRuleCount:t.nonDeferrableCssRuleCount,deferredStylesheetCount:t.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){e.type!==f.FullSnapshot?e.type===f.IncrementalSnapshot&&(ae(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,Sl.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter((t=>t!==e))}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.compressionEnabled?ql(e.event):{event:e.event,size:yo(e.event)};this._captureQueuedCompressionEvent(e,t.event,t.size)}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach((e=>{this._processQueuedCompressionEventSync(e)}))}_enqueueCompression(e,t,r,i){var n=this,s={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(s),this._queuedCompressionEvents+=1;var o=function(){var r=v((function*(){try{if(s.processed)return;var r,i;try{var o=t?Ol(e)?yield function(e){return Hl.apply(this,arguments)}(e):ql(e):{event:e,size:yo(e)};r=o.event,i=o.size}catch(t){Sl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=yo(e)}n._captureQueuedCompressionEvent(s,r,i)}finally{n._finishQueuedCompressionEvent(s)}}));return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(o):o()}onRRwebEmit(e){var t,r,i,n,s,o,a,l,u;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&se(e))){if(e.type===f.Meta){var c=this._maskReplayUrl(e.data.href);if(this._lastHref=c,!c)return;e.data.href=c}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,(()=>this._pauseRecording()),(()=>this._resumeRecording()),((e,t)=>this._activateTrigger(e,t))),!this._urlTriggerMatching.urlBlocked||function(e){return e.type===f.Custom&&"recording paused"===e.data.tag}(e)){var d,h,p;e.type===f.FullSnapshot&&(null!=(d=Cl())&&null!=d.wasMaxDepthReached&&d.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then((()=>this._safeTrackFullSnapshotCost())),this._scheduleFullSnapshot(),null==(h=this._mutationThrottler)||h.reset(),null==(p=this._instance.persistence)||p.register_once({[Un]:e.timestamp},void 0));var v=e.type===f.FullSnapshot&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));v&&this._clearBufferBeforeMostRecentMeta();var g=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(g){var _=function(e){var t=e;if(t&&se(t)&&6===t.type&&se(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(g),y=function(e){return Wl(e)?e.data.payload:null}(_),b=function(e){return zl(e)?e.data.payload:null}(_),S=function(e){return Ul(e)?e.data.payload:null}(_);y||b?null!=y&&y.lastActivityTimestamp&&(_.timestamp=y.lastActivityTimestamp):null!=S&&S.sessionId||this._updateWindowAndSessionIds(_),e.type===f.FullSnapshot&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var w=null!==(i=null!==(n=null!==(s=null==y?void 0:y.currentSessionId)&&void 0!==s?s:null==b?void 0:b.nextSessionId)&&void 0!==n?n:null==S?void 0:S.sessionId)&&void 0!==i?i:this._sessionId,k=null!==(o=null!==(a=null!==(l=null==y?void 0:y.currentWindowId)&&void 0!==l?l:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==S?void 0:S.windowId)&&void 0!==o?o:this._windowId;if(!0!==this._isIdle||function(e){return Ul(e)||Wl(e)||zl(e)}(_)){_.type===f.FullSnapshot&&(this._eventsDroppedWhileIdle=0),S&&(_.timestamp=S.lastActivityTimestamp+S.threshold);var C=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,v?this._scheduleJsonLdScan(!0):C||this._scheduleJsonLdScan();var E=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(this._queuedCompressionEvents>0||E&&Ol(_))this._enqueueCompression(_,E,w,k);else{var T=E?ql(_):{event:_,size:yo(_)};this._captureProcessedEvent(_,T.event,T.size,w,k)}}else(function(e){return e.type===f.FullSnapshot||e.type===f.Meta||e.type===f.IncrementalSnapshot&&e.data.source!==m.CanvasMutation})(_)&&this._eventsDroppedWhileIdle++}else!0===this._isIdle&&this._eventsDroppedWhileIdle++}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):zs}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[On]:this.sessionId,[Mn]:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t,r=null==e||null==(t=e.location)?void 0:t.href;if(!r)return;var i=this._maskReplayUrl(r);if(!i)return;return new URL(i).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every((e=>(null==e?void 0:e.type)===f.Custom&&!Wl(e)&&!zl(e)))}_describePendingTriggerConditions(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if(e!==Gs)return ae(this._lastLoggedBufferingReason)||this._instance.register_for_session({[xs]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return ae(this._lastLoggedBufferingReason)||this._instance.register_for_session({[xs]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[xs]:t}),Sl.info("buffering: "+r))}_flushBuffer(){var e;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>yl?this._clearBuffer():this._buffer;var t=this._buffer;null==(e=this._strategy)||e.ensureSamplingDecision(this.sessionId);var r=this._isBelowMinimumDuration(),i=this.status;if(this._maybeLogBufferingReason(i),i===Gs||i===Qs||i===zs||r)return this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==t)return this._buffer;if(t.data.length>0){var n,s=this._currentMaskedHostname();So(t).forEach((e=>{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Br.LIB_NAME,$lib_version:Br.LIB_VERSION,$snapshot_host:s})})),null==(n=this._strategy)||n.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,n=this._buffer.sessionId!==i;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>yl){var s=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==s)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+r>yl)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1],i=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(this._buffer.data[t].type===f.Meta){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce(((e,t)=>e+t),0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ps]:e}),Sl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",g({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==wl.indexOf(null==(t=e.data)?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());var r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var i="unknown"===this._isIdle;this._isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}var n=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),s=n.windowId,o=n.sessionId,a=this._sessionId!==o,l=this._windowId!==s;if(this._windowId=s,this._sessionId=o,a||l){var u=a&&!1!==this._isIdle;u&&(this._isIdle="unknown"),this._restartForSessionIdChange(u)}else if(t&&this._releaseHoldAndFlush(),r){var c,d=["sampled","active"].includes(this.status)||(null==(c=this._strategy)?void 0:c.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&d&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,r,i,n,s,o,a,l,u=this._sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp,c=null==(e=Cl())||null==e.getDeferredStylesheetStats?void 0:e.getDeferredStylesheetStats();return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:u,$sdk_debug_replay_flushed_size:null==(t=this._flushedSizeTracker)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:vl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:vl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(n=this._slowestFullSnapshot)?void 0:n.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(s=this._slowestFullSnapshot)?void 0:s.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null==(o=this._slowestFullSnapshot)?void 0:o.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==c?void 0:c.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==c?void 0:c.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==c?void 0:c.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:vl(null==c?void 0:c.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:vl(null==c?void 0:c.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:vl(null==(a=Cl())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=Cl())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_rrweb_attached:!!this._stopRrweb,$sdk_debug_rrweb_start_attempted:this._rrwebStartAttempted}}_startRecorder(){var t;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var r,n,s,o,a={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},l=this._instance.config.session_recording;for(var u of Object.entries(l||{})){var c=u[0],d=u[1];if(c in a)if("maskInputOptions"===c)a.maskInputOptions=g({password:!0},d);else if("sampling"===c){var h=null!=d?d:{},p={};ae(h.mousemove)||(p.mousemove=h.mousemove),ae(h.mouseInteraction)||(p.mouseInteraction=h.mouseInteraction),a.sampling=p}else a[c]=d}!0===(null==l?void 0:l.captureJsonLd)&&!0!==a.slimDOMOptions&&"all"!==a.slimDOMOptions&&(a.slimDOMOptions=g({},a.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(a.recordCanvas=!0,a.sampling=g({},a.sampling,{canvas:this._canvasRecording.fps}),a.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},a.canvasResolutionScale=this._canvasResolutionScale,a.canvasMasking={configured:()=>{var e;return ne(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(ne(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,Sl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(a.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,a.maskTextSelector=null!==(n=this._masking.maskTextSelector)&&void 0!==n?n:void 0,a.blockSelector=null!==(s=this._masking.blockSelector)&&void 0!==s?s:void 0,a.maskAllElementAttributes=null!==(o=this._masking.maskAllElementAttributes)&&void 0!==o&&o),a.maskAllElementAttributes&&a.maskAttributeFn&&(a.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,Sl.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();var v=El();if(v){this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new oa(v,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";Sl.info(r,{node:t}),this.log(bl+" "+r,"warn")}});var _=this._gatherRRWebPlugins();if(this._stopRrweb=v(g({emit:e=>{this.onRRwebEmit(e)},plugins:_,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Sl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},a)),!this._stopRrweb)return this._rrwebError=!0,void Sl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==l?void 0:l.captureJsonLd)&&i&&null!=e&&e.MutationObserver&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,r){var i=new WeakMap,n=r.getCaptureState||(()=>!0),s=Qa,o=t=>{try{var o=n();if(!s||!1===o||!t.isConnected||t.ownerDocument!==e||function(e,t){for(var r=e;r;){if(hl(r,t.blockClass,t.blockSelector)||hl(r,t.maskTextClass,t.maskTextSelector))return!0;var i=r.parentNode;r=r.parentElement||(i&&i.nodeType===i.DOCUMENT_FRAGMENT_NODE?i.host:null)}return!1}(t,r))return;var a=function(e){if(!e||e.length>Qa)return null;try{var t=JSON.parse(e),r=ie(t)?t.map(cl):cl(t);if(ce(r)||ie(r)&&(!r.length||r.some(ce)))return null;var i=JSON.stringify(r);return i.length>2e4?null:[r,i]}catch(e){return null}}(t.text);if(!a)return void i.delete(t);var l=a[0],u=a[1];if(ce(o))return void i.set(t,u);if(i.get(t)!==u){if(u.length>s)return void(s=0);r.emit(l)&&(i.set(t,u),s-=u.length)}}catch(e){return}};try{var a=new t((e=>{try{if(!s||!1===n())return;var t=e=>{for(var t of pl(e))o(t)};for(var r of e)if("childList"===r.type)dl(r.target)&&o(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&dl(i)&&o(i)}else"attributes"===r.type&&dl(r.target)&&o(r.target)}catch(e){return}}));return a.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t){void 0===t&&(t=!1),s&&!1!==n()&&pl(e.documentElement).forEach((e=>{t&&i.delete(e),o(e)}))},stop(){return a.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(i,e.MutationObserver,{blockClass:a.blockClass,blockSelector:a.blockSelector,maskTextClass:a.maskTextClass,maskTextSelector:a.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=ve(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:a,activePlugins:_.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Sl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}var jl,Gl=["type"],Ql=Object.defineProperty,Kl=(e,t,r)=>((e,t,r)=>t in e?Ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Zl=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Zl||{}),Yl=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Yl||{}),Jl=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Jl||{}),Xl=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Xl||{}),eu=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(eu||{}),tu=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(tu||{}),ru=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(ru||{});function iu(e,t){return-1!==e.indexOf(t)}var nu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},su={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},ou={};function au(e){if(ou[e])return ou[e];var t=function(e){var t,r,i=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in nu?nu[e]:void 0,n=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),s=e in su?su[e]:void 0,o=Boolean(s&&s.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(n&&o)return ou[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var c=u[e].prototype;return c?(function(e){return iu(e,"AppleWebKit")&&!iu(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),ou[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var lu={};function uu(e,t,r){var i,n=e+"."+String(r);if(lu[n])return lu[n].call(t);var s=au(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(lu[n]=o,o.call(t)):t[r]}var cu={};function du(e,t,r){var i=e+"."+String(r);if(cu[i])return cu[i].bind(t);var n=au(e)[r];return"function"!=typeof n?t[r]:(cu[i]=n,n.bind(t))}function hu(){return au("MutationObserver").constructor}function pu(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n={next:i},s=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return n.next.apply(this,t)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t];"function"==typeof r&&r.__rrweb_layer__;){var i=r.__rrweb_layer__;if(i.next===s)return void(i.next=n.next);r=i.next}else e[t]=n.next}}catch(e){return()=>{}}}var vu={childNodes:e=>uu("Node",e,"childNodes"),parentNode:e=>uu("Node",e,"parentNode"),parentElement:e=>uu("Node",e,"parentElement"),textContent:e=>uu("Node",e,"textContent"),contains:(e,t)=>du("Node",e,"contains")(t),getRootNode:e=>du("Node",e,"getRootNode")(),host:e=>e&&"host"in e?uu("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?uu("Element",e,"shadowRoot"):null,querySelector:(e,t)=>du("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>du("Element",e,"querySelectorAll")(t),mutationObserver:hu,patch:pu},gu=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0});function _u(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var fu=0,mu=6e4;function yu(){fu+=1}function bu(){return fu}function Su(e,t){return t!==fu||e>mu}var wu=0,ku=0,Cu=0,Eu=gu(),Tu=null,xu=null,Iu=[],Mu=0,Ru=0,Pu={slowestBatchMs:0},Fu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0},Lu=e=>e&&e>0?e:null;function Au(e){(wu+=1)>1||(Eu=gu(),Iu=[],Mu=0,xu=Lu(e),ku=_u(),Cu=fu)}function Ou(){return 0===wu?Tu||gu():(wu-=1)>0?Eu:(Eu.durationMs=_u()-ku,Eu.deferredStylesheetCount=Mu,Fu.deferredCount+=Mu,xu=null,Su(Eu.durationMs,Cu)?Eu:Tu=Eu)}var Du=32;function Nu(e,t,r){var i=e.length;if(r>=Du)return i;for(var n=0;e.length>n;n++){var s=e[n];try{var o=s.cssRules;if(o&&o.length)i+=Nu(o,t,r+1);else if(t&&s.styleSheet){var a=s.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=Nu(l,t,r+1))}}}catch(e){}}return i}function Bu(e){if(0!==wu){var t=Nu(e,null,0);Eu.cssRuleCount+=t,Ru>0&&(Eu.nonDeferrableCssRuleCount+=t)}}function qu(e){Ru+=1;try{return e()}finally{Ru-=1}}function Hu(e){wu>0&&(Eu.stylesheetMs+=e)}function $u(e){if(0===wu||null===xu)return!1;var t=Eu.cssRuleCount-Eu.nonDeferrableCssRuleCount;return t>=xu||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),Nu(t,r,0)}catch(e){return 0}}(e)>xu}function Uu(){Fu.failedCount+=1}function Wu(e){e>0&&(Fu.abandonedCount+=e)}function zu(e){return e.nodeType===e.ELEMENT_NODE}function Vu(e){var t=e&&"host"in e&&"mode"in e&&vu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&vu.shadowRoot(t)===e)}function ju(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Gu(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Qu(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}var Ku=0;function Zu(e){var t=0===Ku,r=t?_u():0;Ku+=1;try{var i=e.rules||e.cssRules;if(!i)return null;Bu(i);var n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),Gu(Array.from(i,(e=>Yu(e,n))).join(""))}catch(e){return null}finally{Ku-=1,t&&Hu(_u()-r)}}function Yu(e,t){var r;if(Xu(e)){var i;try{i=Zu(e.styleSheet)||Qu(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return gc(i,e.styleSheet.href)}catch(e){}return i}var n=e.cssText;return ec(e)&&e.selectorText.includes(":")&&(n=Ju(n)),t?gc(n,t):n}function Ju(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Xu(e){return"styleSheet"in e}function ec(e){return"selectorText"in e}var tc=/^-?[A-Za-z_][\w-]*$/,rc=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function ic(e){var t=[],r=!1,i=null,n=new Map;function s(e){var n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void s(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!n.importRule)return r=!0,void(i=e);o(t[t.length-1],n.importRule,e)}function o(e,t,r){var i;try{var n;try{n=r||Qu(t)}catch(e){n=t.cssText}try{n&&(null==(i=t.styleSheet)?void 0:i.href)&&(n=gc(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){s(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&Xu(r)){var i=n.get(r);return null===i?(e.parts.push(r.cssText),void(e.index+=1)):i?void t.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:r}):void o(e,r,null)}if(!function(e,r){try{var i=function(e){var t,r=e;if(!r.cssRules||0===r.cssRules.length)return null;if(r.media&&"string"==typeof r.media.mediaText)return"@media "+r.media.mediaText+" {";if(ec(e)){if("number"==typeof r.type&&1!==r.type)return null;var i=r.style?r.style.cssText:"";return e.selectorText+" {"+(i?" "+i:"")}if("containerName"in r)return"string"!=typeof r.containerQuery||r.containerName&&!tc.test(r.containerName)?null:"@container "+(r.containerName?r.containerName+" ":"")+r.containerQuery+" {";if("string"==typeof r.conditionText){var n="";try{n=(null==(t=e.constructor)?void 0:t.name)||""}catch(e){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?"@supports "+r.conditionText+" {":null}return"string"==typeof r.name?"keyText"in r.cssRules[0]?tc.test(r.name)?"@keyframes "+r.name+" {":null:""===r.name?"@layer {":rc.test(r.name)?"@layer "+r.name+" {":null:null}(e);if(null===i)return!1;var n=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?gc(i,n):i,fixColons:"sheet"===r.kind&&ec(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var s=r.cssText;"sheet"===e.kind&&ec(r)&&r.selectorText.includes(":")&&(s=Ju(s)),e.parts.push(e.sheetHref?gc(s,e.sheetHref):s),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;Bu(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var s=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:s,sheetHref:i,index:0,parts:[],importRule:null}),function(e,t){for(var r=[{sheet:t,rules:e,index:0}],i=function(){var e=r[r.length-1];if(e.index>=e.rules.length)return r.pop(),0;var t=e.rules[e.index];if(e.index+=1,!Xu(t)||n.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return n.set(t,null),0}if(!i||r.some((e=>e.sheet===i)))return 0;try{var s=i.rules||i.cssRules;if(!s)return 0;Bu(s);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(s);n.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(s,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var n=_u(),o=e>0?e:1;try{for(;!r&&o>0;){var l=t[t.length-1];if(l.rules.length>l.index){o-=1;try{a(l)}catch(e){s(null)}}else{var u=null;try{if("group"===l.kind){var c=l.prelude+l.parts.join("")+"}";u=l.fixColons?Ju(c):c}else u=Gu(l.parts.join(""))}catch(e){}s(u)}}}catch(e){r=!0,i=null}finally{Hu(_u()-n)}return r},text:()=>r?i:null,remainingRules(){if(r)return 0;var e=0;for(var i of t)e+=i.rules.length-i.index;return e}}}class nc{constructor(){Kl(this,"idNodeMap",new Map),Kl(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e))),zu(e)){var r=vu.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function sc(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,n=e.type,s=e.maskInputFn,o=e.value||"",a=n&&oc(n);return(r[i.toLowerCase()]||a&&r[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function oc(e){return e.toLowerCase()}var ac=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function lc(e){var t=e.element,r=e.name,i=e.value,n=e.maskAttributeFn,s=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==s&&s&&ac.has(oc(r))?i:"*".repeat(i.length):n?n(r,i,t):i:i}var uc="__rrweb_original__";function cc(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?oc(t):null}catch(e){return null}}var dc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,hc=/^(?:[a-z+]+:)?\/\//i,pc=/^www\..*/i,vc=/^(data:)([^,]*),(.*)/i;function gc(e,t){return(e||"").replace(dc,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(hc.test(l)||pc.test(l))return"url("+u+l+u+")";if(vc.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var c=t.split("/"),d=l.split("/");for(var h of(c.pop(),d))"."!==h&&(".."===h?c.pop():c.push(h));return"url("+u+c.join("/")+u+")"}))}var _c,fc,mc="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",yc=4096,bc=1e5,Sc=10,wc=new Map,kc=1,Cc=new RegExp("[^a-z0-9-_:]"),Ec=-2;function Tc(){return kc++}var xc=/^[^ \t\n\r\u000c]+/,Ic=/^[, \t\n\r\u000c]+/,Mc=new WeakMap;function Rc(e,t){return t&&""!==t.trim()?Pc(e,t):t}function Pc(e,t){var r=Mc.get(e);if(r||(r=e.createElement("a"),Mc.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Fc(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?mc:e}(e,t.maxBase64ImageLength):e}function Lc(e,t,r,i,n,s){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&n){var a=null==(o=n.sheet)?void 0:o.href;if(a)return a}var l=Rc(e,i);if(l.startsWith("data:")){if("img"===t&&n){var u=l;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(u=function(e,t,r,i){if(bc>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>yc||e.naturalHeight>yc)return t;var n=wc.get(t);if(n&&n.type===r&&n.quality===i)return n.result;try{var s=document.createElement("canvas");s.width=e.naturalWidth,s.height=e.naturalHeight;var o=s.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=s.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(wc.size>=Sc){var u=wc.keys().next().value;void 0!==u&&wc.delete(u)}return wc.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(n,l,s.type,s.quality)),Fc(u,s)}if("image"===t)return Fc(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=Rc(e,i);return"image"===t&&c.startsWith("data:")?Fc(c,s):c}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,n=e.exec(t.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Ic),t.length>r;){var s=i(xc);if(","===s.slice(-1))s=Rc(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=Rc(e,s);for(var a=!1;;){var l=t.charAt(r);if(""===l){n.push((s+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,n.push((s+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return n.join(", ")}(e,i):"style"===r?gc(i,Pc(e)):"object"===t&&"data"===r?Rc(e,i):i:Rc(e,i)}function Ac(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function Oc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&Oc(vu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&Oc(vu.parentNode(e),t,r)}function Dc(e,t,r,i){var n;if(zu(e)){if(!vu.childNodes(n=e).length)return!1}else{if(null===vu.parentElement(e))return!1;n=vu.parentElement(e)}try{if("string"==typeof t){if(i){if(n.closest("."+t))return!0}else if(n.classList.contains(t))return!0}else if(Oc(n,t,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(e){}return!1}function Nc(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var Bc=new Map;function qc(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function Hc(e){return null==e?"":e.toLowerCase()}var $c=50,Uc=!1,Wc=!1;function zc(e,t){var r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,c=t.inlineStylesheet,d=void 0===c||c,h=t.maskInputOptions,p=void 0===h?{}:h,v=t.maskTextFn,g=t.maskInputFn,_=t.maskAllElementAttributes,f=void 0!==_&&_,m=t.maskAttributeFn,y=t.slimDOMOptions,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=void 0!==w&&w,C=t.recordCanvas,E=void 0!==C&&C,T=t.canvasMaskingConfigured,x=t.onSerialize,I=t.onIframeLoad,M=t.iframeLoadTimeout,R=void 0===M?5e3:M,P=t.onIframeListenerRegistered,F=t.onStylesheetLoad,L=t.stylesheetLoadTimeout,A=void 0===L?5e3:L,O=t.keepIframeSrcFn,D=void 0===O?()=>!1:O,N=t.newlyAddedElement,B=void 0!==N&&N,q=t.depth,H=void 0===q?0:q,U=t.maxDepth,W=void 0===U?$c:U,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=W)return Wc=!0,Uc||(Uc=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=Dc(e,o,a,void 0===z)),wu>0&&(Eu.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,n=t.blockSelector,s=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,c=t.maskInputFn,d=t.maskAllElementAttributes,h=void 0!==d&&d,p=t.maskAttributeFn,v=t.dataURLOptions,g=void 0===v?{}:v,_=t.inlineImages,f=t.recordCanvas,m=t.canvasMaskingConfigured,y=t.keepIframeSrcFn,b=t.newlyAddedElement,S=void 0!==b&&b,w=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:ru.Document,childNodes:[],compatMode:e.compatMode}:{type:ru.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:ru.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s=t.doc,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskInputFn,c=t.maskAllElementAttributes,d=void 0!==c&&c,h=t.maskAttributeFn,p=t.dataURLOptions,v=void 0===p?{}:p,g=t.inlineImages,_=t.recordCanvas,f=t.canvasMaskingConfigured,m=t.keepIframeSrcFn,y=t.newlyAddedElement,b=void 0!==y&&y,S=t.rootId,w=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),k=function(e){if(e instanceof HTMLFormElement)return"form";var t=oc(e.tagName);return Cc.test(t)?"div":t}(e),C=new Set,E={},T=e.attributes.length,x=0;T>x;x++){var I=e.attributes[x];Ac(k,I.name)||(E[I.name]=Lc(s,k,oc(I.name),I.value,e,v))}if("link"===k&&o&&!w){var M=e.sheet;if(!M){var R=function(e){return e.href}(e);R&&!(M=qc(s,R))&&R.includes(".css")&&(M=qc(s,window.location.origin+"/"+R.replace(window.location.href,"")))}var P=null;M&&($u(M)?wu>0&&(Iu.push(e),Mu+=1):P=Zu(M)),P&&(delete E.rel,delete E.href,E._cssText=P)}if("style"===k&&e.sheet&&!(e.innerText||vu.textContent(e)||"").trim().length){var F=qu((()=>Zu(e.sheet)));F&&(E._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var L=e.value,A=e.checked;"radio"!==E.type&&"checkbox"!==E.type&&"submit"!==E.type&&"button"!==E.type&&L?E.value=sc({element:e,type:cc(e),tagName:k,value:L,maskInputOptions:l,maskInputFn:u}):A&&(E.checked=A)}if("option"===k&&(e.selected&&!l.select?E.selected=!0:delete E.selected),"dialog"===k&&e.open){try{E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){E.rr_open_mode="modal",E.ph_rr_could_not_detect_modal=!0}C.add("rr_open_mode")}if("canvas"===k&&_&&!(null==f?void 0:f()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var n=t.getImageData;if(new Uint32Array((uc in n?n[uc]:n).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(E.rr_dataURL=e.toDataURL(v.type,v.quality));else if(!("__context"in e)){var O=e.toDataURL(v.type,v.quality),D=s.createElement("canvas");D.width=e.width,D.height=e.height,O!==D.toDataURL(v.type,v.quality)&&(E.rr_dataURL=O)}var N,B,q=!1;if("img"===k&&g){_c||(_c=s.createElement("canvas"),fc=_c.getContext("2d"));var H=e,U=H.currentSrc||H.getAttribute("src")||"<unknown-src>",W=H.crossOrigin,z=(t,r)=>q?lc({element:e,name:t,value:r,maskAllElementAttributes:d,maskAttributeFn:h}):r,V=()=>{Nc(H,"load",V);try{_c.width=H.naturalWidth,_c.height=H.naturalHeight,fc.drawImage(H,0,0);var e=_c.toDataURL(v.type,v.quality);E.rr_dataURL=z("rr_dataURL",e)}catch(e){if("anonymous"!==H.crossOrigin)return H.crossOrigin="anonymous",void(H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V));console.warn("Cannot inline img src="+U+"! Error: "+e)}"anonymous"===H.crossOrigin&&(W?E.crossOrigin=z("crossOrigin",W):H.removeAttribute("crossorigin"))};H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V)}if("audio"===k||"video"===k){var j=E;j.rr_mediaState=e.paused?"paused":"played",C.add("rr_mediaState"),j.rr_mediaCurrentTime=e.currentTime,j.rr_mediaPlaybackRate=e.playbackRate,j.rr_mediaMuted=e.muted,j.rr_mediaLoop=e.loop,j.rr_mediaVolume=e.volume}if(b||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),w){var G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null==(r=s.defaultView)?void 0:r.getComputedStyle(e);E={class:E.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null==(i=s.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(Y+((null==(n=s.defaultView)?void 0:n.scrollY)||0))+"px"},C.add("rr_width"),C.add("rr_height"),C.add("rr_left"),C.add("rr_top"),J&&(E.rr_position=J.position||"static",C.add("rr_position"),J.transform&&"none"!==J.transform&&(E.rr_transform=J.transform,C.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(E.rr_display=J.display,C.add("rr_display")))}if("iframe"!==k||m(E.src)||(e.contentDocument||(E.rr_src=E.src),delete E.src),d||h)for(var X of Object.entries(E)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(E[ee]=lc({element:e,name:ee,value:te,maskAllElementAttributes:d,maskAttributeFn:h,isGenerated:C.has(ee)}))}q=!0;try{customElements.get(k)&&(N=!0)}catch(e){}return{type:ru.Element,tagName:k,attributes:E,childNodes:[],isSVG:(B=e,Boolean("svg"===B.tagName||B.ownerSVGElement)||void 0),needBlock:w,rootId:S,isCustom:N}}(e,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:g,inlineImages:_,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,n=t.maskTextFn,s=t.rootId,o=vu.parentNode(e),a=o&&o.tagName,l=vu.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if($u(o.sheet));else if(null==(r=o.sheet)?void 0:r.cssRules){var d=Zu(o.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(l=d)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}l=gc(l,Pc(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,vu.parentElement(e)):l.replace(/[\S]/g,"*")),{type:ru.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:ru.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:ru.Comment,textContent:vu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,inlineStylesheet:d,maskInputOptions:p,maskTextFn:v,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,keepIframeSrcFn:D,newlyAddedElement:B});if(!Q)return console.warn(e,"not serialized"),null;G=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===ru.Comment)return!0;if(e.type===ru.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e,t){var r,i;try{i=new URL(e,window.location.href)}catch(e){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Hc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Hc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Hc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Hc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Hc(e.attributes.property).match(/^(og|twitter|fb):/)||Hc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Hc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Hc(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Hc(e.attributes.name))||Hc(e.attributes.property).match(/^article:/)||Hc(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Hc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===ru.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?Ec:Tc();var K=Object.assign(Q,{id:G});if(i.add(e,K),G===Ec)return null;x&&x(e);var Z=!u;if(K.type===ru.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=vu.shadowRoot(e);Y&&ju(Y)&&(K.isShadowHost=!0)}if((K.type===ru.Document||K.type===ru.Element)&&Z){y.headWhitespace&&K.type===ru.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:v,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onIframeListenerRegistered:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W};if(K.type===ru.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(vu.childNodes(e))){var ee=zc(X,J);ee&&K.childNodes.push(ee)}var te=null;if(zu(e)&&(te=vu.shadowRoot(e)))for(var re of Array.from(vu.childNodes(te))){var ie=zc(re,J);ie&&(ju(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var ne=vu.parentNode(e);if(ne&&Vu(ne)&&ju(ne)&&(K.isShadow=!0),K.type===ru.Element&&"iframe"===K.tagName){var se=function(e,t,r){var i,n=()=>{},s=e.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(e){return n}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),Nc(e,"load",c),e.addEventListener("load",o),t())},c=()=>u();return l=setTimeout(u,r),e.addEventListener("load",c),()=>{null!==l&&(clearTimeout(l),l=null),a?Nc(e,"load",o):(a=!0,Nc(e,"load",c))}}var d,h="about:blank";try{d=s.location.href}catch(e){return n}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),Nc(e,"load",o)}}return e.addEventListener("load",o),()=>{Nc(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&I){var r=zc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:v,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onIframeListenerRegistered:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W});r&&I(e,r)}}),R);null==P||P(e,se)}return K.type===ru.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!Bc.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,_=!1,b=()=>{if(!_){_=!0;try{(()=>{if(F){var t=zc(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:v,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:W});t&&F(e,t)}})()}finally{Bc.delete(t),h.abort()}}},w=setTimeout(b,u);h.signal.addEventListener("abort",(()=>clearTimeout(w)),{once:!0}),t.addEventListener("load",b,{signal:h.signal,once:!0}),Bc.set(t,h)}}}(e,0,A),K}function Vc(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class jc{constructor(){Kl(this,"parentElement",null),Kl(this,"parentNode",null),Kl(this,"ownerDocument"),Kl(this,"firstChild",null),Kl(this,"lastChild",null),Kl(this,"previousSibling",null),Kl(this,"nextSibling",null),Kl(this,"ELEMENT_NODE",1),Kl(this,"TEXT_NODE",3),Kl(this,"nodeType"),Kl(this,"nodeName"),Kl(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof jc))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Gc(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>Qc(r,e,t,i)}function Qc(e,t,r,i){Kc((()=>{var n=e.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(e,t,r,i):n.call(e,t,r))}))}function Kc(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var Zc="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",Yc={map:{},getId(){return console.error(Zc),-1},getNode(){return console.error(Zc),null},removeNodeFromMap(){console.error(Zc)},has(){return console.error(Zc),!1},reset(){console.error(Zc)}};function Jc(e,t,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];var l=Date.now();n||!1!==r.leading||(n=l);var u=t-(l-n),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),n=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function Xc(e,t,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(e){return}s.set.call(this,e)}}}),()=>Xc(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Yc=new Proxy(Yc,{get(e,t,r){return"map"===t&&console.error(Zc),Reflect.get(e,t,r)}}));var ed=Date.now;function td(e){var t,r,i,n,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=vu.parentElement(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=vu.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function rd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function id(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function nd(e){return e?e.nodeType===e.ELEMENT_NODE?e:vu.parentElement(e):null}function sd(e,t,r,i){if(!e)return!1;var n=nd(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(i&&null!==n.closest("."+t))return!0}else if(Oc(n,t,i))return!0}catch(e){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function od(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Ec}function ad(e,t){if(Vu(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=vu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||ad(i,t))}function ld(e){return Boolean(e.changedTouches)}function ud(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function cd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function dd(e){return!!e&&(e instanceof jc&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(vu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(ed=()=>(new Date).getTime());class hd{constructor(){Kl(this,"id",1),Kl(this,"styleIDMap",new WeakMap),Kl(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function pd(e){var t,r=null;return"getRootNode"in e&&(null==(t=vu.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&vu.host(vu.getRootNode(e))&&(r=vu.host(vu.getRootNode(e))),r}function vd(e){var t=e.ownerDocument;return!!t&&(vu.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=pd(r);)r=t;return r}(e);return vu.contains(t,r)}(e))}function gd(e){return"__ln"in e}class _d{constructor(){Kl(this,"length",0),Kl(this,"head",null),Kl(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&gd(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&gd(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}var fd,md=(e,t)=>e+"@"+t;class yd{constructor(){Kl(this,"frozen",!1),Kl(this,"locked",!1),Kl(this,"texts",[]),Kl(this,"attributes",[]),Kl(this,"attributeMap",new WeakMap),Kl(this,"generatedAttributes",new WeakMap),Kl(this,"removes",[]),Kl(this,"mapRemoves",[]),Kl(this,"movedMap",{}),Kl(this,"addedSet",new Set),Kl(this,"movedSet",new Set),Kl(this,"droppedSet",new Set),Kl(this,"removesSubTreeCache",new Set),Kl(this,"mutationCb"),Kl(this,"blockClass"),Kl(this,"blockSelector"),Kl(this,"maskTextClass"),Kl(this,"maskTextSelector"),Kl(this,"inlineStylesheet"),Kl(this,"maskInputOptions"),Kl(this,"maskTextFn"),Kl(this,"maskInputFn"),Kl(this,"maskAllElementAttributes"),Kl(this,"maskAttributeFn"),Kl(this,"keepIframeSrcFn"),Kl(this,"recordCanvas"),Kl(this,"canvasMaskingConfigured"),Kl(this,"inlineImages"),Kl(this,"slimDOMOptions"),Kl(this,"dataURLOptions"),Kl(this,"doc"),Kl(this,"mirror"),Kl(this,"iframeManager"),Kl(this,"stylesheetManager"),Kl(this,"shadowDomManager"),Kl(this,"canvasManager"),Kl(this,"processedNodeManager"),Kl(this,"unattachedDoc"),Kl(this,"canvasManagerReleased",!1),Kl(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),Kl(this,"emit",(()=>{if(!this.frozen&&!this.locked){var e,t,r=_u(),i=bu();try{this.processBufferedMutations()}finally{e=_u()-r,t=i,wu>0||Su(e,null!=t?t:fu)||e>Pu.slowestBatchMs&&(Pu.slowestBatchMs=e)}}})),Kl(this,"processBufferedMutations",(()=>{for(var e=[],t=new Set,r=new _d,i=e=>{for(var t=e,r=Ec;r===Ec;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=vu.parentNode(n);if(s&&vd(n)&&"TEXTAREA"!==s.tagName){var o=Vu(s)?this.mirror.getId(pd(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=zc(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{ud(e,this.mirror)&&this.iframeManager.addIframe(e),cd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),dd(e)&&!sd(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(vu.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)Sd(this.removesSubTreeCache,s)&&!this.movedSet.has(vu.parentNode(s))||n(s);for(var o of this.addedSet)wd(this.droppedSet,o)||Sd(this.removesSubTreeCache,o)?wd(this.movedSet,o)?n(o):this.droppedSet.add(o):n(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(vu.parentNode(a.value)),c=i(a.value);-1!==u&&-1!==c&&(l=a)}if(!l)for(var d=r.tail;d;){var h=d;if(d=d.previous,h){var p=this.mirror.getId(vu.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var v=vu.parentNode(h.value);if(v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var g=vu.host(v);if(-1!==this.mirror.getId(g)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),n(l.value)}var _={texts:this.texts.map((e=>{var t=e.node,r=vu.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{var t,r=e.attributes;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof r.style){var i=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);r.style.length>i.length&&(i+n).split("var(").length===r.style.split("var(").length&&(r.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var s of Object.entries(r)){var o=s[0],a=s[1];"string"!=typeof a&&null!==a||(r[o]=lc({element:e.node,name:o,value:a,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null==(t=this.generatedAttributes.get(e.node))?void 0:t.has(o)}))}return{id:this.mirror.getId(e.node),attributes:r}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(_.texts.length||_.attributes.length||_.removes.length||_.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(_))})),Kl(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),Kl(this,"genTextAreaValueMutation",(e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(vu.childNodes(e),(e=>vu.textContent(e)||"")).join("");t.attributes.value=sc({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:cc(e),value:r,maskInputFn:this.maskInputFn})})),Kl(this,"processMutation",(e=>{var t;if(!od(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var r=vu.textContent(e.target);sd(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue||this.texts.push({value:Dc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,nd(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break;case"attributes":var i,n=e.target,s=e.attributeName,o=null!==(i=e.attributeNamespace)&&void 0!==i?i:null,a=function(e,t,r){if(!r)return t;var i=e.getAttributeNodeNS(r,t);if(i)return i.name;if("http://www.w3.org/1999/xlink"===r)return"xlink:"+t;if("http://www.w3.org/XML/1998/namespace"===r)return"xml:"+t;if("http://www.w3.org/2000/xmlns/"===r)return"xmlns"===t?t:"xmlns:"+t;var n=e.lookupPrefix(r);return n?n+":"+t:t}(n,s,o),l=o?n.getAttributeNS(o,s):e.target.getAttribute(s);if("value"===a){var u=n,c=cc(u);l=sc({element:u,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:c,value:l,maskInputFn:this.maskInputFn})}if(sd(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;var d=this.attributeMap.get(e.target),h="IFRAME"===n.tagName&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===a&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Ac(n.tagName,a)){var p=Lc(this.doc,oc(n.tagName),oc(a),l,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(l)&&(a="rr_src"),d.attributes[a]=p,null==(t=this.generatedAttributes.get(e.target))||t.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}var v=this.unattachedDoc.createElement("span"),g=n.style;for(var _ of(e.oldValue&&(v.style.cssText=e.oldValue),Array.from(g))){var f=g.getPropertyValue(_),m=g.getPropertyPriority(_);f!==v.style.getPropertyValue(_)||m!==v.style.getPropertyPriority(_)?d.styleDiff[_]=""===m?f:[f,m]:d._unchangedStyles[_]=[f,m]}for(var y of Array.from(v.style))""===g.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===a&&"DIALOG"===n.tagName){d.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";var b=this.generatedAttributes.get(e.target);b||this.generatedAttributes.set(e.target,b=new Set),b.add("rr_open_mode")}}break;case"childList":if(sd(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{var r=this.mirror.getId(t),i=Vu(e.target)?this.mirror.getId(vu.host(e.target)):this.mirror.getId(e.target);sd(e.target,this.blockClass,this.blockSelector,!1)||od(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(bd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||ad(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[md(r,i)]?bd(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!Vu(e.target)||!ju(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),vu.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),Kl(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(od(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[md(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);sd(e,this.blockClass,this.blockSelector,!1)||(vu.childNodes(e).forEach((e=>this.genAdds(e))),dd(e)&&vu.childNodes(vu.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function bd(e,t){for(var r=[t];r.length;){var i=r.pop();e.delete(i),vu.childNodes(i).forEach((e=>r.push(e)))}}function Sd(e,t,r){return 0!==e.size&&function(e,t,r){var i=vu.parentNode(t);return!!i&&e.has(i)}(e,t)}function wd(e,t){if(0===e.size)return!1;for(var r=vu.parentNode(t);r;){if(e.has(r))return!0;r=vu.parentNode(r)}return!1}var kd=function(e,t){return void 0===t&&(t="rrweb"),fd?function(){try{return e(...arguments)}catch(e){if(fd&&!0===fd(e,t))return;throw e}}:e},Cd=[];function Ed(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function Td(e,t){var r,i=new yd;i.init(e);try{r=new(hu())(kd(i.processMutations.bind(i)));var n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),r.observe(t,n),Cd.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function xd(e){var t=e.scrollCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Ed(e);if(o&&!sd(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=td(r.defaultView);l=d.left,u=d.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(c)!==h&&(a.set(c,h),t({id:c,x:l,y:u}))}},u=[Gc("scroll",kd(Jc(kd((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(Gc("scrollend",kd(l),r)),()=>u.forEach((e=>e()))}function Id(e,t){for(var r=Cd.length-1;r>=0;r--){var i=Cd[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Cd.splice(r,1))}}}var Md=["INPUT","TEXTAREA","SELECT"],Rd=new WeakMap;function Pd(e){return function e(t,r){if(Dd("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Dd("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Dd("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Dd("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var n=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(n)}return r}(e,[])}function Fd(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}var Ld=5e3;function Ad(e,t){var r,i,n,s,o=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:vu.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(n=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var t,r;try{r=null==(t=l.set)?void 0:t.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(e){}return r}}),kd((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function Od(e,t){void 0===t&&(t={});var r,i,n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,n=e.mouseInteractionCb,s=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,c=e.styleDeclarationCb,d=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,v=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),n(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),c(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),d(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),v(...arguments)}}(e,t);var s,o,a,l,u,c,d,h,p=[],v=kd((()=>{if(i){i.destroy(),i.reset();var t=Cd.indexOf(i);-1!==t&&Cd.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect(),p.forEach((e=>e()))}));try{if(e.recordDOM){var _=Td(e,e.doc);r=_.observer,i=_.buffer}if(p.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,n=e.mirror;if(!1===r.mousemove)return()=>{};var s,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=Jc(kd((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),c=kd(Jc(kd((e=>{var t=Ed(e),r=ld(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;s||(s=ed()),l.push({x:i,y:o,id:n.getId(t),timeOffset:ed()-s}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?Yl.Drag:e instanceof MouseEvent?Yl.MouseMove:Yl.TouchMove)})),o,{trailing:!1})),d=[Gc("mousemove",c,i),Gc("touchmove",c,i),Gc("drag",c,i)];return kd((()=>{d.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling;if(!1===o.mouseInteraction)return()=>{};var a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,l=[],u=null;return Object.keys(Jl).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{var o=oc(e),a=(e=>r=>{var o=Ed(r);if(!sd(o,n,s,!0)){var a=null,l=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Xl.Mouse;break;case"touch":a=Xl.Touch;break;case"pen":a=Xl.Pen}a===Xl.Touch&&(Jl[e]===Jl.MouseDown?l="TouchStart":Jl[e]===Jl.MouseUp&&(l="TouchEnd"))}else ld(r)&&(a=Xl.Touch);null!==a?(u=a,(l.startsWith("Touch")&&a===Xl.Touch||l.startsWith("Mouse")&&a===Xl.Mouse)&&(a=null)):Jl[e]===Jl.Click&&(a=u,u=null);var c=ld(r)?r.changedTouches[0]:r;if(c){var d=i.getId(o),h=c.clientX,p=c.clientY;kd(t)(g({type:Jl[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))}}})(e);if(window.PointerEvent)switch(Jl[e]){case Jl.MouseDown:case Jl.MouseUp:o=o.replace("mouse","pointer");break;case Jl.TouchStart:case Jl.TouchEnd:return}l.push(Gc(o,a,r))})),kd((()=>{l.forEach((e=>e()))}))}(e)),p.push(xd(e)),p.push(function(e,t){var r=e.viewportResizeCb,i=t.win,n=-1,s=-1;return Gc("resize",kd(Jc(kd((()=>{var e=rd(),t=id();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:n})),p.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.ignoreClass,a=e.ignoreSelector,l=e.maskInputOptions,u=e.maskInputFn,c=e.userTriggeredOnInput;function d(e){var t=Ed(e),i=e.isTrusted,d=r.defaultView;if(!t||!d||t instanceof d.HTMLElement){var p=t&&t.tagName;if(t&&"OPTION"===p&&(t=vu.parentElement(t)),t&&p&&Md.indexOf(p)>=0&&!sd(t,n,s,!0)&&!(t.classList.contains(o)||a&&t.matches(a))){var v=t.value,g=!1,_=cc(t)||"";"radio"===_||"checkbox"===_?g=t.checked:(l[p.toLowerCase()]||l[_])&&(v=sc({element:t,maskInputOptions:l,tagName:p,type:_,value:v,maskInputFn:u})),h(t,c?{text:v,isChecked:g,userTriggered:i}:{text:v,isChecked:g});var f=t.name;"radio"===_&&f&&g&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;h(e,c?{text:r,isChecked:!g,userTriggered:!1}:{text:r,isChecked:!g})}}))}}}function h(e,r){var n=Rd.get(e);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){Rd.set(e,r);var s=i.getId(e);kd(t)(g({},r,{id:s}))}}var p=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>Gc(e,kd(d),r))),v=r.defaultView;if(!v)return()=>{p.forEach((e=>e()))};var _=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value");return _&&_.set&&p.push(...[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]].map((e=>Xc(e[0],e[1],{set(){kd(d)({target:this,isTrusted:!1})}},!1,v)))),kd((()=>{p.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,n=e.mirror,s=e.sampling,o=e.doc,a=kd((e=>Jc(kd((s=>{var o=Ed(s);if(o&&!sd(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,c=o.playbackRate,d=o.loop;t({type:e,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),s.media||500))),l=[Gc("play",a(tu.Play),o),Gc("pause",a(tu.Pause),o),Gc("seeked",a(tu.Seeked),o),Gc("volumechange",a(tu.VolumeChange),o),Gc("ratechange",a(tu.RateChange),o)];return kd((()=>{l.forEach((e=>e()))}))}(e)),e.recordDOM){var f=function(e){var t=new Map,r=new Set,i=!0,n=e=>{if(i)try{e()}catch(e){}},s=e=>{var r,i=t.get(e);if(i){for(;null==(r=i[0])?void 0:r.ready;){var s=i.shift();(null==s?void 0:s.emit)&&n(s.emit)}0===i.length&&t.delete(e)}};return{queueMutation(e,r){if(e){var i=t.get(e);i?(i.push({emit:r,ready:!0}),s(e)):n(r)}else n(r)},queuePendingMutation(o,a,l){if(!i)return()=>{};var u=t.get(o);u||t.set(o,u=[]);var c={emit:a,ready:!1};u.push(c);var d,h=!1,p=!1,v=()=>{h||p||(h=!0,void 0!==d&&r.delete(d),c.ready=!0,c.emit=void 0,s(o))};try{d=e.setTimeout(v,Ld),h||p?e.clearTimeout(d):r.add(d)}catch(e){v()}return t=>{!p&&i&&(p=!0,void 0!==d&&(e.clearTimeout(d),r.delete(d)),h?t&&n(l):(c.ready=!0,t||(c.emit=void 0),s(o)))}},reset(){i=!1,r.forEach((t=>e.clearTimeout(t))),r.clear(),t.clear()}}}(n);p.push(f.reset),p.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,n=e.stylesheetManager,s=t.win,o=t.mutationQueue;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Fd(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,adds:[{rule:a,index:l}]}))),l}),"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,c=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(c,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Fd(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,removes:[{index:a}]}))),l}),"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(l=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;n.onCssomSheetMutation(t);var c=Fd(t,i,n.styleMirror),d=c.id,h=c.styleId;if(!(d&&-1!==d||h&&-1!==h))return l;var p=o.queuePendingMutation(t,(()=>r({id:d,styleId:h,replace:a})),(()=>{var e=Zu(t);null!==e&&r({id:d,styleId:h,replace:e})}));try{u.call(l,(()=>p(!0)),(()=>p(!1)))}catch(e){p(!1)}}catch(e){}return l}),"host")})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Fd(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,replaceSync:a}))),l}),"host")}));var d={};Nd("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(Nd("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),Nd("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),Nd("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));var h={};return Object.entries(d).forEach((e=>{var t=e[0],s=e[1];h[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(h[t].insertRule,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t.parentStyleSheet);var u=Fd(t.parentStyleSheet,i,n.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...Pd(t),l];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,adds:[{rule:a,index:h}]})))}return l}),"host")}),s.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:kd(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t.parentStyleSheet);var u=Fd(t.parentStyleSheet,i,n.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...Pd(t),a];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,removes:[{index:h}]})))}return l}),"host")})})),kd((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=c,l&&(s.CSSStyleSheet.prototype.replace=l),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(d).forEach((e=>{var t=e[0],r=e[1];r.prototype.insertRule=h[t].insertRule,r.prototype.deleteRule=h[t].deleteRule}))}))}(e,{win:n,mutationQueue:f})),p.push(Ad(e,e.doc)),p.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,n=e.ignoreCSSAttributes,s=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:kd(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2],h=e.apply(t,o);if(n.has(u))return h;var p=null==(l=t.parentRule)?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);var v=Fd(p,i,s.styleMirror),g=v.id,_=v.styleId;if(g&&-1!==g||_&&-1!==_){var f=Pd(t.parentRule);a.queueMutation(p,(()=>r({id:g,styleId:_,set:{property:u,value:c,priority:d},index:f})))}return h}),"host")});var u=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:kd(((e,t,o)=>{var l,u=o[0],c=e.apply(t,o);if(n.has(u))return c;var d=null==(l=t.parentRule)?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);var h=Fd(d,i,s.styleMirror),p=h.id,v=h.styleId;if(p&&-1!==p||v&&-1!==v){var g=Pd(t.parentRule);a.queueMutation(d,(()=>r({id:p,styleId:v,remove:{property:u},index:g})))}return c}),"host")}),kd((()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u}))}(e,{win:n,mutationQueue:f})),e.collectFonts&&p.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=pu(r.fonts,"add",(function(e){return function(r){return setTimeout(kd((()=>{var e=s.get(r);e&&(t(e),s.delete(r))})),0),e.apply(this,[r])}}));return n.push((()=>{i.FontFace=o})),n.push(a),kd((()=>{n.forEach((e=>e()))}))}(e))}for(var m of(p.push((o=(s=e).doc,a=s.mirror,l=s.blockClass,u=s.blockSelector,c=s.selectionCb,d=!0,(h=kd((()=>{var e=o.getSelection();if(!(!e||d&&(null==e?void 0:e.isCollapsed))){d=e.isCollapsed||!1;for(var t=[],r=e.rangeCount||0,i=0;r>i;i++){var n=e.getRangeAt(i),s=n.startContainer,h=n.startOffset,p=n.endContainer,v=n.endOffset;sd(s,l,u,!0)||sd(p,l,u,!0)||t.push({start:a.getId(s),startOffset:h,end:a.getId(p),endOffset:v})}c({ranges:t})}})))(),Gc("selectionchange",h))),p.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?pu(r.customElements,"define",(function(e){return function(r,i,n){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,n])}})):()=>{}}(e)),e.plugins))p.push(m.observer(m.callback,n,m.options))}catch(e){try{v()}catch(e){}throw e}return v}function Dd(e){return void 0!==window[e]}function Nd(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Bd{constructor(e){Kl(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Kl(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var n=r||this.getRemoteIdToLocalIdMap(e),s=i||this.getLocalIdToRemoteIdMap(e),o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),s.set(o,t)),o}getIds(e,t){var r=this.getRemoteIdToLocalIdMap(e),i=this.getLocalIdToRemoteIdMap(e);return t.map((t=>this.getId(e,t,r,i)))}getRemoteId(e,t,r){var i;return"number"!=typeof t||0>t?t:null!==(i=(r||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==i?i:-1}getRemoteIds(e,t){var r=this.getLocalIdToRemoteIdMap(e);return t.map((t=>this.getRemoteId(e,t,r)))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){var t=this.iframeRemoteIdToLocalIdMap.get(e);return t||this.iframeRemoteIdToLocalIdMap.set(e,t=new Map),t}getLocalIdToRemoteIdMap(e){var t=this.iframeLocalIdToRemoteIdMap.get(e);return t||this.iframeLocalIdToRemoteIdMap.set(e,t=new Map),t}}class qd{constructor(e){Kl(this,"iframes",new WeakMap),Kl(this,"crossOriginIframeMap",new WeakMap),Kl(this,"crossOriginIframeMirror",new Bd(Tc)),Kl(this,"crossOriginIframeStyleMirror"),Kl(this,"crossOriginIframeRootIdMap",new WeakMap),Kl(this,"mirror"),Kl(this,"mutationCb"),Kl(this,"wrappedEmit"),Kl(this,"loadListener"),Kl(this,"pageHideListener"),Kl(this,"stylesheetManager"),Kl(this,"recordCrossOriginIframes"),Kl(this,"messageHandler"),Kl(this,"nestedIframeListeners",new Map),Kl(this,"attachedWindows",new WeakMap),Kl(this,"attachedDocuments",new WeakMap),Kl(this,"attachedIframes",new Map),Kl(this,"loadListenerDisposers",new WeakMap),Kl(this,"iframeElementsById",new Map),Kl(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Bd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null==(i=this.attachedIframes.get(e))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach((e=>Kc(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{Qc(e.win,"pagehide",e.handler)})),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var n=this.attachedDocuments.get(e);n||this.attachedDocuments.set(e,n=new Set),n.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var o=this.handleMessage.bind(this);Kc((()=>{s.addEventListener("message",o),this.nestedIframeListeners.set(s,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(s)}))}Kc((()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var n=()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)};t.addEventListener("pagehide",n),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:n})}})),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case Zl.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Zl.IncrementalSnapshot,data:{source:Yl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Zl.Meta:case Zl.Load:case Zl.DomContentLoaded:return!1;case Zl.Plugin:return t;case Zl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Zl.IncrementalSnapshot:switch(t.data.source){case Yl.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Yl.Drag:case Yl.TouchMove:case Yl.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Yl.ViewportResize:return!1;case Yl.MediaInteraction:case Yl.MouseInteraction:case Yl.Scroll:case Yl.CanvasMutation:case Yl.Input:return this.replaceIds(t.data,e,["id"]),t;case Yl.StyleSheetRule:case Yl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Yl.Font:return t;case Yl.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Yl.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,r,i){for(var n of i)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(r,t[n]):e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===ru.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(Qc(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(Qc(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((e=>{Kc((()=>this.mirror.removeNodeFromMap(e)))})),Kc((()=>Id(r,s))),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach(((t,r)=>{this.mirror.has(r)||e.push(r)})),e.forEach((e=>this.removeIframeById(e)))}}reattachIframes(){this.attachedIframes.forEach(((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)}))}destroy(){this.recordCrossOriginIframes&&Qc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{Qc(t,"message",e)})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>e.add(t.element))),e.forEach((e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class Hd{constructor(e){Kl(this,"shadowDoms",new WeakSet),Kl(this,"mutationCb"),Kl(this,"scrollCb"),Kl(this,"bypassOptions"),Kl(this,"mirror"),Kl(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var r,i;if(ju(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var n=null!==(r=null==(i=vu.host(e))?void 0:i.ownerDocument)&&void 0!==r?r:t,s=Td(g({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),o=s.observer,a=s.buffer;this.restoreHandlers.push({doc:n,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();var e=Cd.indexOf(a);-1!==e&&Cd.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:xd(g({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(vu.host(e))),this.restoreHandlers.push({doc:n,handler:Ad({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})}),0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push({doc:t,handler:pu(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=vu.shadowRoot(this);return s&&vd(this)&&r.addShadowRoot(s,t),n}}))})}reset(){this.restoreHandlers.forEach((e=>{var t=e.handler;try{t()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}}var $d="skip-frame";function Ud(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var Wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zd="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Vd=0;64>Vd;Vd++)zd[Wd.charCodeAt(Vd)]=Vd;var jd=new Map,Gd=(e,t,r)=>{if(e&&(Zd(e,t)||"object"==typeof e)){var i=function(e,t){var r=jd.get(e);return r||jd.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),n=i.indexOf(e);return-1===n&&(n=i.length,i.push(e)),n}};function Qd(e,t,r,i){if(e instanceof Array)return e.map((e=>Qd(e,t,r,i)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){var n=e.constructor.name,s=function(e){var t,r=new Uint8Array(e),i=r.length,n="";for(t=0;i>t;t+=3)n+=Wd[r[t]>>2],n+=Wd[(3&r[t])<<4|r[t+1]>>4],n+=Wd[(15&r[t+1])<<2|r[t+2]>>6],n+=Wd[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e);return{rr_type:n,base64:s}}return e instanceof DataView?{rr_type:e.constructor.name,args:[Qd(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Qd(e.data,t,r,i),e.width,e.height]}:Zd(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Gd(e,t,r)}:e}var Kd=(e,t,r,i)=>e.map((e=>Qd(e,t,r,i))),Zd=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(r.find((r=>e instanceof t[r])))},Yd=["webgl","webgl2"];function Jd(e){return"nodeType"in e}function Xd(e,t,r,i){var n=[];try{if(i){var s=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return pu(i.prototype,"configure",(function(i){return function(n){var s=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!s||Jd(s)&&sd(s,t,r,!0))return i.call(this,n);Jd(s)&&!("__context"in s)&&(s.__context="webgpu");var o=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return i.call(this,null!==o&&n?g({},n,{usage:"number"==typeof n.usage?n.usage|o:o}):n)}}))}(e,t,r);s&&n.push(s)}var o=pu(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n){for(var s=function(e){return"experimental-webgl"===e?"webgl":e}(n),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!sd(this,t,r,!0)&&("__context"in this||(this.__context=s),i&&Yd.includes(s)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...a])}}));n.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((e=>e()))}}function eh(e,t,r,i,n,s,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=pu(e,l,(function(e){return function(){for(var a=arguments.length,u=new Array(a),c=0;a>c;c++)u[c]=arguments[c];var d=e.apply(this,u);if(Gd(d,s,this),this.canvas&&"tagName"in this.canvas&&!sd(this.canvas,i,n,!0)){var h=Kd(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(s){var c=Xc(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!sd(this.canvas,i,n,!0)&&r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(c)}};for(var c of l)u(c);return a}var th,rh,ih,nh='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',sh="undefined"!=typeof self&&self.Blob&&new Blob([nh],{type:"text/javascript;charset=utf-8"});function oh(e){var t;try{if(!(t=sh&&(self.URL||self.webkitURL).createObjectURL(sh)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(nh),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class ah{constructor(e){Kl(this,"pendingCanvasMutations",new Map),Kl(this,"rafStamps",{latestId:0,invokeId:null}),Kl(this,"mirror"),Kl(this,"mutationCb"),Kl(this,"resetObservers"),Kl(this,"frozen",!1),Kl(this,"locked",!1),Kl(this,"rafIdTimestamp",null),Kl(this,"rafIdFlush",null),Kl(this,"refCount",0),Kl(this,"torndown",!1),Kl(this,"resetFrameDedup",null),Kl(this,"processMutation",((e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)}));var t=e.sampling,r=void 0===t?"all":t,i=e.win,n=e.blockClass,s=e.blockSelector,o=e.recordCanvas,a=e.dataURLOptions,l=e.resolutionScale,u=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:a,resolutionScale:l,canvasMasking:u})}onFullSnapshot(){var e;null==(e=this.resetFrameDedup)||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){var s=this;if("OffscreenCanvas"in t){var o,a="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=Xd(t,r,i,!0),u=new Map;try{o=new oh}catch(e){return}var c=!1;o.onerror=()=>{var e;c=!0,cancelAnimationFrame(d),null==(e=o.terminate)||e.call(o),this.resetFrameDedup=null},this.resetFrameDedup=()=>{o.postMessage({resetFrameDedup:!0})},o.onmessage=e=>{var t=e.data.id;if(u.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:t,type:eu["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var d,h=1e3/e,p=0,g=e=>{var l,_;c||(p&&h>e-p||(p=e,(l=[],_=e=>{try{e.querySelectorAll("canvas").forEach((e=>{sd(e,r,i,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&_(e.shadowRoot)}))}catch(e){}},_(t.document),l).forEach(function(){var e=v((function*(e){var t,r,i=s.mirror.getId(e);if(!u.get(i)&&0!==e.width&&0!==e.height){u.set(i,!0);try{if(["webgl","webgl2"].includes(e.__context)){var l=e.getContext(e.__context);if(null==(t=null==l?void 0:l.isContextLost)?void 0:t.call(l))return void u.set(i,!1);!1===(null==(r=null==l?void 0:l.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&l.clear(l.COLOR_BUFFER_BIT)}var c=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(c*a)),p=Math.max(1,Math.round(d*a)),v=function(e,t,r,i,n,s){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return $d}if(void 0!==o){if(!Array.isArray(o)||!o.every(Ud))return $d;var a=r/n,l=i/s;return o.filter((e=>e.width>0&&e.height>0)).map((e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}}))}}}(n.canvasMasking,e,h,p,c,d);if(v===$d)return void u.set(i,!1);var g=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:i,bitmap:g,width:h,height:p,displayWidth:c,displayHeight:d,dataURLOptions:n.dataURLOptions,maskRegions:v},[g])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(g))};d=requestAnimationFrame(g),this.resetObservers=()=>{var e;l(),cancelAnimationFrame(d),null==(e=o.terminate)||e.call(o),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=Xd(e,t,r,!1),s=function(e,t,r,i,n){var s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=pu(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return sd(this.canvas,r,i,!0)||setTimeout((()=>{var r=Kd(l,t,this,n);e(this.canvas,{type:eu["2D"],property:o,args:r})}),0),s.apply(this,l)}}));s.push(a)}catch(n){var l=Xc(t.CanvasRenderingContext2D.prototype,o,{set(t){sd(this.canvas,r,i,!0)||e(this.canvas,{type:eu["2D"],property:o,args:[t],setter:!0})}});s.push(l)}};for(var l of o)a(l);return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,n){var s=[];return void 0!==t.WebGLRenderingContext&&s.push(...eh(t.WebGLRenderingContext.prototype,eu.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...eh(t.WebGL2RenderingContext.prototype,eu.WebGL2,e,r,i,t,n)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{n(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var i=r.map((e=>_(e,Gl)));this.mutationCb({id:t,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(e)}}}}class lh{constructor(e){var t;Kl(this,"trackedLinkElements",new WeakSet),Kl(this,"pendingDeferredSheets",new Set),Kl(this,"mutationCb"),Kl(this,"adoptedStyleSheetCb"),Kl(this,"maskAllElementAttributes"),Kl(this,"maskAttributeFn"),Kl(this,"styleMirror",new hd),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;var r=null,i=null;try{(i=e.sheet)&&(r=ic(i))}catch(e){}if(!r||!i)return Uu(),null;var n=r,s=!1,o={sheet:i,invalidate(){s=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,c=_u(),d=bu(),h=!0;try{if(s)return a=!0,Uu(),!0;if(!n.advance(r))return h=!1,!1;a=!0;var p=n.text();if(!e.isConnected)return!0;var v=null;try{v=e.sheet}catch(e){}return v!==i?(Uu(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(Uu(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),Su(l=_u()-c,null!=(u=d)?u:fu)||(Fu.totalMs+=l,l>Fu.slowestSliceMs&&(Fu.slowestSliceMs=l))}},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(var t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var r;null==(r=this.beginDeferredLinkInlining(e,t))||r.advance(1/0)}emitCssTextMutation(e,t,r){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:lc({element:e,name:"_cssText",value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var i={id:t,styleIds:[]},n=[],s=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var s=r.styleMirror.add(e);t=s;var o=_u();try{qu((()=>{try{var t=e.rules||e.cssRules;t&&Bu(t)}catch(e){}n.push({styleId:s,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:Yu(t,e.href),index:r})))})}))}finally{Hu(_u()-o)}}i.styleIds.push(t)};for(var o of e)s(o);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Bc.forEach((e=>e.abort())),Bc.clear()}trackStylesheetInLinkElement(e){}}class uh{constructor(){Kl(this,"nodeMap",new WeakMap),Kl(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}var ch=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var dh=document.createElement("iframe");document.body.appendChild(dh),Array.from=(null==(jl=dh.contentWindow)?void 0:jl.Array.from)||Array.from,document.body.removeChild(dh)}}catch(e){console.debug("Unable to override Array.from",e)}var hh=new nc,ph=new Set([Yl.Mutation,Yl.MediaInteraction,Yl.StyleSheetRule,Yl.CanvasMutation,Yl.Font,Yl.Log,Yl.StyleDeclaration,Yl.AdoptedStyleSheet]);function vh(e){var t=window;if("function"==typeof t.requestIdleCallback){var r=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null==(e=t.cancelIdleCallback)?void 0:e.call(t,r)}}}var i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function gh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,n=r.checkoutEveryNms,s=r.checkoutEveryNth,o=r.blockClass,a=void 0===o?"rr-block":o,l=r.blockSelector,u=void 0===l?null:l,c=r.ignoreClass,d=void 0===c?"rr-ignore":c,h=r.ignoreSelector,p=void 0===h?null:h,v=r.maskTextClass,_=void 0===v?"rr-mask":v,f=r.maskTextSelector,m=void 0===f?null:f,y=r.inlineStylesheet,b=void 0===y||y,S=r.inlineStylesheetBudgetRules,w=r.maskAllInputs,k=r.maskInputOptions,C=r.slimDOMOptions,E=r.maskInputFn,T=r.maskTextFn,x=r.maskAllElementAttributes,I=void 0!==x&&x,M=r.maskAttributeFn,R=r.hooks,P=r.packFn,F=r.sampling,L=void 0===F?{}:F,A=r.dataURLOptions,O=void 0===A?{}:A,D=r.canvasResolutionScale,N=r.canvasMasking,B=r.mousemoveWait,q=r.recordDOM,H=void 0===q||q,U=r.recordCanvas,W=void 0!==U&&U,z=r.recordCrossOriginIframes,V=void 0!==z&&z,j=r.recordAfter,G=void 0===j?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":j,Q=r.userTriggeredOnInput,K=void 0!==Q&&Q,Z=r.collectFonts,Y=void 0!==Z&&Z,J=r.inlineImages,X=void 0!==J&&J,ee=r.plugins,te=r.keepIframeSrcFn,re=void 0===te?()=>!1:te,ie=r.ignoreCSSAttributes,ne=void 0===ie?new Set([]):ie,se=r.attributeFilter;fd=r.errorHandler;var oe=g({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),ae=!V||window.parent===window,le=!1;if(!ae)try{window.parent.document&&(le=!1)}catch(e){le=!0}if(ae&&!i)throw new Error("emit function is required");if(!ae&&!le)return()=>{};void 0!==B&&void 0===L.mousemove&&(L.mousemove=B),hh.reset();var ue,ce=!0===w?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==k?k:{password:!0},de=Vc(void 0!==C&&C);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var he,pe,ve=0,ge=new Map,_e=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return P&&!le&&(e=P(e)),e};th=(e,t)=>{var r,o=e;if(o.timestamp=ed(),!(null==(r=Cd[0])?void 0:r.isFrozen())||o.type===Zl.FullSnapshot||o.type===Zl.IncrementalSnapshot&&ph.has(o.data.source)||Cd.forEach((e=>e.unfreeze())),ae)null==i||i(_e(o),t);else if(le){var a={type:"rrweb",event:_e(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===Zl.FullSnapshot)ue=o,ve=0;else if(o.type===Zl.IncrementalSnapshot){if(o.data.source===Yl.Mutation&&o.data.isAttachIframe)return;ve++,(s&&ve>=s||n&&o.timestamp-ue.timestamp>n)&&rh(!0)}};var fe=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map((e=>e.node.id))):null,r=new Set;if(e.adds.length>0)for(var i of e.adds){var n=hh.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}e.removes.forEach((e=>{var i=e.id;if(!t||!t.has(i)){var n=Se.getIframeElementById(i);n&&r.has(n)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}})),null==pe||pe(),Se.cleanupDetachedIframes()}th({type:Zl.IncrementalSnapshot,data:g({source:Yl.Mutation},e)})},me=e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.Scroll},e)}),ye=e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.CanvasMutation},e)}),be=new lh({mutationCb:fe,adoptedStyleSheetCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.AdoptedStyleSheet},e)}),maskAllElementAttributes:I,maskAttributeFn:M}),Se=new qd({mirror:hh,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:th});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:hh,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new uh,Ce=null==N?void 0:N.configured;ih=new ah({recordCanvas:W,mutationCb:ye,win:window,blockClass:a,blockSelector:u,mirror:hh,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var Ee=new Hd({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:a,blockSelector:u,maskTextClass:_,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:ce,dataURLOptions:oe,maskTextFn:T,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:M,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:de,iframeManager:Se,stylesheetManager:be,canvasManager:ih,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:se},mirror:hh});rh=function(e){if(void 0===e&&(e=!1),H){Au(S);try{th({type:Zl.Meta,data:{href:window.location.href,width:id(),height:rd()}},e),null==t||t.cancel(),t=void 0,be.reset(),Ee.init(),Cd.forEach((e=>e.lock()));var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,n=void 0===i?new nc:i,s=r.blockClass,o=void 0===s?"rr-block":s,a=r.blockSelector,l=void 0===a?null:a,u=r.maskTextClass,c=void 0===u?"rr-mask":u,d=r.maskTextSelector,h=void 0===d?null:d,p=r.inlineStylesheet,v=void 0===p||p,g=r.inlineImages,_=void 0!==g&&g,f=r.recordCanvas,m=void 0!==f&&f,y=r.canvasMaskingConfigured,b=r.maskAllInputs,S=void 0!==b&&b,w=r.maskTextFn,k=r.maskInputFn,C=r.maskAllElementAttributes,E=void 0!==C&&C,T=r.maskAttributeFn,x=r.slimDOM,I=r.dataURLOptions,M=r.preserveWhiteSpace,R=r.onSerialize,P=r.onIframeLoad,F=r.iframeLoadTimeout,L=r.onIframeListenerRegistered,A=r.onStylesheetLoad,O=r.stylesheetLoadTimeout,D=r.keepIframeSrcFn,N=void 0===D?()=>!1:D,B=r.maxDepth,q=r.inlineStylesheetBudgetRules,H=!0===S?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===S?{password:!0}:S,U=Vc(void 0!==x&&x);Au(q);try{return zc(e,{doc:e,mirror:n,blockClass:o,blockSelector:l,maskTextClass:c,maskTextSelector:h,skipChild:!1,inlineStylesheet:v,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:E,maskAttributeFn:T,slimDOMOptions:U,dataURLOptions:I,inlineImages:_,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:R,onIframeLoad:P,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{Ou()}}(document,{mirror:hh,blockClass:a,blockSelector:u,maskTextClass:_,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:ce,inlineStylesheetBudgetRules:S,maskTextFn:T,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:M,slimDOM:de,dataURLOptions:oe,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){ud(e,hh)&&Se.addIframe(e),cd(e,hh)&&be.trackLinkElement(e),dd(e)&&Ee.addShadowRoot(vu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),Ee.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{s=Iu,Iu=[],r=s}if(!i)return console.warn("Failed to snapshot the document");if(th({type:Zl.FullSnapshot,data:{node:i,initialOffset:td(window)}},e),Cd.forEach((e=>e.unlock())),ih.onFullSnapshot(),r.length){var n=function(e,t,r){var i=!1,n=null,s=0,o=null,a=()=>null!==o||e.length>s,l=()=>{var r=e[s];e[s]=null,s+=1,r&&Kc((()=>{o=t.beginDeferredLinkInlining(r,hh.getId(r))}))},u=()=>{if(o){var e=o,t=!0;Kc((()=>{t=e.advance(200)})),t&&(o=null)}},c=e=>{if(n=null,!i){var t=0;do{try{o||l(),u()}catch(e){null==o||o.discard(),o=null,Wu(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?n=vh(c):r())}};return n=vh(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(!i){i=!0,null==n||n.cancel(),n=null;for(var t=0,c=0;a()&&50>t;){o||l();var d=o;if(d)if(Math.floor(d.remainingRules()/200)+1>50-t)d.discard(),o=null,c+=1;else{try{u()}catch(e){null==o||o.discard(),o=null,c+=1}t+=1}}if(a()||c>0){for(var h=c+(null!==o?1:0),p=s;e.length>p;p++)null!==e[p]&&(h+=1);Wu(h),null==o||o.discard(),o=null}r()}}}}(r,be,(()=>{t===n&&(t=void 0)}));t=n}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,hh.getId(document))}finally{Ou()}var s}};try{var Te=[];for(var xe of(Te.push(Gc("pagehide",(()=>{try{null==t||t.flush()}catch(e){}t=void 0}),window)),["visibilitychange","freeze","resume"]))Te.push(Gc(xe,yu,document));he=e=>{var t=ge.get(e);t&&(t.forEach((e=>{Kc(e);var t=Te.indexOf(e);-1!==t&&Te.splice(t,1)})),ge.delete(e))},pe=()=>{for(var e of ge){var t=e[0],r=hh.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==he||he(t)}catch(e){null==he||he(t)}else null==he||he(t)}};var Ie=e=>{var t;return kd(Od)({mutationCb:fe,mousemoveCb:(e,t)=>th({type:Zl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.ViewportResize},e)}),inputCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.Input},e)}),mediaInteractionCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.MediaInteraction},e)}),styleSheetRuleCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.StyleSheetRule},e)}),styleDeclarationCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>th({type:Zl.IncrementalSnapshot,data:g({source:Yl.Font},e)}),selectionCb(e){th({type:Zl.IncrementalSnapshot,data:g({source:Yl.Selection},e)})},customElementCb(e){th({type:Zl.IncrementalSnapshot,data:g({source:Yl.CustomElement},e)})},blockClass:a,ignoreClass:d,ignoreSelector:p,maskTextClass:_,maskTextSelector:m,maskInputOptions:ce,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:E,maskTextFn:T,maskAllElementAttributes:I,maskAttributeFn:M,keepIframeSrcFn:re,blockSelector:u,slimDOMOptions:de,dataURLOptions:oe,mirror:hh,iframeManager:Se,stylesheetManager:be,shadowDomManager:Ee,processedNodeManager:ke,canvasManager:ih,ignoreCSSAttributes:ne,attributeFilter:se,plugins:(null==(t=null==ee?void 0:ee.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>th({type:Zl.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},R)};Se.addLoadListener((e=>{try{var t=hh.getId(e),r=Ie(e.contentDocument);if("function"==typeof r&&(Te.push(r),-1!==t)){var i=ge.get(t);i||ge.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Se.addPageHideListener((e=>{var t=hh.getId(e);null==he||he(t),Id(e)}));var Me=-1,Re=e=>th({type:Zl.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Pe=()=>{var e,t,r,i,n=document,s=null!==(e=null!==(t=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==t?t:n.msFullscreenElement)&&void 0!==e?e:null,o=s?hh.getId(s):-1;o!==Me&&(-1!==Me&&Re({id:Me,enter:!1}),Me=o,-1!==o&&Re({id:o,enter:!0}))},Fe=()=>{rh();var e=Ie(document);"function"==typeof e&&Te.push(e),Te.push(Gc("fullscreenchange",Pe)),Te.push(Gc("webkitfullscreenchange",Pe)),Te.push(Gc("mozfullscreenchange",Pe)),Te.push(Gc("MSFullscreenChange",Pe)),ch=!0};return["interactive","complete"].includes(document.readyState)?Fe():(Te.push(Gc("DOMContentLoaded",(()=>{th({type:Zl.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()}))),Te.push(Gc("load",(()=>{th({type:Zl.Load,data:{}}),"load"===G&&Fe()}),window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Te.forEach((e=>Kc(e))),ke.destroy(),Se.removeLoadListener(),Se.destroy(),ge.clear(),Ee.reset(),hh.reset(),ch=!1,fd=void 0}}catch(e){console.warn(e)}}gh.addCustomEvent=(e,t)=>{if(!ch)throw new Error("please add custom event after start recording");th({type:Zl.Custom,data:{tag:e,payload:t}})},gh.freezePage=()=>{Cd.forEach((e=>e.freeze()))},gh.takeFullSnapshot=e=>{if(!ch)throw new Error("please take full snapshot after start recording");rh(e)},gh.mirror=hh;var _h=Object.defineProperty,fh=(e,t,r)=>((e,t,r)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class mh{constructor(e){fh(this,"fileName"),fh(this,"functionName"),fh(this,"lineNumber"),fh(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var yh=/(^|@)\S+:\d+/,bh=/^\s*at .*(\S+:\d+|\(native\))/m,Sh=/^(eval@)?(\[native code])?$/,wh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(bh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter((function(e){return!!e.match(bh)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new mh({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Sh)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new mh({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new mh({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new mh({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new mh({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter((function(e){return!!e.match(yh)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new mh({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function kh(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var o=i.children[s];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&n.push(o)}n.length>1&&(r+=":eq("+n.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Ch(e){return Array.isArray(e)}function Eh(e){return"object"==typeof e&&null!==e&&!Ch(e)}function Th(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Eh(e[i])&&Th(e[i],t-1))return!0;return!1}function xh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],n=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,e):n.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Eh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Eh(o)&&Th(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=Ch(u)?kh(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var Ih={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Mh(e,t,r){var i,n=r?Object.assign({},Ih,r):Ih,s=n.logger;if(!s)return()=>{};i="string"==typeof s?t[s]:s;var o=0,a=!1,l=[];if(n.level.includes("error")){var u=t=>{var r=t.message,i=wh.parse(t.error).map((e=>e.toString())),s=[xh(r,n.stringifyOptions)];e({level:"error",trace:i,payload:s})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[xh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[xh("Uncaught (in promise)",n.stringifyOptions),xh(t.reason,n.stringifyOptions)]);var s=wh.parse(r).map((e=>e.toString()));e({level:"error",trace:s,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of n.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,s,l){try{if(!(s in t))return()=>{};var u=t[s],c={next:u},d=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=wh.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>xh(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[xh("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return c.next.apply(this,t)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),t[s]=d,()=>{if(t[s]!==d)for(var e=t[s];"function"==typeof e&&e.__rrweb_layer__;){var r=e.__rrweb_layer__;if(r.next===d)return void(r.next=c.next);e=r.next}else t[s]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Rh=e=>({name:"rrweb/console@1",observer:Mh,options:e}),Ph=e=>"undefined"!=typeof Document&&e instanceof Document,Fh=()=>{};function Lh(e,t,r){try{if(!(t in e))return Fh;var i={next:e[t]},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)}));return ne(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e[t];ne(r)&&r.__posthog_layer__;){var s=r.__posthog_layer__;if(s.next===n)return void(s.next=i.next);r=s.next}else e[t]=i.next}}catch(e){return Fh}}function Ah(e,t){var r,i=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),n={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of t.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Oh=$r("[Recorder]"),Dh=e=>"navigation"===e.entryType,Nh=e=>"resource"===e.entryType;function Bh(e,t){return!!t&&(ve(t)||t[e])}function qh(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var Hh=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function $h(e){var t=e.type,r=e.recordBody,i=e.headers;function n(e){var t=Object.keys(i).find((e=>"content-type"===e.toLowerCase())),r=t&&i[t];return e.some((e=>null==r?void 0:r.toLowerCase().includes(e)))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!qh(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(n(Hh))return!1;if(ve(r))return!0;if(ie(r))return n(r);var s=r[t];return ve(s)?s:n(s)}function Uh(e,t,r,i,n,s){return Wh.apply(this,arguments)}function Wh(){return Wh=v((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Oh.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var s=e.length-1;s>=0;s-=1)if(Nh(o=e[s])&&o.initiatorType===t&&(ae(i)||o.startTime>=i)&&(ae(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),Uh(e,t,r,i,n,s+1))})),Wh.apply(this,arguments)}function zh(e){var t=e.body,r=e.options,i=e.url;if(de(t))return null;var n=Ah(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(le(t))return t;if(Ph(t))return t.textContent;if(ge(t))return ri(t);if(se(t))try{return JSON.stringify(t)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}var Vh=e=>!ce(e)&&("navigation"===e.entryType||"resource"===e.entryType);function jh(e){var t=e.entry,r=e.method,i=e.status,n=e.networkRequest,s=e.isInitial,o=e.start,a=e.end,l=e.url,u=e.initiatorType;o=t?t.startTime:o,a=t?t.responseEnd:a;var c=Math.floor(Date.now()-performance.now()),d=Math.floor(c+(o||0)),h=[g({},t?t.toJSON():{name:l},{startTime:ae(o)?void 0:Math.round(o),endTime:ae(a)?void 0:Math.round(a),timeOrigin:c,timestamp:d,method:r,initiatorType:u||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Vh(t))for(var p of t.serverTiming||[])h.push({timeOrigin:c,timestamp:d,startTime:Math.round(t.startTime),name:p.name,duration:p.duration,entryType:"serverTiming"});return h}var Gh=["video/","audio/"];function Qh(e){return se(e)&&ne(e.getReader)&&ne(e.tee)}var Kh=500,Zh="[SessionReplay] Timeout while trying to read body",Yh="[SessionReplay] Failed to read body";function Jh(e){return Yh+": "+e}function Xh(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function ep(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(Zh)),Kh);try{e.clone().text().then((e=>t(e)),(e=>t(Jh(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(Yh)}}))}(e);var r=rn(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>t}catch(e){return!1}}(e,r)?Promise.resolve(Xh(r)):function(e,t){return new Promise((r=>{var i,n=!1;function s(){try{var e;null==(e=i)||e.cancel()}catch(e){}}function o(e){n||(n=!0,clearTimeout(l),s(),r(e))}var a,l=setTimeout((()=>o(Zh)),Kh);try{a=e.clone()}catch(e){return void o(Yh)}var u=a.body;if(Qh(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(Yh)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(n)s();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var n of e)r.set(n,i),i+=n.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(Xh(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(Jh(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(Jh(e))))}catch(e){o(Yh)}}))}(e,r)}function tp(){return tp=v((function*(e){var t=e.r,r=e.options,i=Ah(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):ep(t,r)})),tp.apply(this,arguments)}function rp(){return rp=v((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,n=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=Gh.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var a=Ah(n,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return ce(i)?ep(t,r):Promise.resolve(i)})),rp.apply(this,arguments)}var ip=null;function np(e,t,r){if(!("performance"in t))return()=>{};if(ip)return Oh.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},nn,r):nn,n=t=>{var r=[],n=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!n){var s=i.maskRequestFn(e);t||(n=!s||(e=>!!e&&hn.has(e))(s)),s&&r.push(s)}})),r.length>0&&e(g({},t,{requests:r}))},s=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Dh(e)||Nh(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>jh({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>Dh(e)||Nh(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>jh({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,t,i),o=()=>{},a=()=>{};return(i.recordHeaders||i.recordBody)&&(o=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Bh("request",r.recordHeaders),n=Bh("response",r.recordHeaders),s=Lh(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,v=new Request(a),g={},_={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(_[e]=t,f(e,t)),i&&(g.requestHeaders=_);var m=d.send.bind(d);d.send=e=>($h({type:"request",headers:_,url:a,recordBody:r.recordBody})&&(g.requestBody=zh({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",y),d.removeEventListener("abort",y),d.removeEventListener("timeout",y)},b=()=>{if(d.readyState===d.DONE){y(),p=t.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{var t=e.split(": "),r=t.shift(),n=t.join(": ");r&&(i[r]=n)})),n&&(g.responseHeaders=i),$h({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=zh({body:d.response,options:r,url:a})),Uh(t,"xmlhttprequest",v.url,h,p).then((t=>{var r=jh({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:g,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",y),d.addEventListener("abort",y),d.addEventListener("timeout",y)}catch(e){Oh.error("Failed to instrument XHR for network capture",e)}s.call(d,o,a.toString(),l,u,c)}));return()=>{s()}}(n,t,i),a=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=Bh("request",r.recordHeaders),n=Bh("response",r.recordHeaders),s=Lh(t,"fetch",(s=>function(){var o=v((function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return Oh.error("Failed to instrument fetch for network capture",e),s(o,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),i&&(h.requestHeaders=p),!Qh(null==a?void 0:a.body)&&$h({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return tp.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){Oh.error("Failed to record fetch request for network capture",e)}c=t.performance.now(),u=qh(o)?yield s(l):yield s(o,a),d=t.performance.now();var v={};return u.headers.forEach(((e,t)=>{v[t]=e})),n&&(h.responseHeaders=v),$h({type:"response",headers:v,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return rp.apply(this,arguments)}({r:u,options:r,url:o})),u}finally{Uh(t,"fetch",l.url,c,d).then((t=>{var r,i=jh({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return o.apply(this,arguments)}}()));return()=>{s()}}(n,t,i)),ip=()=>{s(),o(),a(),ip=null}}var sp=e=>({name:"rrweb/network@1",observer:np,options:e});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Rh,getRecordNetworkPlugin:sp},h.__PosthogExtensions__.rrweb={record:gh,version:"v2",wasMaxDepthReached:()=>Wc,resetMaxDepthState(){Wc=!1,Uc=!1},getLastSnapshotCost:()=>Tu,getMutationCost:()=>g({},Pu),resetSnapshotCostState(){wu=0,ku=0,Cu=0,fu=0,Eu=gu(),Tu=null,xu=null,Iu=[],Mu=0,Ru=0,Pu={slowestBatchMs:0},Fu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:gh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:Rh},h.getRecordNetworkPlugin=sp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Vl(e,t);var op,ap,lp,up,cp,dp,hp,pp,vp,gp,_p,fp,mp,yp,bp,Sp={},wp=[],kp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Cp=Array.isArray;function Ep(e,t){for(var r in t)e[r]=t[r];return e}function Tp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function xp(e,t,r){var i,n,s,o={};for(s in t)"key"==s?i=t[s]:"ref"==s?n=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?op.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===o[s]&&(o[s]=e.defaultProps[s]);return Ip(e,o,i,n,null)}function Ip(e,t,r,i,n){var s={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++lp:n,__i:-1,__u:0};return null==n&&null!=ap.vnode&&ap.vnode(s),s}function Mp(e){return e.children}function Rp(e,t){this.props=e,this.context=t}function Pp(e,t){if(null==t)return e.__?Pp(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?Pp(e):null}function Fp(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Ep({},t);s.__v=t.__v+1,ap.vnode&&ap.vnode(s),Up(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?Pp(t):r,!!(32&t.__u),n),s.__v=t.__v,s.__.__k[s.__i]=s,zp(i,s,n),t.__e=t.__=null,s.__e!=r&&Lp(s)}}function Lp(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some((function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e})),Lp(e)}function Ap(e){(!e.__d&&(e.__d=!0)&&up.push(e)&&!Op.__r++||cp!=ap.debounceRendering)&&((cp=ap.debounceRendering)||dp)(Op)}function Op(){try{for(var e,t=1;up.length;)up.length>t&&up.sort(hp),e=up.shift(),t=up.length,Fp(e)}finally{up.length=Op.__r=0}}function Dp(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,v,g,_,f,m=i&&i.__k||wp,y=t.length;for(l=function(e,t,r,i,n){var s,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(n),s=0;n>s;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[s]=Ip(null,o,null,null,null):Cp(o)?o=e.__k[s]=Ip(Mp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=Ip(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,l=s+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=Bp(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(n>c?h--:c>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[s]=null;if(d)for(s=0;c>s;s++)null!=(a=r[s])&&0==(2&a.__u)&&(a.__e==i&&(i=Pp(a)),Gp(a,a));return i}(r,t,m,l,y),d=0;y>d;d++)null!=(p=r.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Sp,p.__i=d,_=Up(e,p,h,n,s,o,a,l,u,c),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&jp(h.ref,null,p),c.push(p.ref,p.__c||v,p)),null==g&&null!=v&&(g=v),(f=!!(4&p.__u))||h.__k===p.__k?(l=Np(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==_?l=_:v&&(l=v.nextSibling),p.__u&=-7);return r.__e=g,l}function Np(e,t,r,i){var n,s;if("function"==typeof e.type){for(n=e.__k,s=0;n&&n.length>s;s++)n[s]&&(n[s].__=e,t=Np(n[s],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=Pp(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Bp(e,t,r,i){var n,s,o,a=e.key,l=e.type,u=t[r],c=null!=u&&0==(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return r;if(i>(c?1:0))for(n=r-1,s=r+1;n>=0||t.length>s;)if(null!=(u=t[o=0>n?s++:n--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function qp(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||kp.test(t)?r:r+"px"}function Hp(e,t,r,i,n){var s,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||qp(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||qp(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(_p,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?i?r[gp]=i[gp]:(r[gp]=fp,e.addEventListener(t,s?yp:mp,s)):e.removeEventListener(t,s?yp:mp,s);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function $p(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[vp])t[vp]=fp++;else if(r[gp]>t[vp])return;return r(ap.event?ap.event(t):t)}}}function Up(e,t,r,i,n,s,o,a,l,u){var c,d,h,p,v,g,_,f,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=ap.__b)&&c(t);e:if("function"==typeof E){d=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(c=E.contextType)&&i[c.__c],b=c?$?$.props.value:c.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new Rp(m,b),h.constructor=E,h.render=Qp),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Ep({},h.__s)),Ep(h.__s,E.getDerivedStateFromProps(m,h.__s))),v=h.props,g=h.state,h.__v=t,p)y&&null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&m!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),wp.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(v,g,_)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=ap.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),wp.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Ep(Ep({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,g)),k=null!=c&&c.type===Mp&&null==c.key?Vp(c.props.children):c,a=Dp(e,Cp(k)?k:[k],t,r,i,n,s,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=s&&(s[s.indexOf(a)]=null),t.__e=a}else{if(null!=s)for(C=s.length;C--;)Tp(s[C]);Wp(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||Wp(t);ap.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,v,g,_=r.props||Sp,f=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;s.length>u;u++)if((p=s[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,s[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(n,m,f.is&&f),a&&(ap.__m&&ap.__m(t,s),a=!1),s=null}if(null==m)_===f||a&&e.data==f||(e.data=f);else{if(s="textarea"==m&&null!=f.defaultValue?null:s&&op.call(e.childNodes),!a&&null!=s)for(_={},u=0;e.attributes.length>u;u++)_[(p=e.attributes[u]).name]=p.value;for(u in _)p=_[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||Hp(e,u,null,p,n);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?v=p:"checked"==u?g=p:a&&"function"!=typeof p||_[u]===p||Hp(e,u,p,_[u],n);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Dp("template"==t.type?e.content:e,Cp(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:r.__k&&Pp(r,0),a,l),null!=s)for(u=s.length;u--;)Tp(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==v?e.removeAttribute("value"):null!=v&&(v!==e[u]||"progress"==m&&!v||"option"==m&&v!=_[u])&&Hp(e,u,v,_[u],n),u="checked",null!=g&&g!=e[u]&&Hp(e,u,g,_[u],n))}return e}(r.__e,t,r,i,n,s,o,l,u);return(c=ap.diffed)&&c(t),128&t.__u?void 0:a}function Wp(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Wp))}function zp(e,t,r){for(var i=0;r.length>i;i++)jp(r[i],r[++i],r[++i]);ap.__c&&ap.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){ap.__e(e,t.__v)}}))}function Vp(e){return"object"!=typeof e||null==e||e.__b>0?e:Cp(e)?e.map(Vp):void 0!==e.constructor?null:Ep({},e)}function jp(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){ap.__e(e,r)}}function Gp(e,t,r){var i,n;if(ap.unmount&&ap.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||jp(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){ap.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&Gp(i[n],t,r||"function"!=typeof e.type);r||Tp(e.__e),e.__c=e.__=e.__e=void 0}function Qp(e,t,r){return this.constructor(e,r)}function Kp(e,t,r){var i,n,s;t==document&&(t=document.documentElement),ap.__&&ap.__(e,t),i=t.__k,n=[],s=[],Up(t,e=t.__k=xp(Mp,null,[e]),i||Sp,Sp,t.namespaceURI,i?null:t.firstChild?op.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),zp(n,e,s),e.props.children=null}op=wp.slice,ap={__e(e,t,r,i){for(var n,s,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},lp=0,Rp.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Ep({},this.state),"function"==typeof e&&(e=e(Ep({},r),this.props)),e&&Ep(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Ap(this))},Rp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ap(this))},Rp.prototype.render=Mp,up=[],dp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hp=function(e,t){return e.__v.__b-t.__v.__b},Op.__r=0,pp=Math.random().toString(8),vp="__d"+pp,gp="__a"+pp,_p=/(PointerCapture)$|Capture$/i,fp=0,mp=$p(!1),yp=$p(!0),bp=0;var Zp,Yp,Jp,Xp,ev=0,tv=[],rv=ap,iv=rv.__b,nv=rv.__r,sv=rv.diffed,ov=rv.__c,av=rv.unmount,lv=rv.__;function uv(e,t){rv.__h&&rv.__h(Yp,e,ev||t),ev=0;var r=Yp.__H||(Yp.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function cv(e){return ev=1,function(e,t,r){var i=uv(Zp++,2);if(i.t=e,!i.__c&&(i.__=[Sv(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,e);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=Yp,!Yp.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s){var a=s.call(this,e,t,r);return n?a||o:a}return!n||o};Yp.__f=!0;var s=Yp.shouldComponentUpdate,o=Yp.componentWillUpdate;Yp.componentWillUpdate=function(e,t,r){if(this.__e){var i=s;s=void 0,n(e,t,r),s=i}o&&o.call(this,e,t,r)},Yp.shouldComponentUpdate=n}return i.__N||i.__}(Sv,e)}function dv(e,t){var r=uv(Zp++,3);!rv.__s&&bv(r.__H,t)&&(r.__=e,r.u=t,Yp.__H.__h.push(r))}function hv(e){return ev=5,pv((function(){return{current:e}}),[])}function pv(e,t){var r=uv(Zp++,7);return bv(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function vv(e){var t=Yp.context[e.__c],r=uv(Zp++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(Yp)),t.props.value):e.__}function gv(){for(var e;e=tv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(mv),t.__h.some(yv),t.__h=[]}catch(r){t.__h=[],rv.__e(r,e.__v)}}}rv.__b=function(e){Yp=null,iv&&iv(e)},rv.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),lv&&lv(e,t)},rv.__r=function(e){nv&&nv(e),Zp=0;var t=(Yp=e.__c).__H;t&&(Jp===Yp?(t.__h=[],Yp.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&gv(),Zp=0)),Jp=Yp},rv.diffed=function(e){sv&&sv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==tv.push(t)&&Xp===rv.requestAnimationFrame||((Xp=rv.requestAnimationFrame)||fv)(gv)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),Jp=Yp=null},rv.__c=function(e,t){t.some((function(e){try{e.__h.some(mv),e.__h=e.__h.filter((function(e){return!e.__||yv(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],rv.__e(r,e.__v)}})),ov&&ov(e,t)},rv.unmount=function(e){av&&av(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{mv(e)}catch(e){t=e}})),r.__H=void 0,t&&rv.__e(t,r.__v))};var _v="function"==typeof requestAnimationFrame;function fv(e){var t,r=function(){clearTimeout(i),_v&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);_v&&(t=requestAnimationFrame(r))}function mv(e){var t=Yp,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),Yp=t}function yv(e){var t=Yp;e.__c=e.__(),Yp=t}function bv(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Sv(e,t){return"function"==typeof t?t(e):t}function wv(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&ne(r.then)&&r.then(void 0,(()=>{}))}}}}var kv={GZipJS:"gzip-js",Base64:"base64"},Cv={Activation:"events",Cancellation:"cancelEvents"},Ev={Button:"button",Tab:"tab",Selector:"selector"},Tv={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},xv={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Iv={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Mv={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Rv={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Pv={Once:"once",Recurring:"recurring",Always:"always"},Fv={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Lv={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"},Av={Popover:"popover",Inline:"inline"},Ov=$r("[Surveys]");function Dv(e){return!(!e.start_date||e.end_date)}function Nv(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var Bv="seenSurvey_",qv="inProgressSurvey_",Hv=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),$v=e=>Hv(Bv,e),Uv=e=>{try{var t=$v(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Ov.error("Failed to persist survey seen state",e)}},Wv=[Iv.Popover,Iv.Widget,Iv.API],zv={ignoreConditions:!1,ignoreDelay:!1,displayType:Av.Popover},Vv="featureFlags",jv="logs";Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return he(e)&&isFinite(e)&&Math.floor(e)===e});class Gv{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new Gv(n)}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 new Error("Invalid UUIDv7 was generated");return e}clone(){return new Gv(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class Qv{generate(){var e=this.generateOrAbort();if(!ae(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(ae(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Gv.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new Yv}}var Kv,Zv=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};e&&!ae(e.crypto)&&crypto.getRandomValues&&(Zv=e=>crypto.getRandomValues(e));class Yv{nextUint32(){return this._buffer.length>this._cursor||(Zv(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var Jv=()=>Xv().toString(),Xv=()=>(Kv||(Kv=new Qv)).generate(),eg="",tg=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var rg={_is_supported:()=>!!i,_error(e){Hr.error("cookieStore error: "+e)},_get:Fa,_parse(e){var t;try{t=JSON.parse(rg._get(e))||{}}catch(e){}return t},_set(e,t,r,n,s){if(!i)return!1;try{var o="",a="",l=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=i),eg)return eg;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),n=Math.min(r.length,8),s="dmn_chk_"+Jv();!eg&&n--;){var o=r.slice(n).join("."),a=s+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(s)&&(t.cookie=a+";max-age=0",eg=o)}return eg}(e);if(!r){var n=(e=>{var t=e.match(tg);return t?t[0]:""})(e);n!==r&&Hr.info("Warning: cookie subdomain discovery mismatch",n,r),r=n}return r?"; domain=."+r:""}return""}(i.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),o="; expires="+u.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Hr.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null!=i&&i.cookie)try{rg._set(e,"",-1,t)}catch(e){return}}},ig=null,ng={_is_supported(){if(!ce(ig))return ig;var t=!0;if(ae(e))t=!1;else try{var r="__mplssupport__";ng._set(r,"xyz"),'"xyz"'!==ng._get(r)&&(t=!1),ng._remove(r)}catch(e){t=!1}return t||Hr.error("localStorage unsupported; falling back to cookie store"),ig=t,t},_error(e){Hr.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){ng._error(e)}return null},_parse(e){try{return JSON.parse(ng._get(e))||{}}catch(e){}return null},_set(t,r){try{return null==e||e.localStorage.setItem(t,JSON.stringify(r)),!0}catch(e){ng._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){ng._error(e)}}},sg=[Xn,Vn,zn,Gn,Qn,Kn,ds,cs,ls],og=[gn,vn,An,On,ms,fs,hs],ag=e=>e+"_cpm",lg=["__proto__","constructor","prototype"],ug=e=>{if(!se(e))return{};var t={};return Object.keys(e).forEach((r=>{-1===lg.indexOf(r)&&(t[r]=e[r])})),t},cg=function(e,t){void 0===t&&(t=[]);var r={};return[...og,...t].forEach((t=>{var i=e[t];ae(i)||ce(i)||""===i||(r[t]=i)})),r},dg=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var n=e.charCodeAt(i);t=33*t^n,r=Math.imul(r^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},hg=(e,t)=>({p:t,f:dg(JSON.stringify(e))}),pg=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=rg._parse(ag(e)),i=(null==r?void 0:r.f)===dg(t)&&ie(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},vg=(e,t)=>t+"|"+(rg._get(ag(e))||""),gg={},_g={_is_supported:()=>!0,_error(e){Hr.error("memoryStorage error: "+e)},_get:e=>gg[e]||null,_parse:e=>gg[e]||null,_set:(e,t)=>(gg[e]=t,!0),_remove(e){delete gg[e]}},fg=null,mg={_is_supported(){if(!ce(fg))return fg;if(fg=!0,ae(e))fg=!1;else try{var t="__support__";mg._set(t,"xyz"),'"xyz"'!==mg._get(t)&&(fg=!1),mg._remove(t)}catch(e){fg=!1}return fg},_error(e){Hr.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){mg._error(e)}return null},_parse(e){try{return JSON.parse(mg._get(e))||null}catch(e){}return null},_set(t,r){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(r)),!0}catch(e){mg._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){mg._error(e)}}},yg=$r("[Stylesheet Loader]"),bg=e,Sg=i,wg="#020617",kg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:Tv.Right,widgetType:Ev.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:wg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Cg=[Tv.Center,Tv.Left,Tv.Right];function Eg(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Tg(e){var t;void 0===e&&(e=kg.backgroundColor),"#"===e[0]&&(t=Eg(e)),e.startsWith("rgb")&&(t=e);var r={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(r&&(t=Eg(r)),!t)return wg;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var n=parseInt(i[1]),s=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(n*n*.299+s*s*.587+o*o*.114)>127.5?wg:"white"}return wg}var xg=(e,t,r)=>{var i=jg(e),n=Sg.querySelector("."+i);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};var s=Sg.createElement("div");((e,t,r)=>{var i=g({},kg,r),n=e.style,s=!Cg.includes(i.position)||t===Iv.Widget&&(null==r?void 0:r.widgetType)===Ev.Tab;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(i.fontFamily)),n.setProperty("--ph-survey-box-padding",i.boxPadding),n.setProperty("--ph-survey-max-width",i.maxWidth),n.setProperty("--ph-survey-z-index",i.zIndex),n.setProperty("--ph-survey-border-color",i.borderColor),s?(n.setProperty("--ph-survey-border-radius",i.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",i.borderRadius+" "+i.borderRadius+" 0 0")),n.setProperty("--ph-survey-background-color",i.backgroundColor),n.setProperty("--ph-survey-box-shadow",i.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||Tg(i.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",Tg(i.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||Tg(i.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),n.setProperty("--ph-widget-color",i.widgetColor),n.setProperty("--ph-widget-text-color",Tg(i.widgetColor)),n.setProperty("--ph-widget-z-index",i.zIndex);var o=(null==r?void 0:r.inputBackground)||(null==r?void 0:r.inputBackgroundColor),a=o||i.inputBackground;o||"white"!==i.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);var l=(null==r?void 0:r.inputTextColor)||Tg(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",i.outlineColor)})(s,e.type,e.appearance),s.className=i;var o=s.attachShadow({mode:"open"}),a=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var n=(e=>{var t;return ne(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return n&&(i=n(i)),i||(yg.error("prepare_external_dependency_stylesheet returned null"),null)})(Sg,':host{--ph-survey-font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI","Roboto",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:2147483645;--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px rgba(0,0,0,.15);--ph-survey-submit-button-color:#000;--ph-survey-submit-button-text-color:#fff;--ph-survey-rating-bg-color:#fff;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:#000;--ph-survey-rating-active-text-color:#fff;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:#fff;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:rgba(59,130,246,.8);--ph-survey-input-background:#fff;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:0.6}.ph-survey{bottom:0;height:fit-content;margin:0;max-width:85%;min-width:300px;position:fixed;width:var(--ph-survey-max-width);z-index:var(--ph-survey-z-index)}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;color:var(--ph-survey-text-primary-color);font-family:var(--ph-survey-font-family)}.ph-survey .multiple-choice-options label,.ph-survey input[type=text],.ph-survey textarea{background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;color:var(--ph-survey-input-text-color);padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input[type=text],.ph-survey textarea{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus,.ph-survey input[type=radio]:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey textarea:focus,.ph-survey textarea:focus-visible{border-color:var(--ph-survey-rating-active-bg-color);outline:1.5px solid var(--ph-survey-outline-color);outline-offset:2px}.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey textarea:focus:not(:focus-visible){outline:none}.ph-survey input[type=text]:hover:not(:focus),.ph-survey textarea:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey input[type=text],.ph-survey textarea{font-size:1rem}}.ph-survey .form-cancel,.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit,.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey label{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);border:none;border-radius:3px 3px 0 0;color:var(--ph-widget-text-color);cursor:pointer;padding:10px 12px;position:fixed;text-align:center;transition:padding .2s ease-out;z-index:var(--ph-survey-z-index)}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{gap:16px}.bottom-section,.survey-box{display:flex;flex-direction:column}.bottom-section{gap:8px}.intro-screen-header~.bottom-section,.thank-you-message-header~.bottom-section{padding-top:16px}.intro-screen,.question-container,.thank-you-message{display:flex;flex-direction:column;gap:8px}.survey-question{font-size:14px;font-weight:500}.survey-question-description{font-size:13px;opacity:.8;padding-top:4px}.intro-screen-body,.survey-question-description,.thank-you-message-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video{height:auto;max-width:100%}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{height:auto;max-width:100%}.question-textarea-wrapper{display:flex;flex-direction:column}.survey-form{animation:ph-survey-fade-in .3s ease-out forwards}.intro-screen,.survey-form,.thank-you-message{background:var(--ph-survey-background-color);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);margin:0;padding:var(--ph-survey-box-padding);position:relative;text-align:left;width:100%;z-index:var(--ph-survey-z-index)}.survey-form input[type=text],.survey-form textarea{min-width:100%}:is(.survey-form textarea):focus,:is(.survey-form textarea):focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.08)}:is(.survey-form textarea):focus:not(:focus-visible){box-shadow:none}:is(.survey-box .question-header--empty)~.multiple-choice-options,:is(.survey-box .question-header--empty)~textarea{margin-top:0}.multiple-choice-options{border:none;display:flex;flex-direction:column;font-size:14px;gap:8px;margin:0;padding:1px 0}.multiple-choice-options .response-choice,.multiple-choice-options label{align-items:center;color:inherit;display:flex;gap:8px}.multiple-choice-options label{cursor:pointer;font-size:13px}:is(.multiple-choice-options label):hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px rgba(0,0,0,.08)}:is(.multiple-choice-options label):has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px rgba(0,0,0,.05)}.choice-option-open:is(.multiple-choice-options label){flex-wrap:wrap}:is(.multiple-choice-options label) span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--ph-survey-input-background);border-radius:3px;cursor:pointer;flex-shrink:0;height:1rem;position:relative;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;width:1rem;z-index:1}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{animation:ph-survey-checkmark-reveal .2s ease-out .1s forwards;border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;height:8px;left:4px;transform:rotate(45deg) scale(0);width:4px}.multiple-choice-options input[type=radio]:checked:after{animation:ph-survey-radio-reveal .15s ease-out .05s forwards;background:var(--ph-survey-rating-active-text-color);border-radius:50%;height:6px;left:5px;top:5px;transform:scale(0);width:6px}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{box-sizing:content-box;content:"";position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}:is(:is(.multiple-choice-options .choice-option-open) input[type=text])::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{display:flex;justify-content:space-between}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{background-color:transparent;border:none;font-size:16px;opacity:.5;padding:0}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;overflow:hidden}.rating-options-number .ratings-number{border:none;border-right:1px solid var(--ph-survey-border-color);color:var(--ph-survey-rating-text-color);cursor:pointer;font-weight:700;text-align:center}:is(.rating-options-number .ratings-number):last-of-type{border-right:0}.rating-active:is(.rating-options-number .ratings-number){background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb,var(--ph-survey-rating-active-bg-color) 14%,var(--ph-survey-rating-bg-color))}}.rating-text{font-size:11px;justify-content:space-between;opacity:.7}.form-buttons,.rating-text{display:flex;flex-direction:row}.form-buttons{gap:8px;width:100%}.form-buttons-with-back>.form-submit{flex:1 1 auto;min-width:0}.form-submit{background:var(--ph-survey-submit-button-color);border:none;border-radius:6px;box-shadow:0 2px 0 rgba(0,0,0,.045);color:var(--ph-survey-submit-button-text-color);cursor:pointer;font-weight:700;min-width:100%;padding:12px;text-align:center;user-select:none}.form-submit:not([disabled]):hover{box-shadow:0 4px 8px rgba(0,0,0,.1);transform:scale(1.02)}.form-submit:not([disabled]):active{box-shadow:0 1px 2px rgba(0,0,0,.05);transform:scale(.98)}.form-submit[disabled]{cursor:not-allowed;opacity:var(--ph-survey-disabled-button-opacity)}.form-back{background:transparent;border:1.5px solid var(--ph-survey-border-color);border-radius:6px;color:var(--ph-survey-text-primary-color);cursor:pointer;flex:0 0 auto;font-weight:600;padding:12px 16px;text-align:center;user-select:none}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{font-size:12px;margin-top:4px;opacity:.7}.form-cancel{background:#fff;border-radius:100%;cursor:pointer;line-height:0;padding:12px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%) scale(1.1)}.footer-branding{align-items:center;display:flex;font-size:11px;font-weight:500;gap:4px;justify-content:center;opacity:.6;text-decoration:none}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{font-size:14px;opacity:.8}.intro-screen{animation:ph-survey-fade-in .3s ease-out forwards;text-align:center}.intro-screen-header{margin:10px 0 0}.intro-screen-body{font-size:14px;opacity:.8}.limit-height{max-height:256px;overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);scrollbar-width:thin}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}:is(.limit-height::-webkit-scrollbar-thumb):hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media (prefers-reduced-motion:reduce){.ph-survey *{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg) scale(0)}50%{opacity:1;transform:rotate(45deg) scale(1.2)}to{opacity:1;transform:rotate(45deg) scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){var l=o.querySelector("style");l&&o.removeChild(l),o.appendChild(a)}return Sg.body.appendChild(s),{shadow:o,isNewlyCreated:!0}},Ig=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,n=e.posthog,s=e.isSurveyCompleted,o=e.properties,a=e.surveyLanguage;n?(Uv(r),n.capture(Fv.SENT,g({[Lv.SURVEY_NAME]:r.name,[Lv.SURVEY_ID]:r.id,[Lv.SURVEY_ITERATION]:r.current_iteration,[Lv.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[Lv.SURVEY_SUBMISSION_ID]:i,[Lv.SURVEY_COMPLETED]:s},a&&{[Lv.SURVEY_LANGUAGE]:a},{sessionRecordingUrl:null==n.get_session_replay_url?void 0:n.get_session_replay_url()},da(t,r),o,{$set:{[ha(r,"responded")]:!0}})),s&&(bg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),Vg(r),n.reloadFeatureFlags())):Ov.error("[survey sent] event not captured, PostHog instance not found.")},Mg=(e,t,r)=>{return g({[Lv.SURVEY_NAME]:e.name,[Lv.SURVEY_ID]:e.id,[Lv.SURVEY_ITERATION]:e.current_iteration,[Lv.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[Lv.SURVEY_PARTIALLY_COMPLETED]:(i=null==t?void 0:t.responses,void 0===i&&(i={}),Object.values(i).some((e=>!de(e))))},(null==t?void 0:t.surveyLanguage)&&{[Lv.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[Lv.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},da(null==t?void 0:t.responses,e));var i},Rg=(e,t,r,i)=>{if(t){if(!r){var n=Wg(e);t.capture(Fv.DISMISSED,g({},Mg(e,n,t),i&&{[Lv.SURVEY_LANGUAGE]:i},{$set:{[ha(e,"dismissed")]:!0}})),Vg(e),Uv(e),bg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else Ov.error("[survey dismissed] event not captured, PostHog instance not found.")},Pg=(e,t)=>{if(t){var r=(e=>Hv("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=Wg(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Fv.ABANDONED,Mg(e,i,t),{transport:"sendBeacon"})}}else Ov.error("[survey abandoned] event not captured, PostHog instance not found.")},Fg=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Lg=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Ag=e=>{var t=e.map((e=>e.id));return t.every((e=>!!e))?t:void 0},Og=(e,t)=>{return(e=>e.questions.some((e=>{var t;return!(null==(t=e.branching)||!t.type)})))(e)?e.questions:t?null!==(r=((e,t)=>{if(!t||t.length!==e.questions.length)return null;var r=new Map(e.questions.map((e=>[e.id,e]))),i=[];for(var n of t){var s=r.get(n);if(!s)return null;i.push(s)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Lg(e.questions,Fg(e.questions)):e.questions;var r},Dg=e=>ya(e)||zg(e),Ng=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach((function(e){e.__e=!0,Ap(e)}))},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+bp++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Bg=()=>vv(Ng),qg=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,n,s,o,a=Ep({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==s?i=t[s]:"ref"==s?n=t[s]:a[s]=void 0===t[s]&&null!=o?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?op.call(arguments,2):r),Ip(e.type,a,i||e.key,n||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Hg(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=ui(t);if(!n)return!1;var s=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return wa[o](s,[n])}var $g=e=>Hv(qv,e),Ug=(e,t)=>{try{localStorage.setItem($g(e),JSON.stringify(t))}catch(e){Ov.error("Error setting in-progress survey state in localStorage",e)}},Wg=e=>{try{var t=localStorage.getItem($g(e));if(t)return JSON.parse(t)}catch(e){Ov.error("Error getting in-progress survey state from localStorage",e)}return null},zg=e=>{var t=Wg(e);return!de(null==t?void 0:t.surveySubmissionId)},Vg=e=>{try{localStorage.removeItem($g(e))}catch(e){Ov.error("Error clearing in-progress survey state from localStorage",e)}};function jg(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function Gg(e,t,r){if(void 0===t&&(t=Tv.Right),e===Iv.ExternalSurvey)return{};switch(t){case Tv.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case Tv.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case Tv.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case Tv.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case Tv.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case Tv.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case Tv.Left:return{left:"30px"};case Tv.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Iv.Widget&&r===Ev.Tab?"60px":"30px"}}}var Qg=0;function Kg(e,t,r,i,n,s){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Qg,__i:-1,__u:0,__source:n,__self:s};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return ap.vnode&&ap.vnode(u),u}var Zg=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Kg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Yg=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Kg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Jg=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Kg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Xg=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Kg("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),e_=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Kg("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),t_=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Kg("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),r_=Kg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Kg("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),i_=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return Kg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:r,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Kg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Kg("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:r})]})},n_=Kg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Kg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Kg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Kg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Kg("g",{mask:"url(#mask0_2415_6911)",children:[Kg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Kg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Kg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Kg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Kg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Kg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Kg("defs",{children:Kg("clipPath",{id:"clip0_2415_6911",children:Kg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function s_(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return Kg("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",n_]})}function o_(t){var r=t.text,i=t.submitDisabled,n=t.appearance,s=t.onSubmit,o=t.link,a=t.onPreviewSubmit,l=t.skipSubmitButton,u=t.canGoBack,c=t.onBack,d=vv(Ng).isPreviewMode,h=!!u&&!!c,p=!l&&Kg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){o&&(null==e||e.open(o)),d?null==a||a():s()},children:r});return Kg("div",{className:"bottom-section",children:[h?Kg("div",{className:"form-buttons form-buttons-with-back",children:[Kg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:n.backButtonText||"Back"}),p]}):p,!n.whiteLabel&&Kg(s_,{urlParams:{utm_source:"survey-footer"}})]})}function a_(e){var t=e.question,r=e.forceDisableHtml;return Kg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Kg(t.type===Mv.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&qg({component:xp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function l_(e){return Kg("button",{className:"form-cancel",onClick:e.onClick,disabled:vv(Ng).isPreviewMode,"aria-label":"Close survey",type:"button",children:i_({fill:"black"})})}Kg("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Kg("path",{d:"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z",fill:"currentColor"})});var u_=e;function c_(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onClose,a=vv(Ng).isPopup;return dv((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Yr(u_,"keydown",e),()=>{u_.removeEventListener("keydown",e)}}),[o]),Kg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&Kg(l_,{onClick:()=>o()}),Kg("h3",{className:"thank-you-message-header",children:t}),r&&qg({component:xp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&Kg(o_,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}function d_(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onStart,a=vv(Ng),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return Kg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==s.hideCancelButton&&Kg(l_,{onClick:()=>u()}),t&&Kg("h3",{className:"intro-screen-header",children:t}),r&&qg({component:xp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!n&&"text"!==i}),Kg(o_,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var h_=e=>ie(e)&&e.every((e=>le(e)));function p_(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,n=e.onSubmit,s=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=Bg().isPreviewMode,d=hv(null),h=cv((()=>le(a)?a:"")),p=h[0],v=h[1],g=null==i?void 0:i.disableAutofocus;dv((()=>{g||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,g]);var _="surveyQuestion"+o,f=pv((()=>function(e,t,r){var i,n,s=e.trim();if(!r&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case T:if(void 0!==o.value&&o.value>s.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case x:if(void 0!==o.value&&s.length>o.value)return null!==(n=o.errorMessage)&&void 0!==n?n:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=rr(t.validation,T),y=rr(t.validation,x),b=pv((()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y)),[m,y]),S=()=>{f||n(p.trim())},w=()=>{f||s(p.trim())};return Kg(Mp,{children:[Kg("div",{className:"question-container",children:[Kg(a_,{question:t,forceDisableHtml:r,htmlFor:_}),Kg("textarea",{ref:d,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){v(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),c?w():S())},value:p}),b&&Kg("div",{className:"validation-hint",children:b})]}),Kg(o_,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function v_(e){var t=e.question,r=e.appearance,i=e.onSubmit,n=e.onPreviewSubmit,s=e.canGoBack,o=e.onBack;return Kg(Mp,{children:[Kg("div",{className:"question-container",children:Kg(a_,{question:t,forceDisableHtml:e.forceDisableHtml})}),Kg(o_,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:s,onBack:o})]})}function g_(e){var t,r=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=r.scale,h=10===r.scale?0:1,p=cv((()=>he(l)?l:ie(l)&&l.length>0&&he(parseInt(l[0]))?parseInt(l[0]):le(l)&&he(parseInt(l))?parseInt(l):null)),v=p[0],g=p[1],_="emoji"===r.display&&2===r.scale,f=Bg().isPreviewMode,m=e=>f?a(e):o(e);return Kg(Mp,{children:[Kg("div",{className:"question-container",children:[Kg(a_,{question:r,forceDisableHtml:i}),Kg("div",{className:"rating-section",children:[Kg("div",{className:"rating-options",children:["emoji"===r.display&&Kg("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:null==(t=S_[r.scale])?void 0:t.map(((e,t)=>Kg("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===v?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;g(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&Kg("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:w_(r.scale).map(((e,t)=>Kg(__,{displayQuestionIndex:n,active:v===e,appearance:s,num:e,setActiveNumber(e){g(e),r.skipSubmitButton&&m(e)}},t)))})]}),!_&&Kg("div",{className:"rating-text",children:[Kg("div",{children:r.lowerBoundLabel}),Kg("div",{children:r.upperBoundLabel})]})]})]}),Kg(o_,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:ce(v)&&!r.optional,appearance:s,onSubmit:()=>o(v),onPreviewSubmit:()=>a(v),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function __(e){var t=e.num,r=e.setActiveNumber;return Kg("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function f_(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,n=e.appearance,s=e.onSubmit,o=e.onPreviewSubmit,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=hv(null),d=pv((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Lg(t,Fg(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),h=cv((()=>((e,t)=>le(e)||h_(e)?e:t===Mv.SingleChoice?null:[])(a,t.type))),p=h[0],v=h[1],_=cv((()=>((e,t)=>{if(le(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(h_(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(a,d))),f=_[0],m=_[1],y=Bg().isPreviewMode,b=t.type===Mv.SingleChoice,S=t.type===Mv.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m((e=>g({},e,{isSelected:r,inputValue:r?e.inputValue:""}))),b&&v(""),void(r&&setTimeout((()=>{var e;return null==(e=c.current)?void 0:e.focus()}),75))}if(b)return v(e),m((e=>g({},e,{isSelected:!1,inputValue:""}))),void(w&&(s(e),y&&o(e)));S&&ie(p)&&(p.includes(e)?v(p.filter((t=>t!==e))):v([...p,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>g({},e,{inputValue:t}))),b&&v(t)},E=e=>{e.stopPropagation(),"Enter"!==e.key||T()||(e.preventDefault(),x()),"Escape"===e.key&&(e.preventDefault(),m((e=>g({},e,{isSelected:!1,inputValue:""}))),b&&v(null))},T=()=>!(t.optional||!ce(p)&&(!ie(p)||f.isSelected||0!==p.length)&&(!f.isSelected||""!==f.inputValue.trim())),x=()=>{f.isSelected&&S?ie(p)&&(y?o([...p,f.inputValue]):s([...p,f.inputValue])):y?o(p):s(p)};return Kg(Mp,{children:[Kg("div",{className:"question-container",children:[Kg(a_,{question:t,forceDisableHtml:r}),Kg("fieldset",{className:"multiple-choice-options limit-height",children:[Kg("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),d.map(((e,r)=>{var n=!!t.hasOpenChoice&&r===t.choices.length-1,s="surveyQuestion"+i+"Choice"+r,o=s+"Open",a=n?f.isSelected:b?p===e:ie(p)&&p.includes(e);return Kg("label",{className:n?"choice-option-open":"",children:[Kg("div",{className:"response-choice",children:[Kg("input",{type:b?"radio":"checkbox",name:s,checked:a,onChange:()=>k(e,n),id:s,"aria-controls":o}),Kg("span",{children:n?e+":":e})]}),n&&Kg("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:E,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),Kg(o_,{text:t.buttonText||"Submit",submitDisabled:T(),appearance:n,onSubmit:x,onPreviewSubmit:x,skipSubmitButton:w,canGoBack:l,onBack:u})]})}var m_=[1,2,3,4,5],y_=[1,2,3,4,5,6,7],b_=[0,1,2,3,4,5,6,7,8,9,10],S_={2:[t_,r_],3:[Jg,Yg,Zg],5:[Xg,Jg,Yg,Zg,e_]};function w_(e){switch(e){case 5:default:return m_;case 7:return y_;case 10:return b_}}var k_=$r("[Surveys]");function C_(e,t,r){var i,n=e.questions[t],s=t+1;if(null==(i=n.branching)||!i.type)return t===e.questions.length-1?Rv.End:s;if(n.branching.type===Rv.End)return Rv.End;if(n.branching.type===Rv.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===Rv.ResponseBased){if(n.type===Mv.SingleChoice){var o,a=n.choices.indexOf(""+r);if(-1===a&&n.hasOpenChoice&&(a=n.choices.length-1),null!=(o=n.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=n.branching.responseValues[a];return Number.isInteger(l)?l:l===Rv.End?Rv.End:s}}else if(n.type===Mv.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var c=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,n.scale);if(null!=(u=n.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=n.branching.responseValues[c];return Number.isInteger(d)?d:d===Rv.End?Rv.End:s}}return s}return k_.warn("Falling back to next question index due to unexpected branching type"),s}var E_=$r("[SurveyTranslations]");function T_(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,n=pa(e.overrideLanguage);if(n)return null==t||t.info("Using override display language: "+n),n;var s=function(e){return e&&"object"==typeof e&&"language"in e?pa(e.language):null}(r);if(s)return null==t||t.info("Using person property language: "+s),s;var o=pa(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:ne(e.get_property)?e.get_property(Xn):void 0,locale:$a()},E_)}(t);if(!r)return E_.info("No user language detected"),{survey:e,language:null};var i=fa(e,r,E_);return{survey:i.survey,language:i.matchedKey}}var x_=-1,I_=e,M_=i,R_="ph:show_survey_widget",P_="PHWidgetSurveyClickListener";function F_(e,t){try{var r=e.getBoundingClientRect(),i=I_.innerHeight,n=I_.innerWidth,s=r.left+r.width/2-t/2;s+t>n-20&&(s=n-t-20),20>s&&(s=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:s+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:kg.zIndex}}catch(e){return Ov.warn("Failed to calculate trigger position:",e),null}}class L_{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this.handlePageUnload=()=>{var e=this._posthog.get_property(rs);if(e)for(var t of e)zg(t)&&Pg(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var n,s,o,a,l,u=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==u&&u,d=t._translateSurveyForRendering(e),h=d.survey,p=d.language,v=null!=r&&r.position||null!=r&&r.selector?g({},h,{appearance:g({},h.appearance,r.position&&{position:r.position},r.selector&&{widgetSelector:r.selector})}):h;t._clearSurveyTimeout(v.id);var _=null!=r?r:{},f=_.properties,m=_.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(v,m,f,p);if(!y||null!=(n=v.appearance)&&n.displayThankYouMessage){t._addSurveyToFocus(v);var b={};if((null==(s=v.appearance)?void 0:s.position)===Tv.NextToTrigger&&null!=(o=v.appearance)&&o.widgetSelector){var S,w=M_.querySelector(v.appearance.widgetSelector);w&&(b=F_(w,parseInt((null==(S=v.appearance)?void 0:S.maxWidth)||kg.maxWidth))||{})}var k=(null==(a=v.appearance)?void 0:a.surveyPopupDelaySeconds)||0,C=xg(v,t._posthog).shadow;t._renderedTargets.set(C,C.host);var E={posthog:t._posthog,survey:v,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:p};if(0>=k)return Kp(Kg(B_,g({},E)),C);var T=()=>{if(!t._shouldDisplaySurvey(v))return Ov.info("Survey "+v.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(v);Kp(Kg(B_,g({},E,{survey:g({},v,{appearance:g({},v.appearance,{surveyPopupDelaySeconds:0})})})),C)},x=c?null==(l=t._posthog.surveys)||null==(l=l._surveyEventReceiver)||null==l.getActivationTimestamp?void 0:l.getActivationTimestamp(v.id):void 0,I=he(x)?Math.max(0,Date.now()-x):0,M=Math.max(0,1e3*k-I);if(0>=M)return T();var R=I_.setTimeout((()=>{t._surveyTimeouts.delete(v.id),T()}),M);t._surveyTimeouts.set(v.id,R)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xg(r,this._posthog),s=n.shadow,o=n.isNewlyCreated;this._renderedTargets.set(s,s.host),o&&Kp(Kg(H_,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),s)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(P_),this._widgetSelectorListeners.delete(e),Ov.info("Removed click listener for survey "+e))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._isWidgetSurveyOpen=e=>{try{var t,r=M_.querySelector(jg(e,!0));return!(null==r||null==(t=r.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=M_.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;Ov.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(P_)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===Tv.NextToTrigger?F_(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||kg.maxWidth)):{};I_.dispatchEvent(new CustomEvent(R_,{detail:{surveyId:e.id,position:n}}))};Yr(r,"click",n),r.setAttribute(P_,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),Ov.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=xg(r,this._posthog).shadow;this._renderedTargets.set(n,n.host),Kp(Kg(B_,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),n)},this.renderSurvey=(e,t,r)=>{var i,n=this._translateSurveyForRendering(e),s=n.survey,o=n.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(s,o,r)),Kp(Kg(B_,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys((r=>{var i=r.filter((e=>t._shouldDisplaySurvey(e)));e(i)}),r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys((e=>{var r=e.filter((e=>e.type===Iv.Popover||e.type===Iv.Widget)),i=new Set(r.map((e=>e.id)));for(var n of Array.from(t._surveyTimeouts.keys()))i.has(n)||t.cancelSurvey(n);var s=t._sortSurveysByAppearanceDelay(r),o=new Set;s.forEach((e=>{if(e.type===Iv.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===Ev.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Ev.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}ce(t._surveyInFocus)&&e.type===Iv.Popover&&t.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})})),t._widgetSelectorListeners.forEach((e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{ce(this._surveyInFocus)||Ov.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&Ov.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,Vv))&&void 0!==e?e:this._posthog.featureFlags}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(Ov.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._surveyTimeouts.forEach(((e,t)=>this._clearSurveyTimeout(t))),this._widgetSelectorListeners.forEach(((e,t)=>this._detachWidgetSelectorListener(t))),this._renderedTargets.forEach(((e,t)=>{Kp(null,t),null==e||e.remove()})),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,n=zg(e),s=zg(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===Pv.Always,a=t.schedule===Pv.Always;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)}))}_translateSurveyForRendering(e){return T_(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=I_.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var o=s.split("="),a=o[0],l=o[1];if(a&&!ae(l)){var u=decodeURIComponent(a),c=decodeURIComponent(l);if("auto_submit"!==u||"true"!==c){var d=u.match(/^q(\d+)$/);if(d){var h=parseInt(d[1],10);t[h]||(t[h]=[]),t[h].push(c)}}else r=!0}}return{params:t,autoSubmit:r}}(),n=i.params;if(0===Object.keys(n).length)return!1;Ov.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,n,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,r,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var n=t.responses,s=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Ig({responses:o?n:a,survey:e,surveySubmissionId:s,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var n={};for(var s of Object.entries(t)){var o=s[1];n[parseInt(s[0])]=ie(o)?o.map(String):[String(o)]}Ov.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);return!!a&&(this._autoSubmitPrefilledResponses(e,a,r,i),a.isSurveyCompleted)}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach(((e,i)=>{if(t[i]&&e.id){var n=t[i],s=ua(e.id);try{switch(e.type){case Mv.SingleChoice:if(!e.choices||0===e.choices.length)return void Hr.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(n[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void Hr.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case Mv.MultipleChoice:if(!e.choices||0===e.choices.length)return void Hr.warn("[Survey Prefill] Question "+i+" has no choices");var a=n.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void Hr.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&Hr.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case Mv.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void Hr.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:Hr.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){Hr.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return Ov.warn("[Survey Prefill] No valid responses after conversion"),null;var n=Jv(),s=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,n={},s=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=ua(l.id);ae(r[u])||(n[u]=r[u])}s.push(i);var c=C_(e,i,l.id?r[ua(l.id)]:null);if(c===Rv.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:s};i=c}return{startQuestionIndex:i,skippedResponses:n,skippedIndices:s}}(e,s,i),a=o.startQuestionIndex,l=o.skippedResponses,u=o.skippedIndices,c=a>=e.questions.length;return Ug(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:a,questionOrder:Ag(e.questions),visitedIndices:u,surveyLanguage:r}),Ov.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:a,isSurveyCompleted:c,skippedResponses:l}}catch(e){return Ov.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){if(void 0===t&&(t=void 0),!e)return!0;var r=this._featureFlags,i=!(null==r||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),n=!0;return t&&(n=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&n}_isSurveyConditionMatched(t){return!t.conditions||Hg(t,this._posthog)&&function(t){var i,n;return function(t,i){var n,s,o;if(!t||0===t.length)return!0;if(!u)return!1;var a=Ft(u,{userAgentDataPlatform:null==r||null==(n=r.userAgentData)?void 0:n.platform,maxTouchPoints:null==r?void 0:r.maxTouchPoints,screenWidth:null==e||null==(s=e.screen)?void 0:s.width,screenHeight:null==e||null==(o=e.screen)?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return wa[null!=i?i:"icontains"](t,[a])}(null==(i=t.conditions)?void 0:i.deviceTypes,null==(n=t.conditions)?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==Sg||!Sg.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return Dg(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!Dv(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!Wv.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var n=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var s,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=new Date,n=Math.abs(i.getTime()-r.getTime());return Math.ceil(n/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,ng._get("lastSeenSurveyDate"))?(e=>!!ng._get($v(e))&&!Dg(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(s=o.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!ma(e)&&!Nv(e))return!0;var r=null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)?void 0:t.getSurveys();return!(null==r||!r.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every((e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=M_.querySelector(jg(e,!0));null!=t&&t.shadowRoot&&(Kp(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){Ov.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this)}}}function A_(e,t){if(M_&&I_){var r,i=new L_(e);if(e.config.disable_surveys_automatic_display)return Ov.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return Ov.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{ae(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))},s=()=>{ae(r)||(clearInterval(r),r=void 0)};n();var o=()=>{M_.hidden?s():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return Yr(M_,"visibilitychange",o),i.setAutomaticDisplayDispose((()=>{s(),M_.removeEventListener("visibilitychange",o)})),i}}function O_(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,n=e.setSurveyVisible,s=e.isPreviewMode,o=void 0!==s&&s,a=e.posthog;dv((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===Iv.Widget,s=Hg(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===Ev.Tab&&r;if(!s)return Ov.info("Hiding survey "+t.id+" because URL does not match"),n(!1),i(t);o&&(Ov.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),n(!0))};Yr(I_,"popstate",r),Yr(I_,"hashchange",r);var s=I_.history.pushState,l=I_.history.replaceState;return I_.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.apply(this,t),r()},I_.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{I_.removeEventListener("popstate",r),I_.removeEventListener("hashchange",r),I_.history.pushState=s,I_.history.replaceState=l}}}),[o,t,i,n,a])}var D_=200;function N_(e){switch(void 0===e&&(e=xv.Right),e){case xv.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case xv.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case xv.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function B_(e){var t,r,i,n,s,o,a,l,u,c,d,h,p=e.survey,v=e.forceDisableHtml,_=e.posthog,f=e.style,m=void 0===f?{}:f,y=e.previewPageIndex,b=e.removeSurveyFromFocus,S=void 0===b?()=>{}:b,w=e.isPopup,k=void 0===w||w,C=e.onPreviewSubmit,E=void 0===C?()=>{}:C,T=e.onPreviewBack,x=void 0===T?()=>{}:T,I=e.onPopupSurveyDismissed,M=void 0===I?()=>{}:I,R=e.onCloseConfirmationMessage,P=void 0===R?()=>{}:R,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=hv(null),N=Number.isInteger(y),B=null!=(t=p.appearance)&&t.surveyPopupDelaySeconds?1e3*p.appearance.surveyPopupDelaySeconds:0,q=function(e,t,r,i,n,s,o,a,l){var u=cv(i||0===r||e.type===Iv.ExternalSurvey),c=u[0],d=u[1],h=cv(!1),p=h[0],v=h[1],_=hv(!1),f=()=>{var t=()=>{s&&n(e),d(!1)};if(!_.current){var r=null==o?void 0:o.current;r?(_.current=!0,r.style.transition="opacity "+D_+"ms ease-out",r.style.opacity="0",setTimeout((()=>{_.current=!1,t()}),D_+50)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return dv((()=>{if(t){if(!i){var n,s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();v(!0),null!=(i=e.appearance)&&i.autoDisappear&&(n&&clearTimeout(n),n=setTimeout(f,5e3))}},o=()=>{if(Hg(e,t)){d(!0),I_.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(Fv.SHOWN,g({[Lv.SURVEY_NAME]:e.name,[Lv.SURVEY_ID]:e.id,[Lv.SURVEY_ITERATION]:e.current_iteration,[Lv.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[Lv.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};Yr(I_,"PHSurveyClosed",m),Yr(I_,"PHSurveySent",s);var u=r>0?setTimeout(o,r):void 0;return ae(u)&&o(),()=>{ae(u)||clearTimeout(u),ae(n)||clearTimeout(n),I_.removeEventListener("PHSurveyClosed",m),I_.removeEventListener("PHSurveySent",s)}}}else Ov.error("usePopupVisibility hook called without a PostHog instance.")}),[]),O_({survey:e,removeSurveyFromFocus:n,setSurveyVisible:d,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:p,setIsPopupVisible:d,hidePopupWithAnimation:f}}(p,_,B,N,S,k,D,A,O),H=q.isPopupVisible,U=q.hidePopupWithAnimation,W=q.isSurveySent||y===p.questions.length||!0===L,z=cv(!1),V=z[0],j=z[1],G=pv((()=>!!Wg(p)),[p]),Q=!!(null!=(r=p.appearance)&&r.introScreenHeader||null!=(i=p.appearance)&&i.introScreenDescription),K=N?y===x_:!(null==(n=p.appearance)||!n.displayIntroScreen)&&Q&&!V&&!G,Z=pv((()=>{var e=Wg(p),t=(null==e?void 0:e.surveySubmissionId)||Jv();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?Rg(p,_,N,O):Rg(p,_,N),M()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:E,onPreviewBack:x,posthog:_,properties:F,surveyLanguage:O}}),[N,y,k,_,p,M,E,x,F,O]);return H?Kg(Ng.Provider,{value:Z,children:Kg("div",{className:"ph-survey",style:g({},Gg(p.type,null==(s=p.appearance)?void 0:s.position,null==(o=p.appearance)?void 0:o.widgetType),m),ref:D,children:W?Kg(c_,{header:(null==(a=p.appearance)?void 0:a.thankYouMessageHeader)||"Thank you!",description:(null==(l=p.appearance)?void 0:l.thankYouMessageDescription)||"",forceDisableHtml:!!v,contentType:null==(u=p.appearance)?void 0:u.thankYouMessageDescriptionContentType,appearance:p.appearance||kg,onClose(){U(),P()}}):K?Kg(d_,{header:(null==(c=p.appearance)?void 0:c.introScreenHeader)||"",description:(null==(d=p.appearance)?void 0:d.introScreenDescription)||"",forceDisableHtml:!!v,contentType:null==(h=p.appearance)?void 0:h.introScreenDescriptionContentType,appearance:p.appearance||kg,onStart:()=>j(!0)}):Kg(q_,{survey:p,forceDisableHtml:!!v,posthog:_})})}):null}function q_(e){var t,r,i=e.survey,n=e.forceDisableHtml,s=e.posthog,o=pv((()=>{var e=Wg(i);if(!e)return null;var t=he(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(Vg(i),null)}),[i]),a=cv((()=>(null!=o&&o.responses&&Ov.info("Survey is already in progress, filling in initial responses"),(null==o?void 0:o.responses)||{}))),l=a[0],u=a[1],c=vv(Ng),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,v=c.onPreviewSubmit,_=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=cv((()=>{var e=null==o?void 0:o.lastQuestionIndex,t=he(e)&&e>=0&&i.questions.length>e?e:0;return he(d)&&d>=0?d:t})),w=S[0],k=S[1],C=cv((()=>{var e;return(null!==(e=null==o?void 0:o.visitedIndices)&&void 0!==e?e:[]).filter((e=>e>=0&&i.questions.length>e))})),E=C[0],T=C[1],x=pv((()=>Og(i,o)),[i,o]);dv((()=>{!m||ae(d)||0>d||k(d)}),[d,m]);var I=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=d?d:0)>0:E.length>0),M=x.at(w);return M?Kg("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&Kg(l_,{onClick(){h()}}),Kg("div",{className:"survey-box","data-question-index":w,children:$_({question:M,forceDisableHtml:n,displayQuestionIndex:w,appearance:i.appearance||kg,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,n=e.questionId;if(s)if(n){var o=ua(n),a=g({},l,{[o]:t});u(a);var c=C_(i,r,t),d=c===Rv.End,h=[...E,r];if(d||(T(h),k(c),Ug(i,{surveySubmissionId:f,responses:a,lastQuestionIndex:c,questionOrder:Ag(x),visitedIndices:h,surveyLanguage:b})),i.enable_partial_responses||d){var p=new Set(h.map((e=>{var t;return null==(t=x[e])?void 0:t.id})).filter((e=>!!e)).map((e=>ua(e)))),v=Object.fromEntries(Object.entries(a).filter((e=>p.has(e[0]))));Ig({responses:v,survey:i,surveySubmissionId:f,isSurveyCompleted:d,posthog:s,properties:y,surveyLanguage:b})}}else Ov.error("onNextButtonClick called without a questionId.");else Ov.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?l[ua(M.id)]:void 0,canGoBack:I,onBack(){if(m)_();else if(0!==E.length){var e=E[E.length-1],t=E.slice(0,-1);T(t),k(e),Ug(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:e,questionOrder:Ag(x),visitedIndices:t,surveyLanguage:b})}}})})]}):null}function H_(e){var t,r,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=cv(!0),v=p[0],g=p[1],_=cv(!1),f=_[0],m=_[1],y=cv({}),b=y[0],S=y[1],w=hv(void 0),k=()=>{m(!f)};if(dv((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(Ov.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return Yr(I_,R_,t),()=>{ae(w.current)||(clearTimeout(w.current),w.current=void 0),I_.removeEventListener(R_,t)}}}else Ov.error("FeedbackWidget called without a PostHog instance.")}),[c,d,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),O_({survey:l,setSurveyVisible:g,posthog:c}),!v)return null;var C=()=>{l.schedule!==Pv.Always&&g(!1),ae(w.current)||clearTimeout(w.current),w.current=setTimeout((()=>{w.current=void 0,m(!1)}),200)};return Kg(Mp,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&Kg("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===xv.Top?"widget-tab-top":""),onClick:k,disabled:d,style:N_(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Kg(B_,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var $_=e=>{var t=e.question,r=e.onSubmit,i=e.onPreviewSubmit,n={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){i(e)},onSubmit(e){r(e)},initialValue:e.initialValue,displayQuestionIndex:e.displayQuestionIndex,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case Mv.Open:return xp(p_,g({},n,{question:t,key:t.id}));case Mv.Link:return xp(v_,g({},n,{question:t,key:t.id}));case Mv.Rating:return xp(g_,g({},n,{question:t,key:t.id}));case Mv.SingleChoice:case Mv.MultipleChoice:return xp(f_,g({},n,{question:t,key:t.id}));default:return Ov.error("Unsupported question type: "+t.type),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=A_,h.extendPostHogWithSurveys=A_;var U_=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),W_=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return U_(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var n=0,s=Math.min(e.length,r.remaining-2);s>n;){var o=Math.ceil((n+s)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?s=o-1:n=o}return U_(t,JSON.stringify(e.slice(0,n)),r)},z_=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,V_=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},j_=(e,t,r)=>{if(!r.truncated)if(se(e)){if(r.seen.has(e))return void V_(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(j_(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else V_(t,e,r)},G_=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!z_(e))return!n||U_(t,"null",r);if(ce(e)||(e=>{try{return he(e)||ve(e)}catch(e){return!1}})(e))return U_(t,JSON.stringify(e),r);if("string"==typeof e)return W_(e,t,r);if(!se(e)&&!ie(e))return U_(t,JSON.stringify(e),r);if(i.has(e))return W_("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(ne(o))return G_(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return W_(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return U_(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return G_(l,t,r,i,n,s)}if(ie(e)){if(!U_(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!U_(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!G_(d,t,r,i,!0))return!1}return U_(t,"]",r)}if(!U_(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var v=void 0;try{v=e[p]}catch(e){continue}if(s)try{j_(v,p,s)}catch(e){}if(z_(v)){var g=(h?"":",")+JSON.stringify(p)+":";if(g.length>=r.remaining)return r.truncated=!0,!1;var _=t.length,f=r.remaining,m=r.truncated;if(!U_(t,g,r))return!1;var y=t.length,b=G_(v,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=_,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return U_(t,"}",r)},Q_={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},K_=e=>"canCapture"in e;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){var t=e,r=[],i={host:h.location.host},n=!1,s=function(e){var s=h.console[e],o=(r=>function(){for(var s=!1,o=arguments.length,a=new Array(o),l=0;o>l;l++)a[l]=arguments[l];try{var u=t;if(a.length>0&&!n&&u){var c=(e=>K_(e)?e.canCapture?e.getExtension(jv):void 0:e.is_capturing()?e.logs:void 0)(u);if(c){n=!0,s=!0;var d=((e,t)=>{for(var r=[],i={remaining:1e4,truncated:!1},n=se(e[0])?{result:{},keysRemaining:50,sizeRemaining:1e4,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||U_(r," ",i))&&G_(e[s],r,i,new WeakSet,!1,0===s?n:void 0);s++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==n?void 0:n.result)||{}}})(a),p=d.body,v=d.attributes,_=g({},i,d.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(K_(e))t.captureConsoleLog(r);else{var i=(e=>{var t=/^1\.(\d+)\.(\d+)$/.exec(e);if(t){var r=Number(t[1]),i=Number(t[2]);if(r>=392&&419>=r)return 410===r?i>4?i>10?void 0:"de":"le":418===r?i>3?i>10?i>14?i>17?void 0:"vi":"ci":"ui":"he":419===r?i>2?void 0:"vi":410>r?"le":"he"}})(e.version),n=i?t[i]:void 0;ne(n)&&n.call(t,r)}})(u,c,{level:Q_[e],body:p,attributes:g({"log.source":"console."+e},_,v)})}}}catch(e){}finally{s&&(n=!1),r.apply(h.console,a)}})(s);o.__rrweb_original__=(e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e})(s),h.console[e]=o,r.push((()=>{h.console[e]===o&&(h.console[e]=s)}))};for(var o of Object.keys(Q_))s(o);return()=>{t=void 0,r.forEach((e=>e()))}}};var Z_=$r("[Error tracking]"),Y_=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],J_=["__firefox__","__gCrWeb"];function X_(){return new ar([new br,new Rr,new wr,new Sr,new Ir,new xr,new Cr,new Mr],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var n=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var l=mr.test(a)?a.replace(mr,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){n.push(c);break}}if(n.length>=yr)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,yr).map((e=>{return g({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||lr});var r}))}(n)}}("web:javascript",vr,fr))}var ef=$r("[ExceptionAutocapture]"),tf=X_(),rf=t=>{var r=e;r||ef.info("window not available, cannot wrap onerror");var i=r.onerror;return r.onerror=function(){for(var e,r=arguments.length,n=new Array(r),s=0;r>s;s++)n[s]=arguments[s];var o=tf.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],n=e[3],s=e[4];if(null!=s)return s;if(le(t)&&le(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:n})}catch(e){return t}return t})(n),{mechanism:{handled:!1}});return t(o),!!ne(i)&&null!==(e=i(...n))&&void 0!==e&&e},r.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=r.onerror)||delete e.__POSTHOG_INSTRUMENTED__,r.onerror=i}},nf=function(t,r){void 0===r&&(r=!1);var i=e;i||ef.info("window not available, cannot wrap onUnhandledRejection");var n=i.onunhandledrejection;return i.onunhandledrejection=function(e){var i,s=tf.buildFromUnknown(e,{mechanism:{handled:!1}});return t(s),ne(n)?null!==(i=n(e))&&void 0!==i&&i:r},i.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=i.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,i.onunhandledrejection=n}},sf={wrapOnError:rf,wrapUnhandledRejection:nf,wrapConsoleError(e){var t=console;t||ef.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];t=1==n.length?n[0]:n.join(" ");var o=n.find((e=>e instanceof Error)),a=tf.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),ne(r)&&r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=sf,h.posthogErrorWrappingFunctions=sf;var of=(e,t)=>{if(ne(null==e?void 0:e.capture)){var r=null==t?void 0:t.autocaptureExceptions,i=!ce(r)&&"object"==typeof r&&ie(r.errors_to_ignore)?r.errors_to_ignore.reduce(((e,t)=>{try{e.push(new RegExp(t))}catch(e){ef.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e}),[]):[],n=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){ef.error("Failed to capture exception for a legacy client",e)}};rf((e=>{i.some((t=>e.$exception_list.some((e=>t.test(e.value||"")))))||n(e)})),nf(n,!0)}};h.extendPostHogWithExceptionAutoCapture=of,h.extendPostHogWithExceptionAutocapture=of;var af="X-POSTHOG-SESSION-ID",lf="X-POSTHOG-WINDOW-ID",uf="X-POSTHOG-DISTINCT-ID",cf=[af,lf,uf],df=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],hf=(e,t)=>({}.hasOwnProperty.call(e,t)),pf=e=>"object"==typeof e&&!ce(e)||ne(e),vf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),gf=t=>{try{var r;return vf(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null==(r=e.location)?void 0:r.href).toString()}catch(e){return}},_f=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(ie(e)&&!e.includes(s))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;n.set(af,a.sessionId),n.set(lf,l),o=!0}var u=(e=>ne(e)?e():e)(t);return u&&u!==ys&&(n.set(uf,u),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};var ff={_patchFetch:(t,r,i)=>Lh(e,"fetch",(e=>function(n,s){var o=arguments.length>1?[n,s]:[n],a=o;try{var l=gf(n);if(l)if(vf(n)){var u=new Request(n,s);_f(t,r,i,u.url,u.headers),a=[u]}else{var c=new Headers(pf(s)?s.headers:void 0);if(_f(t,r,i,l,c)){var d=((e,t)=>{if(ae(e)||ce(e))return{headers:t};if(pf(e)){var r=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var i=Object.create(r);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),i}return new Proxy({headers:t},{get:(e,t)=>hf(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>hf(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach((e=>t.add(e))),df.forEach((e=>{e in r&&t.add(e)})),Array.from(t)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i)return i;if("string"==typeof t&&df.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var n=Reflect.getOwnPropertyDescriptor(r,t);return n?g({},n,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(s,c);d&&(a=[n,d])}}}catch(e){a=o}return e.apply(this,a)})),_patchXHR:(t,r,i)=>Lh(e.XMLHttpRequest.prototype,"open",(e=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=gf(s);d&&_f(t,r,i,d,c);var h=e.call(u,n,s,o,a,l);return cf.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};h.__PosthogExtensions__.tracingHeadersPatchFns=ff,h.postHogTracingHeadersPatchFns=ff,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0});let mf=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}};var yf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bf=e=>{if("loading"===document.readyState)return"loading";var t=yf();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},Sf=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},wf=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,n=e,s=n.id?"#"+n.id:[Sf(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+s.length>99)return t||s;if(t=t?s+">"+t:s,n.id)break;e=n.parentNode}}catch(e){}return t},kf=new WeakMap;function Cf(e,t){var r=kf.get(t);return r||(r=new WeakMap,kf.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var Ef=-1,Tf=()=>Ef,xf=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Ef=t.timeStamp,e(t))}),!0)},If=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Mf=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},Rf=()=>{var e,t;return null!==(e=null==(t=yf())?void 0:t.activationStart)&&void 0!==e?e:0},Pf=-1,Ff=new Set,Lf=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Af=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Ff)t();isFinite(Pf)||(Pf="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Af,!0))}},Of=function(e){if(void 0===e&&(e=!1),e&&(Pf=1/0),0>Pf){var t,r=Rf(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Pf=null!=i?i:Lf(),addEventListener("visibilitychange",Af,!0),addEventListener("prerenderingchange",Af,!0),xf((()=>{setTimeout((()=>{Pf=Lf()}))}))}return{get firstHiddenTime(){return Pf},onHidden(e){Ff.add(e)}}},Df=function(e,t,r,i,n,s,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=yf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Tf()?a&&(document.prerendering||Rf()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:n,navigationURL:s||(null==a?void 0:a.name),navigationStartTime:o||0}},Nf=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{var r=e.getEntries();i.length>1&&r.sort(((e,t)=>e.startTime+e.duration-(t.startTime+t.duration))),t(r)}))}));for(var s of i)n.observe(g({type:s,buffered:!0},r));return n}}catch(e){}},Bf=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&"function"==typeof(null==(t=globalThis.PerformanceSoftNavigation)||null==(t=t.prototype)?void 0:t.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},qf=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Hf=e=>{var t=!1;return()=>{t||(e(),t=!0)}};let $f=class{constructor(){this.u=void 0}};var Uf,Wf=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},zf=[1800,3e3],Vf=function(e,t){void 0===t&&(t={});var r=Bf(t);Wf((()=>{var i,n=Cf(t,$f),s=Of(),o=Df("FCP"),a=Nf(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Rf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=If(e,o,zf,t.reportAllChanges),xf((r=>{o=Df("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Tf()),i=If(e,o,zf,t.reportAllChanges),Mf((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&Nf(["soft-navigation"],(r=>{r.forEach((r=>{n.u&&r.navigationId&&qf(n.u,r);var s=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=Df("FCP",s,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=If(e,o,zf,t.reportAllChanges))(!0)}))}),t)}))},jf=[.1,.25],Gf=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],Qf=0,Kf=1/0,Zf=0,Yf=e=>{for(var t of e)t.interactionId&&(Kf=Math.min(Kf,t.interactionId),Zf=Math.max(Zf,t.interactionId),Qf=Zf?(Zf-Kf)/7+1:0)},Jf=()=>{var e;return Uf?Qf:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Xf=0;let em=class{constructor(){this.h=[],this.v=new Map,this.p=void 0,this.m=void 0}M(){Xf=Jf(),this.h.length=0,this.v.clear()}T(e){var t=Jf()-Xf,r=Math.min(this.h.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.h[r]:{D:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.h.at(-1),i=this.v.get(e.interactionId);if(i||10>this.h.length||e.duration>r.D){var n;if(i?e.duration>i.D?(i.entries=[e],i.D=e.duration):e.duration===i.D&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.v.set((i={id:e.interactionId,entries:[e],D:e.duration}).id,i),this.h.push(i)),this.h.sort(((e,t)=>t.D-e.D)),this.h.length>10){var s=this.h.splice(10);for(var o of s)this.v.delete(o.id)}null==(n=this.m)||n.call(this,i)}}}};var tm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var n=Hf(e),s=-1,o=()=>{i(s),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),s=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()}),{timeout:t})}},rm=[200,500];let im=class{constructor(){this.p=void 0,this.u=void 0}l(e){var t;null==(t=this.p)||t.call(this,e)}};var nm=[2500,4e3],sm=-1,om=()=>sm,am=e=>{addEventListener("pageshow",(t=>{t.persisted&&(sm=t.timeStamp,e(t))}),!0)},lm=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},um=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},cm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},dm=()=>{var e,t;return null!==(e=null==(t=cm())?void 0:t.activationStart)&&void 0!==e?e:0},hm=-1,pm=new Set,vm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,gm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of pm)t();isFinite(hm)||(hm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",gm,!0))}},_m=function(e){if(void 0===e&&(e=!1),e&&(hm=1/0),0>hm){var t,r=dm(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;hm=null!=i?i:vm(),addEventListener("visibilitychange",gm,!0),addEventListener("prerenderingchange",gm,!0),am((()=>{setTimeout((()=>{hm=vm()}))}))}return{get firstHiddenTime(){return hm},onHidden(e){pm.add(e)}}},fm=function(e,t,r,i,n,s,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=cm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>om()?a&&(document.prerendering||dm()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:n,navigationURL:s||(null==a?void 0:a.name),navigationStartTime:o||0}},mm=new WeakMap;function ym(e,t){var r=mm.get(t);return r||(r=new WeakMap,mm.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}let bm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}};var Sm=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{var r=e.getEntries();i.length>1&&r.sort(((e,t)=>e.startTime+e.duration-(t.startTime+t.duration))),t(r)}))}));for(var s of i)n.observe(g({type:s,buffered:!0},r));return n}}catch(e){}},wm=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&"function"==typeof(null==(t=globalThis.PerformanceSoftNavigation)||null==(t=t.prototype)?void 0:t.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},km=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Cm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};let Em=class{constructor(){this.l=void 0}};var Tm,xm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Im=[1800,3e3],Mm=function(e,t){void 0===t&&(t={});var r=wm(t);xm((()=>{var i,n=ym(t,Em),s=_m(),o=fm("FCP"),a=Sm(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-dm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=lm(e,o,Im,t.reportAllChanges),am((r=>{o=fm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,om()),i=lm(e,o,Im,t.reportAllChanges),um((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&Sm(["soft-navigation"],(r=>{r.forEach((r=>{n.l&&r.navigationId&&km(n.l,r);var s=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=fm("FCP",s,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=lm(e,o,Im,t.reportAllChanges))(!0)}))}),t)}))},Rm=[.1,.25],Pm=function(e,t){void 0===t&&(t={});var r=_m();Mm(Cm((()=>{var i,n=fm("CLS",0),s=ym(t,bm),o=(r,o,a,l,u)=>{n=fm("CLS",0,r,o,a,l,u),s.i=0,i=lm(e,n,Rm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),s.i>n.value&&(n.value=s.i,n.entries=s.o),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?s.h(t):l(t);a()},c=["layout-shift"];wm(t)&&c.push("soft-navigation");var d=Sm(c,u);d&&(i=lm(e,n,Rm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),am((()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,om()),um(i)})),setTimeout(i))})))},Fm=0,Lm=1/0,Am=0,Om=e=>{for(var t of e)t.interactionId&&(Lm=Math.min(Lm,t.interactionId),Am=Math.max(Am,t.interactionId),Fm=Am?(Am-Lm)/7+1:0)},Dm=()=>{var e;return Tm?Fm:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Nm=0;let Bm=class{constructor(){this.u=[],this.v=new Map,this.m=void 0,this.p=void 0}T(){Nm=Dm(),this.u.length=0,this.v.clear()}M(e){var t=Dm()-Nm,r=Math.min(this.u.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.u[r]:{_:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.u.at(-1),i=this.v.get(e.interactionId);if(i||10>this.u.length||e.duration>r._){var n;if(i?e.duration>i._?(i.entries=[e],i._=e.duration):e.duration===i._&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.v.set((i={id:e.interactionId,entries:[e],_:e.duration}).id,i),this.u.push(i)),this.u.sort(((e,t)=>t._-e._)),this.u.length>10){var s=this.u.splice(10);for(var o of s)this.v.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}};var qm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var n=Cm(e),s=-1,o=()=>{i(s),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),s=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()}),{timeout:t})}},Hm=[200,500],$m=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=_m();xm((()=>{var i;"interactionCount"in performance||Tm||(Tm=Sm(["event"],Om,{durationThreshold:0}));var n,s=fm("INP"),o=ym(t,Bm),a=(r,i,a,l,u)=>{o.T(),s=fm("INP",-1,r,i,a,l,u),n=lm(e,s,Hm,t.reportAllChanges)},l=()=>{var e=o.M(s.navigationType);e&&e._!==s.value&&(s.value=e._,s.entries=e.entries,n())},u=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),qm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.h(r):u(r);l(),t&&n(!0)}))},d=["event","first-input"];wm(t)&&d.push("soft-navigation");var h=Sm(d,c,g({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));n=lm(e,s,Hm,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),am((()=>{a("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,om())})))}))}};let Um=class{constructor(){this.m=void 0,this.l=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}};var Wm=[2500,4e3],zm=function(e,t){void 0===t&&(t={});var r=!1,i=wm(t);xm((()=>{var n,s=_m(),o=fm("LCP"),a=ym(t,Um),l=(i,a,l,u,c)=>{o=fm("LCP",-1,i,a,l,u,c),n=lm(e,o,Wm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(s=_m(!0))},u=e=>{a.l&&e.navigationId&&km(a.l,e),r||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&c([t])},c=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,c=[],d=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-dm(),0),a.h(r),c=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;d=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(d-r.startTime,0),p.largestContentfulPaint&&(a.h(p.largestContentfulPaint),c=[p.largestContentfulPaint])}s.firstHiddenTime>d&&(o.value=l,o.entries=c,n())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=Sm(d,c);if(h){n=lm(e,o,Wm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],v=e=>{if(e.isTrusted&&!r){var t=o.id;qm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,v,{capture:!0});t===o.id&&(r=!0,n(!0))}}))}};for(var g of p)addEventListener(g,v,{capture:!0});am((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,om()),n=lm(e,o,Wm,t.reportAllChanges),um((()=>{o.value=performance.now()-i.timeStamp,r=!0,n(!0)}))}))}}))},Vm={onLCP(e,t){void 0===t&&(t={});var r=Cf(t=Object.assign({},t),im),i=new WeakMap;Bf(t)&&(r.u=new Map),r.p=e=>{var r=e.element;if(r){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==n?n:wf(r);i.set(e,s)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=Bf(t);Wf((()=>{var n,s=Of(),o=Df("LCP"),a=Cf(t,im),l=(i,a,l,u,c)=>{o=Df("LCP",-1,i,a,l,u,c),n=If(e,o,nm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(s=Of(!0))},u=e=>{a.u&&e.navigationId&&qf(a.u,e),r||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&c([t])},c=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,c=[],d=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-Rf(),0),a.l(r),c=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;d=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(d-r.startTime,0),p.largestContentfulPaint&&(a.l(p.largestContentfulPaint),c=[p.largestContentfulPaint])}s.firstHiddenTime>d&&(o.value=l,o.entries=c,n())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=Nf(d,c);if(h){n=If(e,o,nm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],v=e=>{if(e.isTrusted&&!r){var t=o.id;tm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,v,{capture:!0});t===o.id&&(r=!0,n(!0))}}))}};for(var g of p)addEventListener(g,v,{capture:!0});xf((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Tf()),n=If(e,o,nm,t.reportAllChanges),Mf((()=>{o.value=performance.now()-i.timeStamp,r=!0,n(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,s,o,a,l,u,c=e.entries.at(-1),d=c.url&&performance.getEntriesByType("resource").find((e=>e.name===c.url));t.target=i.get(c),t.lcpEntry=c,c.url&&(t.url=c.url),d&&(t.lcpResourceEntry=d);var h=0,p=0;if("soft-navigation"!==e.navigationType?(h=null!==(n=null==(s=u=yf())?void 0:s.activationStart)&&void 0!==n?n:0,p=null!==(o=null==(a=u)?void 0:a.responseStart)&&void 0!==o?o:0):(h=e.navigationStartTime||0,u=null==(l=r.u)?void 0:l.get(e.navigationId)),u){var v=Math.max(0,p-h),_=Math.max(v,d?(d.requestStart||d.startTime)-h:0),f=Math.min(e.value,Math.max(_,d?d.responseEnd-h:0));t=g({},t,{timeToFirstByte:v,resourceLoadDelay:_-v,resourceLoadDuration:f-_,elementRenderDelay:e.value-f,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))}),t)},onCLS(e,t){void 0===t&&(t={});var r=Cf(t=Object.assign({},t),mf),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var n=Gf(e.sources),s=null==n?void 0:n.node;if(s){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(s))&&void 0!==o?o:wf(s);i.set(n,a)}}},function(e,t){void 0===t&&(t={});var r=Of();Vf(Hf((()=>{var i,n=Df("CLS",0),s=Cf(t,mf),o=(r,o,a,l,u)=>{n=Df("CLS",0,r,o,a,l,u),s.o=0,i=If(e,n,jf,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),s.o>n.value&&(n.value=s.o,n.entries=s.i),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?s.l(t):l(t);a()},c=["layout-shift"];Bf(t)&&c.push("soft-navigation");var d=Nf(c,u);d&&(i=If(e,n,jf,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),xf((()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Tf()),Mf(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,n=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=n&&null!=(r=n.sources)&&r.length){var s=Gf(n.sources);s&&(t={largestShiftTarget:i.get(s),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:s,largestShiftEntry:n,loadState:bf(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},onFCP(e,t){void 0===t&&(t={});var r=Cf(t=Object.assign({},t),$f);Bf(t)&&(r.u=new Map),Vf((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:bf(Tf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=yf(),n=e.entries.at(-1);if(i){var s=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:bf(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var o,a=null==(o=r.u)?void 0:o.get(e.navigationId);a&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:a})}return Object.assign(e,{attribution:t})})(t))}),t)},onINP(e,t){void 0===t&&(t={});var r=Cf(t=Object.assign({},t),em),i=[],n=[],s=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(tm(c),l=!0)},c=()=>{var e=new Set(r.h.map((e=>o.get(e.entries[0])))),t=n.length-10;n=n.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of n){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>s||a.has(e))),l=!1};r.p=e=>{var r,i=e.startTime+e.duration;s=Math.max(s,e.processingEnd);for(var a=n.length-1;a>=0;a--){var l=n[a];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||n.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),(e.interactionId||"first-input"===e.entryType)&&o.set(e,r),u()},r.m=e=>{if(!a.get(e)){var r,i=null==(r=e.entries.find((e=>e.target)))?void 0:r.target;if(i){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==n?n:wf(i);a.set(e,s)}else{var o,l=null==(o=e.entries.find((e=>e.targetSelector)))?void 0:o.targetSelector;l&&a.set(e,l)}}};var d=(e,t)=>{var r=[];for(var n of i)if(n.startTime+n.duration>=e){if(n.startTime>t)break;r.push(n)}return r};Nf(["long-animation-frame"],(e=>{i=i.concat(e),u()}),t),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Of();Wf((()=>{var i;"interactionCount"in performance||Uf||(Uf=Nf(["event"],Yf,{durationThreshold:0}));var n,s=Df("INP"),o=Cf(t,em),a=(r,i,a,l,u)=>{o.M(),s=Df("INP",-1,r,i,a,l,u),n=If(e,s,rm,t.reportAllChanges)},l=()=>{var e=o.T(s.navigationType);e&&e.D!==s.value&&(s.value=e.D,s.entries=e.entries,n())},u=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),tm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.l(r):u(r);l(),t&&n(!0)}))},d=["event","first-input"];Bf(t)&&d.push("soft-navigation");var h=Nf(d,c,g({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));n=If(e,s,rm,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),xf((()=>{a("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Tf())})))}))}}((t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:bf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],n=o.get(i),s=n.processingStart,l=Math.max(i.startTime+i.duration,s),u=Math.min(n.processingEnd,l),c=n.entries.sort(((e,t)=>e.processingStart-t.processingStart)),h=d(i.startTime,u),p=r.v.get(i.interactionId),v={interactionTarget:a.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:h,inputDelay:s-i.startTime,processingDuration:u-s,presentationDelay:l-u,loadState:bf(i.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{var r=e.interactionTime,i=e.nextPaintTime;if(null!=(t=e.longAnimationFrameEntries)&&t.length&&r&&i){var n,s,o=e.inputDelay,a=e.processingDuration,l=0,u=0,c=0,d=0;for(var h of e.longAnimationFrameEntries)for(var p of(u=u+h.startTime+h.duration-h.styleAndLayoutStart,h.scripts)){var v=p.startTime+p.duration;if(v>=r){var g=v-Math.max(r,p.startTime),_=p.duration?g/p.duration*p.forcedStyleAndLayoutDuration:0;l+=g-_,u+=_,g>d&&(s=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",n=p,d=g)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(c=i-m),n&&s&&(e.longestScript={entry:n,subpart:s,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=c,e.totalUnattributedDuration=i-r-l-u-c}})(v),Object.assign(e,{attribution:v})})(t))}),t)},withoutAttribution:{onLCP:zm,onCLS:Pm,onFCP:Mm,onINP:$m}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Vm,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Vm,h.postHogWebVitalsCallbacks=Vm;var jm={onLCP:zm,onCLS:Pm,onFCP:Mm,onINP:$m};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=jm,h.__PosthogExtensions__.postHogWebVitalsCallbacks=jm,h.postHogWebVitalsCallbacks=jm,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>jm;let Gm=class{constructor(){this.t=void 0,this.o=0,this.i=[]}u(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}};var Qm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Km=e=>{if("loading"===document.readyState)return"loading";var t=Qm();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},Zm=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Ym=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i=e,n=i.id?"#"+i.id:[Zm(i),...Array.from(i.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,i.id)break;e=i.parentNode}}catch(e){}return t},Jm=new WeakMap;function Xm(e,t){var r=Jm.get(t);return r||(r=new WeakMap,Jm.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var ey,ty=-1,ry=()=>ty,iy=e=>{addEventListener("pageshow",(t=>{t.persisted&&(ty=t.timeStamp,e(t))}),!0)},ny=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},sy=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},oy=()=>{var e,t;return null!==(e=null==(t=Qm())?void 0:t.activationStart)&&void 0!==e?e:0},ay=function(e,t){void 0===t&&(t=-1);var r=Qm(),i="navigate";return 0>ry()?r&&(document.prerendering||oy()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},ly=function(e,t,r){void 0===r&&(r={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return i.observe(g({type:e,buffered:!0},r)),i}}catch(e){}},uy=e=>{var t=!1;return()=>{t||(e(),t=!0)}},cy=-1,dy=new Set,hy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,py=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of dy)t();isFinite(cy)||(cy="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",py,!0))}},vy=()=>{if(0>cy){var e,t=oy(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;cy=null!=r?r:hy(),addEventListener("visibilitychange",py,!0),addEventListener("prerenderingchange",py,!0),iy((()=>{setTimeout((()=>{cy=hy()}))}))}return{get firstHiddenTime(){return cy},onHidden(e){dy.add(e)}}},gy=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},_y=[1800,3e3],fy=function(e,t){void 0===t&&(t={}),gy((()=>{var r,i=vy(),n=ay("FCP"),s=ly("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-oy(),0),n.entries.push(t),r(!0)))}));s&&(r=ny(e,n,_y,t.reportAllChanges),iy((i=>{n=ay("FCP"),r=ny(e,n,_y,t.reportAllChanges),sy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},my=[.1,.25],yy=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],by=0,Sy=1/0,wy=0,ky=e=>{for(var t of e)t.interactionId&&(Sy=Math.min(Sy,t.interactionId),wy=Math.max(wy,t.interactionId),by=wy?(wy-Sy)/7+1:0)},Cy=()=>{var e;return ey?by:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Ey=0;let Ty=class{constructor(){this.l=[],this.h=new Map,this.m=void 0,this.p=void 0}v(){Ey=Cy(),this.l.length=0,this.h.clear()}M(){var e=Math.min(this.l.length-1,Math.floor((Cy()-Ey)/50));return this.l[e]}u(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.h.get(e.interactionId);if(i||10>this.l.length||e.duration>r.T){var n;if(i?e.duration>i.T?(i.entries=[e],i.T=e.duration):e.duration===i.T&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.h.set((i={id:e.interactionId,entries:[e],T:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.T-e.T)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.h.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}};var xy=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=uy(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},Iy=[200,500];let My=class{constructor(){this.m=void 0}u(e){var t;null==(t=this.m)||t.call(this,e)}};var $=[2500,4e3],Ry=-1,Py=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Ry=t.timeStamp,e(t))}),!0)},Fy=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Ly=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},Ay=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Oy=()=>{var e,t;return null!==(e=null==(t=Ay())?void 0:t.activationStart)&&void 0!==e?e:0},Dy=function(e,t){void 0===t&&(t=-1);var r=Ay(),i="navigate";return 0>Ry?r&&(document.prerendering||Oy()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Ny=new WeakMap;function By(e,t){var r=Ny.get(t);return r||(r=new WeakMap,Ny.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class qy{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}}var Hy,$y=function(e,t,r){void 0===r&&(r={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return i.observe(g({type:e,buffered:!0},r)),i}}catch(e){}},Uy=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Wy=-1,zy=new Set,Vy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,jy=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of zy)t();isFinite(Wy)||(Wy="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",jy,!0))}},Gy=()=>{if(0>Wy){var e,t=Oy(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Wy=null!=r?r:Vy(),addEventListener("visibilitychange",jy,!0),addEventListener("prerenderingchange",jy,!0),Py((()=>{setTimeout((()=>{Wy=Vy()}))}))}return{get firstHiddenTime(){return Wy},onHidden(e){zy.add(e)}}},Qy=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ky=[1800,3e3],Zy=function(e,t){void 0===t&&(t={}),Qy((()=>{var r,i=Gy(),n=Dy("FCP"),s=$y("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-Oy(),0),n.entries.push(t),r(!0)))}));s&&(r=Fy(e,n,Ky,t.reportAllChanges),Py((i=>{n=Dy("FCP"),r=Fy(e,n,Ky,t.reportAllChanges),Ly((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},Yy=[.1,.25],Jy=function(e,t){void 0===t&&(t={});var r=Gy();Zy(Uy((()=>{var i,n=Dy("CLS",0),s=By(t,qy),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=$y("layout-shift",o);a&&(i=Fy(e,n,Yy,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),Py((()=>{s.i=0,n=Dy("CLS",0),i=Fy(e,n,Yy,t.reportAllChanges),Ly(i)})),setTimeout(i))})))},Xy=0,eb=1/0,tb=0,rb=e=>{for(var t of e)t.interactionId&&(eb=Math.min(eb,t.interactionId),tb=Math.max(tb,t.interactionId),Xy=tb?(tb-eb)/7+1:0)},ib=()=>{var e;return Hy?Xy:null!==(e=performance.interactionCount)&&void 0!==e?e:0},nb=0;class sb{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){nb=ib(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((ib()-nb)/50));return this.l[e]}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.u.get(e.interactionId);if(i||10>this.l.length||e.duration>r.L){var n;if(i?e.duration>i.L?(i.entries=[e],i.L=e.duration):e.duration===i.L&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.u.set((i={id:e.interactionId,entries:[e],L:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.L-e.L)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.u.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}}var ob=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Uy(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},ab=[200,500],lb=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Gy();Qy((()=>{var i;"interactionCount"in performance||Hy||(Hy=$y("event",rb,{durationThreshold:0}));var n,s=Dy("INP"),o=By(t,sb),a=e=>{ob((()=>{for(var t of e)o.h(t);var r=o.T();r&&r.L!==s.value&&(s.value=r.L,s.entries=r.entries,n())}))},l=$y("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=Fy(e,s,ab,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),Py((()=>{o.v(),s=Dy("INP"),n=Fy(e,s,ab,t.reportAllChanges)})))}))}};class ub{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var cb=[2500,4e3],db=function(e,t){void 0===t&&(t={}),Qy((()=>{var r,i=Gy(),n=Dy("LCP"),s=By(t,ub),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.h(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-Oy(),0),n.entries=[o],r())},a=$y("largest-contentful-paint",o);if(a){r=Fy(e,n,cb,t.reportAllChanges);var l=Uy((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(ob(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});Py((i=>{n=Dy("LCP"),r=Fy(e,n,cb,t.reportAllChanges),Ly((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},hb={onLCP(e,t){void 0===t&&(t={});var r=Xm(t=Object.assign({},t),My),i=new WeakMap;r.m=e=>{var r=e.element;if(r){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==n?n:Ym(r);i.set(e,s)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={}),gy((()=>{var r,i=vy(),n=ay("LCP"),s=Xm(t,My),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.u(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-oy(),0),n.entries=[o],r())},a=ly("largest-contentful-paint",o);if(a){r=ny(e,n,$,t.reportAllChanges);var l=uy((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(xy(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});iy((i=>{n=ay("LCP"),r=ny(e,n,$,t.reportAllChanges),sy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var r=e.entries.at(-1),n=r.url&&performance.getEntriesByType("resource").find((e=>e.name===r.url));t.target=i.get(r),t.lcpEntry=r,r.url&&(t.url=r.url),n&&(t.lcpResourceEntry=n);var s=Qm();if(s){var o=s.activationStart||0,a=Math.max(0,s.responseStart-o),l=Math.max(a,n?(n.requestStart||n.startTime)-o:0),u=Math.min(e.value,Math.max(l,n?n.responseEnd-o:0));t=g({},t,{timeToFirstByte:a,resourceLoadDelay:l-a,resourceLoadDuration:u-l,elementRenderDelay:e.value-u,navigationEntry:s})}}return Object.assign(e,{attribution:t})})(t))}),t)},onCLS(e,t){void 0===t&&(t={});var r=Xm(t=Object.assign({},t),Gm),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var n=yy(e.sources),s=null==n?void 0:n.node;if(s){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(s))&&void 0!==o?o:Ym(s);i.set(n,a)}}},function(e,t){void 0===t&&(t={});var r=vy();fy(uy((()=>{var i,n=ay("CLS",0),s=Xm(t,Gm),o=e=>{for(var t of e)s.u(t);s.o>n.value&&(n.value=s.o,n.entries=s.i,i())},a=ly("layout-shift",o);a&&(i=ny(e,n,my,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),iy((()=>{s.o=0,n=ay("CLS",0),i=ny(e,n,my,t.reportAllChanges),sy(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,n=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=n&&null!=(r=n.sources)&&r.length){var s=yy(n.sources);s&&(t={largestShiftTarget:i.get(s),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:s,largestShiftEntry:n,loadState:Km(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},onFCP(e,t){void 0===t&&(t={}),fy((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Km(ry())};if(e.entries.length){var r=Qm(),i=e.entries.at(-1);if(r){var n=Math.max(0,r.responseStart-(r.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:Km(e.entries[0].startTime),navigationEntry:r,fcpEntry:i}}}return Object.assign(e,{attribution:t})})(t))}),t)},onINP(e,t){void 0===t&&(t={});var r=Xm(t=Object.assign({},t),Ty),i=[],n=[],s=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(xy(c),l=!0)},c=()=>{var e=new Set(r.l.map((e=>o.get(e.entries[0])))),t=n.length-10;n=n.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of n){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>s||a.has(e))),l=!1};r.m=e=>{var r,i=e.startTime+e.duration;s=Math.max(s,e.processingEnd);for(var a=n.length-1;a>=0;a--){var l=n[a];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),!1!==t.includeProcessedEventEntries&&r.entries.push(e);break}}r||n.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:!1!==t.includeProcessedEventEntries?[e]:[]}),(e.interactionId||"first-input"===e.entryType)&&o.set(e,r),u()},r.p=e=>{if(!a.get(e)){var r,i=null==(r=e.entries.find((e=>e.target)))?void 0:r.target;if(i){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==n?n:Ym(i);a.set(e,s)}else{var o,l=null==(o=e.entries.find((e=>e.targetSelector)))?void 0:o.targetSelector;l&&a.set(e,l)}}};var d=(e,t)=>{var r=[];for(var n of i)if(n.startTime+n.duration>=e){if(n.startTime>t)break;r.push(n)}return r};ly("long-animation-frame",(e=>{i=i.concat(e),u()})),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=vy();gy((()=>{var i;"interactionCount"in performance||ey||(ey=ly("event",ky,{durationThreshold:0}));var n,s=ay("INP"),o=Xm(t,Ty),a=e=>{xy((()=>{for(var t of e)o.u(t);var r=o.M();r&&r.T!==s.value&&(s.value=r.T,s.entries=r.entries,n())}))},l=ly("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=ny(e,s,Iy,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),iy((()=>{o.v(),s=ay("INP"),n=ny(e,s,Iy,t.reportAllChanges)})))}))}}((t=>{e((e=>{var t=e.entries[0],i=o.get(t),n=t.processingStart,s=Math.max(t.startTime+t.duration,n),l=Math.min(i.processingEnd,s),u=i.entries.sort(((e,t)=>e.processingStart-t.processingStart)),c=d(t.startTime,l),h=r.h.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:s,processedEventEntries:u,longAnimationFrameEntries:c,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:s-l,loadState:Km(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{if(null!=(t=e.longAnimationFrameEntries)&&t.length){var r,i,n=e.interactionTime,s=e.inputDelay,o=e.processingDuration,a=0,l=0,u=0,c=0;for(var d of e.longAnimationFrameEntries)for(var h of(l=l+d.startTime+d.duration-d.styleAndLayoutStart,d.scripts)){var p=h.startTime+h.duration;if(p>=n){var v=p-Math.max(n,h.startTime),g=h.duration?v/h.duration*h.forcedStyleAndLayoutDuration:0;a+=v-g,l+=g,v>c&&(i=n+s>h.startTime?"input-delay":n+s+o>h.startTime?"processing-duration":"presentation-delay",r=h,c=v)}}var _=e.longAnimationFrameEntries.at(-1),f=_?_.startTime+_.duration:0;f>=n+s+o&&(u=e.nextPaintTime-f),r&&i&&(e.longestScript={entry:r,subpart:i,intersectingDuration:c}),e.totalScriptDuration=a,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=e.nextPaintTime-n-a-l-u}})(p),Object.assign(e,{attribution:p})})(t))}),t)},withoutAttribution:{onLCP:db,onCLS:Jy,onFCP:Zy,onINP:lb}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=hb,h.__PosthogExtensions__.postHogWebVitalsCallbacks=hb,h.postHogWebVitalsCallbacks=hb;var pb={onLCP:db,onCLS:Jy,onFCP:Zy,onINP:lb};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=pb,h.__PosthogExtensions__.postHogWebVitalsCallbacks=pb,h.postHogWebVitalsCallbacks=pb,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>pb;class vb{constructor(e){this.disabled=!1===e;var t=se(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,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var gb="$copy_autocapture",_b=$r("[AutoCapture]");function fb(e,t){return t.length>e?t.slice(0,e)+"...":t}function mb(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!gi(t));return t}function yb(t,r){var i,n,s=r.e,o=r.maskAllElementAttributes,a=r.maskAllText,l=r.elementAttributeIgnoreList,u=r.elementsChainAsString,c=r.disableCaptureUrlHashes;if(!gi(t))return{props:{}};for(var d=[t],h=new Set([t]),p=t;p.parentNode&&!_i(p,"body")&&yi>d.length;)if(mi(p.parentNode)){var v=p.parentNode.host;if(h.has(v))break;h.add(v),d.push(v),p=v}else{if(!gi(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var _,f,m=[],y={},b=!1,S=!1;if(Wr(d,(e=>{var t=qi(e);if(_i(e,"a")){var r=e.getAttribute("href");b=!!(t&&r&&Qi(r))&&(c?Ot(r):r)}Z(wi(e),"ph-no-capture")&&(S=!0),m.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};Ti.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?fb(1024,Ki(e)):fb(1024,Ci(e)));var a=wi(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),Wr(e.attributes,(function(r){var s;if((!Hi(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Qi(r.value)&&(!le(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=bi(a).join(" ")),o["attr__"+r.name]=fb(1024,"href"===r.name&&n?Ot(a):a)}}));for(var l=1,u=1,c=e;c=mb(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,l,c));var i=function(e){if(!qi(e))return{};var t={};return Wr(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Qi(i)&&(t[r]=i)}})),t}(e);zr(y,i)})),S)return{props:{},explicitNoCapture:S};if(a||(m[0].$el_text=_i(t,"a")||_i(t,"button")?Ki(t):Ci(t)),b){var w,k;m[0].attr__href=b;var C=null==(w=ti(b))?void 0:w.host,E=null==e||null==(k=e.location)?void 0:k.host;C&&E&&C!==E&&(_=b)}return{props:zr({$event_type:s.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(f=m,function(e){return e.map((e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))i+="."+n.replace(/"/g,"");var s=g({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Vr(s).sort(((e,t)=>e[0].localeCompare(t[0]))).forEach((e=>{var t=e[1];return o[Yi(e[0].toString())]=Yi(t.toString())})),(i+=":")+Vr(o).map((e=>e[0]+'="'+e[1]+'"')).join("")})).join(";")}(function(e){return e.map((e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Ji(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Vr(e).filter((e=>0===e[0].indexOf("attr__"))).forEach((e=>i.attributes[e[0]]=e[1])),i}))}(f)))},null!=(i=m[0])&&i.$el_text?{$el_text:null==(n=m[0])?void 0:n.$el_text}:{},_&&"click"===s.type?{$external_click_url:_}:{},y)}}class bb{constructor(e){this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource=e,this._configSource.refresh(this._config),this.rageclicks=new vb(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null==(e=this._config.url_allowlist)?void 0:e.map((e=>new RegExp(e))),this._config.url_ignorelist=null==(t=this._config.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),this._config}_addDomEventHandlers(){if(this.isBrowserSupported()){if(e&&i){var t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){_b.error("Failed to capture event",e)}};if(Yr(i,"submit",t,{capture:!0}),Yr(i,"change",t,{capture:!0}),Yr(i,"click",t,{capture:!0}),this._refreshConfig().capture_copied_text){var r=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,gb)}catch(e){_b.error("Failed to capture clipboard event",e)}};Yr(i,"copy",r,{capture:!0}),Yr(i,"cut",r,{capture:!0}),Yr(i,"paste",r,{capture:!0})}}}else _b.info("Disabling Automatic Event Collection because this browser is not supported")}_removeDomEventHandlers(){this._domEventHandler&&(null==i||i.removeEventListener("submit",this._domEventHandler,!0),null==i||i.removeEventListener("change",this._domEventHandler,!0),null==i||i.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==i||i.removeEventListener("copy",this._copiedTextHandler,!0),null==i||i.removeEventListener("cut",this._copiedTextHandler,!0),null==i||i.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(!this._disposed)if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r,i=t.autocapture_opt_out;ve(i)&&(null==(r=this._client)||r.kv.set(yn,i),this._isDisabledServerSide=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var n=null==i?void 0:i.querySelectorAll(t);null==n||n.forEach((i=>{e===i&&r.push(t)}))})),r}get isEnabled(){var e,t;if(this._disposed)return!1;var r=null==(e=this._client)?void 0:e.kv.get(yn),i=this._isDisabledServerSide,n=this._refreshConfig(),s=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(ce(i)&&!ve(r)&&!s)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!n.enabled&&!o}_captureEvent(t,r){if(void 0===r&&(r="$autocapture"),this.isEnabled){var i=Ei(t);fi(i)&&(i=i.parentNode||null);var n,s=this._compileUrlPatterns();"$autocapture"===r&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Di(i,s.rageclick)&&this._captureEvent(t,"$rageclick");var o=r===gb,a=o?g({},s,{dom_event_allowlist:void 0}):s;if(i&&function(t,r,i,n,s,o){var a;if(!e||Ni(t))return!1;if(null!=i&&i.url_allowlist&&!Si(i.url_allowlist,o))return!1;if(null!=i&&i.url_ignorelist&&Si(i.url_ignorelist,o))return!1;if(null!=i&&i.dom_event_allowlist){var l=i.dom_event_allowlist;if(l&&!l.some((e=>r.type===e)))return!1}var u=Bi(t,n),c=u.parentIsUsefulElement,d=u.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(ae(r))return!0;var i,n=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e)if(i=n(s))return i.v;return!1}(d,i))return!1;if(!xi(d,null==i?void 0:i.css_selector_allowlist))return!1;if(xi(d,null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:Mi))return!1;try{var h=e.getComputedStyle(t);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===r.type)return!0}catch(e){}var p=t.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(r.type)>=0;default:return c?(s||["click"]).indexOf(r.type)>=0:(s||["click"]).indexOf(r.type)>=0&&(Ti.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var l,u=yb(i,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),c=u.props;if(u.explicitNoCapture)return!1;var d=this.getElementSelectors(i);if(d&&d.length>0&&(c.$element_selectors=d),r===gb){var h=t.type||"clipboard";if("paste"!==h){var p,v,_=null==e||null==(p=e.getSelection())?void 0:p.toString(),f=ki(_);if(!f)return!1;c.$selected_content=f,c.$clipboard_text_length=null!==(v=null==_?void 0:_.length)&&void 0!==v?v:0}c.$copy_type=h}return null==(l=this._client)||l.capture(r,c).catch((e=>_b.error("Failed to capture event",e))),!0}}}isBrowserSupported(){return ne(null==i?void 0:i.querySelectorAll)}}var Sb={};function wb(t,r){var i=Sb[t];if(i)return i;var n=r[t];if((e=>ne(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&(null==e||!e.Zone))return Sb[t]=n.bind(r);var s=r.document;if(s&&ne(s.createElement)){var o,a=!1;try{(o=s.createElement("iframe")).hidden=!0,s.head.appendChild(o);var l,u,c=o.contentWindow;c&&c[t]&&(n=c[t],"MutationObserver"===t&&function(e){return Z(e,"AppleWebKit")&&!Z(e,"Chrome")}(null!==(l=null==(u=r.navigator)?void 0:u.userAgent)&&void 0!==l?l:"")&&(o.classList.add("rr-block","ph-no-capture"),a=!0))}catch(e){Hr.warn("Could not create sandbox iframe for "+t+" check, bailing to assignableWindow."+t+": ",e)}finally{var d;!a&&null!=(d=o)&&d.parentNode&&o.parentNode.removeChild(o)}}return n&&ne(n)?Sb[t]=n.bind(r):n}function kb(e,t){var r=Ei(e);return r?g({node:r,originalEvent:e,timestamp:Date.now()},t):null}function Cb(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Eb(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var Tb="canvas,video,audio,embed,object",xb=1e3;function Ib(e,t){return he(e)&&e>=t}function Mb(e){return e>=0&&xb>e?e:void 0}function Rb(e,t){return t?Mb(e-t):void 0}class Pb{_asRequiredConfig(e){var t,r,i,n,s,o,a,l,u=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._onClick=e=>{var t=kb(e,{type:"click"});ce(t)||this._ignore(t)||this._queueCandidate(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach((t=>{ae(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{var e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{var e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!ae(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var n=e,s=null==(t=n.changedTouches)?void 0:t[0];if(s){var o=s.clientX-r.x,a=s.clientY-r.y,l=o*o+a*a,u=this._config.swipe_threshold_px;if(l>=u*u&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some((e=>he(e)&&e>=r.timestamp))){var c;if(this._pageHasUnobservableSurfaces()&&(null!==(c=null==i||null==i.elementsFromPoint?void 0:i.elementsFromPoint(r.x,r.y))&&void 0!==c?c:[]).some((e=>null==e.matches?void 0:e.matches(Tb))))return;var d=kb(n,{type:"swipe",swipeDirection:Cb(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});ce(d)||this._ignore(d)||this._queueCandidate(d),this._scheduleCheck()}}}},this.instance=e,this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return wb("MutationObserver",e)}(h);this._mutationObserver=new t((e=>{this._onMutation(e)})),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null==(e=this._mutationObserver)||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick),h.removeEventListener("scroll",this._onScroll,{capture:!0}),h.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==i||i.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Yr(h,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=Rb(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Rb(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&ae(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){Yr(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Yr(h,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Yr(i,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Yr(h,"blur",this._onFocusChange),Yr(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach((r=>{var i=Mb(t-r.timestamp);he(i)&&(ae(r[e])||r[e]>i)&&(r[e]=i)}))}_startSwipeObserver(){Yr(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Yr(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Yr(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=ae(this._surfacesCheckedAt)||he(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(ae(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==i||!i.querySelector(Tb))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){if(vi(t.node))return!0;var r=this._clicks.some((e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp)));return!(!r&&!_i(t.node,"html")&&gi(t.node)&&function(t,r){var i;if(!e||Ni(t))return!1;var n=ve(r)?Li:null!==(i=null==r?void 0:r.css_selector_ignorelist)&&void 0!==i?i:Li;return!xi(Bi(t,!1).targetElementList,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(r=t.originalEvent,!(r.ctrlKey||r.metaKey||r.altKey||r.shiftKey)))||!!this._ignoreCommon(t)||(i=t.node,!(!e||Ni(i))&&Bi(i,!1).targetElementList.some((e=>_i(e,"a"))));var r,i}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0;var i=Ib(t.scrollDelayMs,this._config.scroll_threshold_ms),n=Ib(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=Ib(t.mutationDelayMs,this._config.mutation_threshold_ms),o=Ib(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=he(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=he(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=he(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=he(t.visibilityChangedDelayMs),d=he(t.focusChangedDelayMs);if(!(a||l||u||c||d))if(i||s||o||n){var h=Eb(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:s,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:n,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=Eb(e);this.instance.capture(r,g({},t,yb(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[r+"_scroll_delay_ms"]:e.scrollDelayMs,[r+"_mutation_delay_ms"]:e.mutationDelayMs,[r+"_absolute_delay_ms"]:e.absoluteDelayMs,[r+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[r+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,[r+"_focus_changed_delay_ms"]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}}h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new Pb(e,t);class Fb{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===As||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Ls}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return Ce(e)?1:Z(Ee,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?ng:rg;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?rg:ng;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ce(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,h.doNotTrack].some((e=>Ce(e)))}}var Lb=$r("[Dead Clicks]"),Ab=()=>!0,Ob=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(En)),i=e.instance.config.capture_dead_clicks;return ve(i)?i:!!se(i)||r};class Db{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[En]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Lb.error("failed to load script",t):e()}))}_start(){var e;if(i){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=se(this.instance.config.capture_dead_clicks)?g({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(i),Lb.info("starting...")}}else Lb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Lb.info("stopping..."))}}var Nb=$r("[SegmentIntegration]");var Bb="posthog-js";function qb(e,t){var r=void 0===t?{}:t,i=r.organization,n=r.projectId,s=r.prefix,o=r.severityAllowList,a=void 0===o?["error"]:o,l=r.sendExceptionsToPostHog,u=void 0===l||l;return t=>{var r,o,l,c,d;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,v=(null==(r=t.exception)?void 0:r.values)||[],_=v.map((e=>g({},e,{stacktrace:e.stacktrace?g({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>g({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(o=v[0])?void 0:o.value)||t.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:t.level,$exception_list:_,$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 i&&n&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Hb{constructor(e,t,r,i,n,s){this.name=Bb,this.setupOnce=function(o){o(qb(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class $b{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Hr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,r){var i,n=this._previousPageViewProperties(t,r);return this._currentPageview={pathname:null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",pageViewId:r,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var s=n.maxScrollHeight,o=n.lastScrollY,a=n.maxScrollY,l=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(ae(s)||ae(o)||ae(a)||ae(l)||ae(u)||ae(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s>1?Te(o/s,0,1,Hr):1,h=s>1?Te(a/s,0,1,Hr):1,p=l>1?Te(u/l,0,1,Hr):1,v=l>1?Te(c/l,0,1,Hr):1;i=zr(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Ub=["flags","surveys"],Wb={[pn]:{exposure:"hidden"},[fn]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[mn]:{exposure:"hidden"},[yn]:{exposure:"event"},[bn]:{exposure:"hidden"},[Sn]:{exposure:"event"},[wn]:{exposure:"hidden"},[kn]:{exposure:"event"},[Cn]:{exposure:"event"},[En]:{exposure:"event"},[Tn]:{exposure:"hidden"},[xn]:{exposure:"event"},[In]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[An]:{exposure:"hidden"},[On]:{exposure:"event"},[Mn]:{exposure:"event",shouldSkipFromEventProperties:e=>ce(e)},[Dn]:{exposure:"event"},[Nn]:{exposure:"event"},[Bn]:{exposure:"event"},[Un]:{exposure:"event"},[Wn]:{exposure:"hidden"},[zn]:{exposure:"hidden",storageGroup:"flags"},[Vn]:{exposure:"hidden",storageGroup:"flags"},[jn]:{exposure:"hidden"},[Gn]:{exposure:"hidden",storageGroup:"flags"},[Qn]:{exposure:"hidden",storageGroup:"flags"},[Kn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Zn]:{exposure:"hidden",storageGroup:"flags"},[Yn]:{exposure:"hidden"},[Jn]:{exposure:"hidden"},[Xn]:{exposure:"hidden"},[es]:{exposure:"hidden"},[rs]:{exposure:"hidden",storageGroup:"surveys"},[is]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ns]:{exposure:"event"},[ss]:{exposure:"hidden"},[os]:{exposure:"hidden"},[as]:{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"},[ls]:{exposure:"hidden"},[us]:{exposure:"hidden"},[ts]:{exposure:"event"},[cs]:{exposure:"hidden"},[ds]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[hs]:{exposure:"hidden"},[ps]:{exposure:"hidden"},[vs]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[_s]:{exposure:"hidden"},[fs]:{exposure:"hidden"},[ms]:{exposure:"hidden"},[Rn]:{exposure:"event"},[Pn]:{exposure:"event"},[Fn]:{exposure:"event"},[Ln]:{exposure:"event"},[Ss]:{exposure:"event"},[ws]:{exposure:"event"},[ks]:{exposure:"event"},[Cs]:{exposure:"event"},[Es]:{exposure:"event"},[Ts]:{exposure:"event"},[xs]:{exposure:"event"},[Is]:{exposure:"event"},[Ms]:{exposure:"event"},[Rs]:{exposure:"event"},[Ps]:{exposure:"event"}},zb=[[qn,{exposure:"hidden"}],[Hn,{exposure:"hidden"}],[$n,{exposure:"hidden"}]],Vb=e=>{var t=Wb[e];if(t)return t;for(var r of zb){var i=r[1];if(0===e.indexOf(r[0]))return i}},jb={flags:ds,surveys:is},Gb=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Qb=e=>e+"_cookie_identity_change_pending",Kb="main",Zb=(e,t)=>{Wr(e,((r,i)=>{var n=Vb(i);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]}))};class Yb{constructor(t,r,i){if(void 0===i&&(i=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._config=t,this._ownsSplitStorage=i,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),t.debug&&Hr.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,r),this.save(),e){var n=()=>this.flush();Yr(e,"beforeunload",n,{capture:!1}),Yr(e,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return he(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=cg(e,this._config.cookie_persisted_properties||[]),r=hg(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),n=rg._get(this._name)||void 0;n&&vg(this._name,n)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=n)}catch(e){}else try{var s=rg._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=s?vg(this._name,s):void 0,this._lastSeenMainCookieValue=s}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var r;try{r=rg._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,n=vg(this._name,r);try{i=ug(JSON.parse(r))}catch(e){return!1}if((rg._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=r;var s=pg(this._name,r),o=[...og,...s.properties],a={};if(Object.keys(i).forEach((e=>{var t=i[e];(ae(t)||ce(t)||""===t||e===hs&&t!==Os&&t!==Ds)&&(a[e]=!0,delete i[e])})),oe(i))return!1;var l=vn in i||i[hs]===Os||i[hs]===Ds,u=this.props[vn],c=this.props[hs],d=zr({},this.props);[...og,...e.cookie_persisted_properties||[]].forEach((e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||e!==vn&&e!==hs)){var t=d[e];!s.isValid&&-1!==og.indexOf(e)&&(!1===t||0===t)||delete d[e]}})),this.props=zr(d,i),!l||hs in i||hs in this.props||this._setProp(hs,Os);var h=this.props[vn],p=this.props[hs];return!l||h===u&&p===c||(this._cookieIdentityChangePending=!0,mg._set(Qb(this._name),!0),this._deleteProp(Xn),this._deleteProp(Vn),this._deleteProp(zn),this._deleteProp(Gn),this._deleteProp(Qn),this._deleteProp(Kn),this._deleteProp(ds),this._deleteProp(cs),this._deleteProp(ls),p===Os&&(c===Ds||i[hs]===Os||!ae(u)&&h!==u)&&(Zb(this.props,i),this._deleteProp(es)),p===Ds?this.props.$user_id=h:delete this.props.$user_id,this._deleteProp(fn)),!0}consumeCookieIdentityChange(){var e=Qb(this._name),t=this._cookieIdentityChangePending||!!mg._get(e);return this._cookieIdentityChangePending=!1,t&&mg._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(ae(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Kb],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():ae(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===Gb.indexOf(t.persistence.toLowerCase())&&(Hr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r,i=function(t,r){void 0===t&&(t=[]),void 0===r&&(r=!1);var i=[...og,...t];return g({},ng,{_parse(e){try{var t,n={};try{t=rg._get(e)||void 0,n=t?ug(JSON.parse(t)):{}}catch(e){}var s,o=JSON.parse(ng._get(e)||"{}");if(r){var a=pg(e,t),l=[...og,...a.properties],u={};Object.keys(n).forEach((e=>{var t=n[e];ce(t)||""===t||e===hs&&t!==Os&&t!==Ds||(u[e]=t)}));var c=vn in u||u[hs]===Os||u[hs]===Ds;if(Object.keys(u).length>0){var d,h=o[vn],p=null!==(d=o[hs])&&void 0!==d?d:Os;i.forEach((e=>{if(-1!==l.indexOf(e)&&!(e in n)&&(c||e!==vn&&e!==hs)){var t=o[e];!a.isValid&&-1!==og.indexOf(e)&&(!1===t||0===t)||delete o[e]}})),!c||hs in n||hs in o||(o[hs]=Os),!c||(vn in u?u[vn]:o[vn])===h&&(hs in u?u[hs]:o[hs])===p||(sg.forEach((e=>delete o[e])),u[hs]===Ds&&vn in u?o.$user_id=u[vn]:delete o.$user_id,u[hs]!==Ds&&(delete o[ts],delete o[es]),delete o.__alias)}s=zr(o,u)}else s=zr(n,o);return ng._set(e,s),s}catch(e){}return null},_set(e,i,n,s,o,a){var l=ng._set(e,i,void 0,void 0,a);try{var u=cg(i,t);if(Object.keys(u).length){if(r){var c=ag(e),d=hg(u,t);if(rg._set(c,d,n,s,o,a),rg._get(c)!==JSON.stringify(d)){rg._remove(c,s);var h=cg(i);return rg._set(e,h,n,s,o,a),l}}rg._set(e,u,n,s,o,a)}}catch(e){ng._error(e)}return l},_remove(t,r){try{null==e||e.localStorage.removeItem(t),rg._remove(t,r),rg._remove(ag(t),r)}catch(e){ng._error(e)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),n=!1,s=t.persistence.toLowerCase();return"localstorage"===s&&ng._is_supported()?(r=ng,n=!0):"localstorage+cookie"===s&&i._is_supported()?(r=i,n=!0):"sessionstorage"===s&&mg._is_supported()?r=mg:"memory"===s?r=_g:"cookie"===s?r=rg:i._is_supported()?(r=i,n=!0):r=rg,this._splitStorageEligible=n,r}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return Wr(this.props,((t,r)=>{var i=Vb(r);if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t))return;e[r]=t}})),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),r=t?ng._parse(this._name):null,i={};if(t)try{Wr(i=ug(rg._parse(this._name)),((e,t)=>{(ae(e)||ce(e)||""===e)&&delete i[t]}))}catch(e){}var n=this._storage._parse(this._name);if(n&&(this.props=zr({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var s,o,a=null==r?void 0:r[vn],l=null!==(s=null==r?void 0:r[hs])&&void 0!==s?s:Os,u=n[vn],c=null!==(o=n[hs])&&void 0!==o?o:Os;if(u!==a||c!==l){this._cookieIdentityChangePending=!0,mg._set(Qb(this._name),!0);var d=zr({},this.props);sg.forEach((e=>delete d[e])),c===Os&&(l===Ds||i[hs]===Os||!ae(a)&&u!==a)&&(Zb(d,i),delete d[es]),this.props=d;var h=new Set;sg.forEach((e=>{var t,r=null==(t=Vb(e))?void 0:t.storageGroup;r&&h.add(r)})),h.forEach((e=>{var t={};Wr(this.props,((r,i)=>{var n;(null==(n=Vb(i))?void 0:n.storageGroup)===e&&(t[i]=r)})),oe(t)?(ng._remove(this._groupEntryName(e)),this._slotState[e]={}):ng._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}))}}mg._get(Qb(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Ub){var t=ng._parse(this._groupEntryName(e));if(t&&!oe(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||zr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Vb(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=jb[e];if(!r)return!1;var i=t[r],n=this.props[r];return he(i)&&he(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Vb(e))?void 0:t.storageGroup:void 0,i=r?ng._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var n=this._storage._parse(this._name);if(n&&e in n)return void this._setProp(e,n[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?ae(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){ae(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){void 0===e&&(e=!1),this._disabled||this._cookieSyncSuppressed&&!e||(e||this.syncCookieProperties(),this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Kb)&&this._rememberCurrentCookieProperties(this.props))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,r=e.groups;for(var i of(this._writeEntry(this._storage,this._name,t,Kb)&&this._rememberCurrentCookieProperties(t),Ub)){var n,s=r[i];(!oe(s)||null!=(n=this._slotState[i])&&n.persisted)&&this._writeEntry(ng,this._groupEntryName(i),s,i)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return Wr(this.props,((r,i)=>{var n,s=null==(n=Vb(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Kb)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return Wr(e,((e,t)=>{var i;r[t]=null!=(i=Vb(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n,s=this._slotWriteState(i);if(i!==Kb&&!s.dirty&&!ae(s.fingerprint))return!1;try{if((n=this._entryFingerprint(r,i))===s.fingerprint)return s.dirty=!1,!1}catch(e){n=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(s.dirty=!1,i!==Kb&&(s.persisted=!0),ae(n)||(s.fingerprint=n),!0):(this._config.debug&&Hr.warn('failed to persist storage entry "'+t+'"; will retry on next save'),!1)}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(ae(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of Ub)ng._remove(this._groupEntryName(i));r?delete this._slotState[Kb]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(se(e)){this.syncCookieProperties(),ae(t)&&(t="None"),this._expire_days=ae(r)?this._default_expiry:r;var i=!1;if(Wr(e,((e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(se(e)){this.syncCookieProperties(),this._expire_days=ae(t)?this._default_expiry:t;var r=!1;if(Wr(e,((t,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==t||se(t)||ie(t))&&(this._setProp(i,t),r=!0)})),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,r=!1;for(var i of t)i in this.props&&(this._deleteProp(i),r=!0);r&&this.save()}update_campaign_params(){var e=null==i?void 0:i.URL;if(e!==this._campaign_params_url){var t=Ba(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);oe(Qr(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==i?void 0:i.referrer)?Ha(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Wa(),$referring_domain:null!=i&&i.referrer&&(null==(e=ti(i.referrer))?void 0:e.host)||Ua},void 0)}set_initial_person_info(){this.props[gs]||this.props[_s]||this.register_once({[fs]:za(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};Wr([_s,gs],(t=>{var r=this.props[t];r&&Wr(r,(function(t,r){e["$initial_"+J(r)]=t}))}));var t=this.props[fs];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Va(e,t),i={};return Wr(r,(function(e,t){i["$initial_"+J(t)]=e})),i}(t,this._config.disable_capture_url_hashes);zr(e,r)}return e}safe_merge(e){return Wr(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){var i=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every(((e,t)=>e===i[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),s=i||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(i||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(g({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),l));var u=s||o?this._buildStorage(e):this._storage,c=this._resolveSplitStorage(e),d=s||c!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var p=this.props;this.clear(),this._storage=u,this._splitStorage=c,this.props=p,this.save()}else o&&(this._storage=u,a||(delete this._slotState[Kb],this._writeNow()))}finally{h&&this._endCookieSyncSuppression()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[mn]||{};r[e]=t,this._setProp(mn,r),this.save()}remove_event_timer(e){var t=this.props[mn]||{},r=t[e];return ae(r)||(delete t[e],this._setProp(mn,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var r;this.props[e]=t,null!=(r=Vb(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=Vb(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Jb={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Xb={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"},eS={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"},tS=$r("[RateLimiter]");class rS{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{tS.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void tS.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.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){var t,r,i;void 0===e&&(e=!1);var n=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(vs))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>n&&(a.tokens=n);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var u=(he(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this._captureWarning(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(vs,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!ie(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=n&&n.pathname)return""+(null!==(e=n.origin)&&void 0!==e?e:"")+n.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,s=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(r=this.instance).get_session_id)?void 0:t.call(r):void 0,a=[e+" event(s) dropped since the last warning",s?"triggered on "+s:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+n+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var iS=$r("[RemoteConfig]");class nS{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return iS.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void iS.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return iS.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e.json,e)}));this._onRemoteConfig(e)}))}catch(e){iS.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||iS.warn("Failed to fetch remote config from PostHog."):iS.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){iS.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;null==(r=this._instance.featureFlags)||r.ensureFlagsLoaded()}catch(e){iS.error("Error loading feature flags",e)}}}var sS=["fatal","error","warning","log","info","debug"],oS=!!o||!!s,aS="text/plain",lS=!1,uS=(e,t)=>{var r=e.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},cS=function(e,t,r){var i;void 0===r&&(r=!0);var n=e.split("?"),s=n[0],o=n[1],a=g({},t),l=null!==(i=null==o?void 0:o.split("&").map((e=>{var t,i=e.split("="),n=i[0],s=r&&null!==(t=a[n])&&void 0!==t?t:i[1];return delete a[n],n+"="+s})))&&void 0!==i?i:[],u=ri(a);return u&&l.push(u),l.length>0?s+"?"+l.join("&"):s},dS=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===kv.GZipJS){var i=ia(na(ei(t)),{mtime:0});return{contentType:aS,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===kv.Base64){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(ei(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:ei(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=ei(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},hS=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:cS(e.url,{compression:kv.Base64}),encodedBody:dS(g({},e,{compression:kv.Base64,_encodedBody:void 0}))}:{url:uS(e.url,"compression"),encodedBody:dS(g({},e,{compression:void 0,_encodedBody:void 0}))};try{t=dS(e)}catch(t){if(F(e.compression,ii(e.url,"compression")))return Hr.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&F(e.compression,ii(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?P(new Uint8Array(r)):ArrayBuffer.isView(r)&&P(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(lS=!0,i()):{url:e.url,encodedBody:t}},pS=e=>{try{return hS(e)}catch(t){return Hr.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},vS=function(){var e=v((function*(e){var t=ei(e.data),r=yield N(t,Br.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return g({},e,{_encodedBody:{contentType:aS,body:i,estimatedSize:i.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),gS=/Failed to fetch|NetworkError|Load failed/i,_S=e=>"TypeError"===(null==e?void 0:e.name)&&gS.test((null==e?void 0:e.message)||""),fS=e=>{var t=pS(e);if(t){var r=t.url,i=t.encodedBody,n=null!=i?i:{},o=n.contentType,l=n.body,u=n.estimatedSize,c=new Headers;Wr(e.headers,(function(e,t){c.append(t,e)})),o&&c.append("Content-Type",o);var d=null,h=!1;if(a){var p=new a;d={signal:p.signal,timeout:setTimeout((()=>{var t,r;h=!0,p.abort((t=e.timeout,(r=new Error("PostHog request timed out"+(t?" after "+t+"ms":""))).name="AbortError",r))}),e.timeout)}}var v=t=>{h&&"AbortError"===(null==t?void 0:t.name)||_S(t)?Hr.warn(t):Hr.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var _;s(r,g({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(u||0),body:l,signal:null==(_=d)?void 0:_.signal},e.fetchOptions)).then((t=>t.text().then((r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){Hr.error(e)}null==e.callback||e.callback(i)})))).catch(v).finally((()=>d?clearTimeout(d.timeout):null))}catch(e){d&&clearTimeout(d.timeout),v(e)}}},mS=e=>{try{var t,i=hS(e),n=i.url,s=i.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(r.sendBeacon(n,u))return;var c=ie(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(ie(c)&&c.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(c.length/2),h=t=>ie(e.data)?t:g({},e.data,{batch:t});return mS(g({},e,{data:h(c.slice(0,d))})),void mS(g({},e,{data:h(c.slice(d))}))}Hr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),fS(g({},e,{_keepaliveDisabled:!0}))}catch(e){Hr.warn("Beacon send failed",e)}},yS=(e,t,r,i)=>{var n="query"===i?"POST"===t?"sent_at":"_":void 0;return cS(r===kv.GZipJS?uS(e,"compression"):e,g({},n?{[n]:Date.now().toString()}:{},r===kv.GZipJS?{}:{compression:r}))},bS=[];s&&bS.push({transport:"fetch",method:fS}),o&&bS.push({transport:"XHR",method(e){var t=pS(e);if(t){var r=new o,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var n=null!=i?i:{},s=n.contentType,a=n.body;Wr(e.headers,(function(e,t){r.setRequestHeader(t,e)})),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(a)}}}),null!=r&&r.sendBeacon&&bS.push({transport:"sendBeacon",method:mS});var SS=3e3;class wS{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Te((null==t?void 0:t.flush_interval_ms)||SS,250,5e3,Hr.createLogger("flush interval"),SS),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e),r=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];r.map((e=>{this._sendRequestSafely(g({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),r=function(){var r=t[i],n=(new Date).getTime();r.data&&ie(r.data)&&Wr(r.data,(e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Hr.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Wr(this._queue,(t=>{var r,i=t,n=(i?i.batchKey:null)||i.url;ae(e[n])&&(e[n]=g({},i,{data:[]})),null==(r=e[n].data)||r.push(i.data)})),this._queue=[],e}}var kS=["retriesPerformedSoFar"];class CS{constructor(t){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=t,this._queue=[],this._areWeOnline=!0,!ae(e)&&"onLine"in e.navigator&&(this._areWeOnline=e.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Yr(e,"online",this._onlineListener),Yr(e,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,r=_(e,kS);pe(t)&&(r.url=cS(r.url,{retry_count:t})),this._instance._send_request(g({},r,{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._enqueue(g({retriesPerformedSoFar:t},r));0===e.statusCode&&Hr.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==r.callback||r.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),n=Math.random()-.5;return Math.ceil(i+n*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),Hr.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter((r=>e>r.retryAt||(t.push(r),!1)));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var t of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,ae(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var r=t.requestOptions;try{this._instance._send_request(g({},r,{transport:"sendBeacon"}))}catch(e){Hr.error(e)}}this._queue=[]}}class ES{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(s),this._context.maxScrollY=Math.max(s,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Yr(e,"scroll",this._updateScrollData,{capture:!0}),Yr(e,"scrollend",this._updateScrollData,{capture:!0}),Yr(e,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==e?void 0:e.document.documentElement;var t=ie(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var r of t){var i=null==e?void 0:e.document.querySelector(r);if(i)return i}}_scrollPosition(t){var r="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[r]||0}return e?"y"===t?e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop||0:e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var TS=e=>za(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);class xS{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[ps]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||TS,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[ps]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Va(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 Wr(Qr(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+J(r)]=t})),e}}class IS{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}}var MS=$r("[SessionId]"),RS=864e5;class PS{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new IS,this._sessionHasBeenIdleTooLong=(e,t)=>!(!pe(e)||!pe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===As)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Jv,this._windowIdGenerator=r||Jv;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Te(this._config.session_idle_timeout_seconds||1800,60,36e3,MS.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var s=mg._parse(this._window_id_storage_key),o=mg._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:mg._remove(this._window_id_storage_key),mg._set(this._primary_window_exists_storage_key,!0)}null!=(i=this._config.bootstrap)&&i.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ae(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&mg._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&mg._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?mg._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!ce(t)&&!ce(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!i||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[An]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return pe(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(An):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!ce(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[An]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=pe(e)?e:0,r=pe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[An];return ie(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var r=function(e,t){void 0===t&&(t=(new Date).getTime());try{var r=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return r>t+6e4?void MS.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void MS.error("Invalid sessionID in bootstrap",e)}}(e);return!ae(r)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:r}:this._setSessionId(e,(new Date).getTime(),r),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(qs,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&mg._remove(this._primary_window_exists_storage_key)},Yr(e,qs,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,r){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===r&&(r=!1),this._config.cookieless_mode===As)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),n=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(ce(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var s,o;null==(s=(o=this._persistence).syncCookieProperties)||s.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],c=!ae(n)&&l!==n,d=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,v=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>RS),g=p?v:pe(u)&&Math.abs(i-u)>RS,_=!1,f=c,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,d);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||MS.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||g){f=!1;var w=p&&!v;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),MS.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,_=!0}else h||(h=this._windowIdGenerator(),_=!0),(f=f||l!==y)&&(MS.info("adopted cross-tab session id",{sessionId:l,windowId:h}),_=!0);var k=pe(d)&&e&&!g?d:i,C=pe(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return _&&this._sessionIdChangedHandlers.forEach((e=>e(l,h,E))),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:_?E:void 0,lastActivityTimestamp:d}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}var FS=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&K(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>K(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function LS(){return LS=v((function*(){var e=null==r?void 0:r.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return le(i)&&i.length>0?i:void 0}catch(e){return void Hr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),LS.apply(this,arguments)}var AS="custom",OS="i.posthog.com",DS=/^\/static\//,NS=["/s/","/e/","/i/"];class BS{constructor(e){this._regionCache={},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("."+OS,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":AS),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(DS.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=ti(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,n=this.instance.config.rewriteRequestPath;if(n){var s,o=(null==(s=ti(r))?void 0:s.href)||r;i=n(new URL(o)).toString()}if(n&&"api"===e&&NS.some((e=>0===t.indexOf(e)))){var a=this._urlKey(i);if(a){var l,u=this.apiHost,c=this._ingestionEndpoints;(null==(l=c)?void 0:l.apiHost)===u&&c.rewriteRequestPath===n||(c={apiHost:u,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){var t=this._ingestionEndpoints,r=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return this._prepareEndpoint(e,t,""+r+t)}if(this.region===AS)return this._prepareEndpoint(e,t,this.apiHost+t);var i=OS+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+i);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+i)}}}var qS=$r("[PostHog ExternalIntegrations]"),HS={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class $S{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return qS.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,n,s=r[0],o=r[1];!o||null!=(t=h.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[s]||e._loadScript(HS[s],(()=>{var t;null==(t=h.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[s])||t.start(e._instance)})),!o&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[s]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[s])||n.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class US{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return v((function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var r=e.setup(t._client);r&&(yield r)}catch(r){var i=t._extensions.get(e.name)===e;i&&t._extensions.delete(e.name),t._logger.error('Failed to set up browser extension "'+e.name+'"',r),i&&t._disposeExtension(e)}}))()}getExtension(e){return this._extensions.get(e)}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&ne(t.then)&&t.then(void 0,(t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}))}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class WS{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var r={};for(var i of e){var n=null==t?void 0:t.get_property(i);ae(n)||(r[i]=n)}return r}set(e,t){var r;null==(r=this._instance.persistence)||r.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var zS="extensionsRemoteConfig";class VS{constructor(e){this._disposed=!1,this.instance=e,this._logger=Hr,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new WS(e),this.onEvent=e=>wv(this.instance.on("eventCaptured",(t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}}))),this.onRemoteConfig=e=>{if(this._disposed)return wv((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(zS,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),wv(r)},this._runtime=new US(Hr.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property(gn))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(gn);return"string"==typeof e?e:void 0}get library(){return{name:Br.LIB_NAME,version:Br.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==n?void 0:n.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==n?void 0:n.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,r){var i=this;return v((function*(){r?i.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return wv(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(zS,e))}sendRequest(e,t){var r=this;return v((function*(){var i;void 0===t&&(t={});var n=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),s={method:t.method,url:t.query?cS(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?E.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(r.instance._send_request(s),{statusCode:202}):new Promise((e=>{s.callback=e,r.instance._send_request(s)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var jS={},GS=0,QS=()=>{},KS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ZS="Surveys module not available",YS="sanitize_properties is deprecated. Use before_send instead",JS="Invalid value for property_denylist config: ",XS=["token","distinct_id",bs],ew="posthog",tw=!oS&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),rw=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},iw=t=>{var r;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Zr(null==i?void 0:i.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:QS,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&le(null==n?void 0:n.search)&&-1!==n.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null==(r=e.location)?void 0:r.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){Hr.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:Ns,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:SS},error_tracking:{},_onCapture:QS},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Pi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:rw(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},nw=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],sw=e=>{var t={};for(var r of nw){var i=r[0],n=r[1];ae(e[i])||(t[n]=e[i])}var s=zr({},t,e),o=e.__preview_external_dependency_versioned_paths;return ae(o)||(ae(e.strict_script_versioning)&&(s.strict_script_versioning=!!o),le(o)&&ae(e.asset_host)&&(s.asset_host=o)),ie(e.property_blacklist)&&(ae(e.property_denylist)?s.property_denylist=e.property_blacklist:ie(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:Hr.error(JS+e.property_denylist)),s};class ow{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Hr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class aw{_replaceExtension(e,t){if(e){var r=this._extensions.indexOf(e);-1!==r&&this._extensions.splice(r,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===As||this.config.cookieless_mode===Ls&&this.consent.isRejected()}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&this.get_distinct_id()===ys){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===ys){var r=this.config.get_device_id(Jv());this.register({distinct_id:r,$device_id:r}),e.set_property(hs,Os)}this._sync_opt_out_with_persistence()}}}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(){var e;this.webPerformance=new ow,this._personProcessingSetOncePropertiesSent=!1,this.version=Br.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new IS,this._extensions=[],this._extensionEventPropertyProducers=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=iw(),this.SentryIntegration=Hb,this.sentryIntegration=e=>function(e,t){var r=qb(e,t);return{name:Bb,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new ES(this),this.pageViewManager=new $b(this),this.rateLimiter=new rS(this),this.requestRouter=new BS(this),this.consent=new Fb(this),this.externalIntegrations=new $S(this);var t=null!==(e=aw.__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,r)=>{var i=le(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=le(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>Hr.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==ew){var i,n=null!==(i=jS[r])&&void 0!==i?i:new aw;return n._init(e,t,r),jS[r]=n,jS[ew][r]=n,n}return this._init(e,t,r)}_init(t,r,i){var n,s;void 0===r&&(r={});var o,a=le(t)?t.trim():"";if(!a)return Hr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=iw(r.defaults),r.debug=this._checkLocalStorageForDebug(r.debug),this._originalUserConfig=r,this._triggered_notifs=[],r.person_profiles?this._initialPersonProfilesConfig=r.person_profiles:r.process_person&&(this._initialPersonProfilesConfig=r.process_person);var l=iw(r.defaults),u=sw(r),c=zr({},l,u,{name:i,token:a});se(l.rageclick)&&se(u.rageclick)&&(c.rageclick=zr({},l.rageclick,u.rageclick)),se(l.session_recording)&&se(u.session_recording)&&(c.session_recording=zr({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&Hr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:kv.GZipJS;var d=this._is_persistence_disabled();if(this.persistence=new Yb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yb(g({},this.config,{persistence:"sessionStorage"}),d,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&mg._is_supported()){var h=mg._parse(this._sessionRegisteredPropertiesStorageKey);ie(h)&&h.forEach((e=>{le(e)&&this._sessionRegisteredPropKeys.add(e)}))}else mg._remove(this._sessionRegisteredPropertiesStorageKey);var p=g({},this.persistence.props),v=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new wS((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new CS(this),this.__request_queue=[];var _=this._inCookielessMode();if(_||(this.sessionManager=new PS(this),this.sessionPropsManager=new xS(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((e,t,r)=>{(null!=r&&r.activityTimeout||null!=r&&r.sessionPastMaximumLength||null!=r&&r.crossTabAdoption)&&this._clearSessionRegisteredProps()}))),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Hr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(_)}),0)):(Hr.info("Initializing extensions synchronously"),this._initExtensions(_)),Br.DEBUG=Br.DEBUG||this.config.debug,Br.DEBUG&&Hr.info("Starting in debug mode",{this:this,config:r,thisC:g({},this.config),p:p,s:v}),!this.config.identity_distinct_id||null!=(n=r.bootstrap)&&n.distinctID||(r.bootstrap=g({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=r.bootstrap)?void 0:s.distinctID)){var f=r.bootstrap.distinctID,m=this.get_distinct_id(),y=this.persistence.get_property(hs);if(r.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===Os)this.identify(f);else if(r.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===Ds)Hr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(Jv()),S=r.bootstrap.isIdentifiedID?b:f;this.persistence.set_property(hs,r.bootstrap.isIdentifiedID?Ds:Os),this.register({distinct_id:f,$device_id:S})}}if(_)this.register_once({distinct_id:ys,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Jv());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(hs,Os)}return Yr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||Jv();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(hs,Ds)),t()},n=r.user();"then"in n&&ne(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||Nb.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Nb.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Nb.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(r,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,Hs),identify:e=>t(e,Us),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),ne(this.config._onCapture)&&this.config._onCapture!==QS&&(Hr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Hr.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 LS.apply(this,arguments)}().then((e=>{e&&this.register({[_n]:e})})).catch(QS),this}_isSharedExtension(e){var t=e;return le(t.name)&&ne(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push((()=>{this._getBrowserClientAdapter().add(e).catch((()=>null==e.dispose?void 0:e.dispose())).catch((t=>{Hr.error('Failed to dispose browser extension "'+e.name+'"',t)}))})):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,r,i,n,s,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(r=aw.__defaultExtensionClasses)?void 0:r.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(i=this._featureFlagsReloadingUnsubscribe)||i.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new o(this)),ne(this.featureFlags.onReloading)&&ne(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading((()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)})),this._getBrowserClientAdapter().add(this.featureFlags)):null==(n=(s=this.featureFlags).initialize)||n.call(s))}_initExtensions(e){var t,r,i,n,s,o,a,l=performance.now(),u=g({},aw.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.exceptions&&this._extensions.push(this.exceptions=null!==(t=this.exceptions)&&void 0!==t?t:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._enrollExtension(this.autocapture=new u.autocapture(this),c),u.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),c),u.logs&&this._enrollExtension(this.logs=null!==(i=this.logs)&&void 0!==i?i:new u.logs(this),c),u.metrics&&this._extensions.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(s=this.conversations)&&void 0!==s?s:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ob)),u.toolbar&&this._extensions.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&c.push((()=>{null==e.initialize||e.initialize()}))})),c.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}})),this._processInitTaskQueue(c,l)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var r=e.shift();if(r)try{r()}catch(e){Hr.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[Ss]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ws]:i}),this.config.__preview_deferred_init_extensions&&Hr.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!i||!i.body)return Hr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,n=e.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=Z(n.supportedCompression,kv.GZipJS)?kv.GZipJS:Z(n.supportedCompression,kv.Base64)?kv.Base64:void 0),null!=(r=n.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ns}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Hr.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=n&&n.hostname){var e=n.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new nS(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ur(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture($s),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(n=this._retryQueue)||n.unload()):this._shouldCapturePageleave()&&this.capture($s,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?tw?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=g({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(ae(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,r,i,n=g({},e);n.timeout=n.timeout||6e4;var s,o,a,u,c,d=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&ae(n.compression)&&n.data&&(n.compression=kv.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(o=null==(c=(u=(ie(s=n.data)?s:[s]).map((e=>g({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{}))))[0])||null==(a=c.properties)?void 0:a.token)&&void 0!==o?o:null==c?void 0:c.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),ie(e)?e.map((e=>g({},e,{sent_at:t}))):g({},e,{sent_at:t})}(n.data))),n.url=yS(n.url,n.method,n.compression,n.timestampMode);var h=bS.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),p=null!==(r=null==(i=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,(e=>e.transport===d)))?void 0:i.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var v=e=>{try{p(e)}catch(e){_S(e)?Hr.warn(e):Hr.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==d&&n.data&&n.compression===kv.GZipJS&&l&&"undefined"!=typeof Promise&&!lS?vS(n).then((e=>{v(e)})).catch((t=>{if(L(t))return lS=!0,void v(g({},n,{compression:void 0,url:yS(e.url,e.method,void 0,e.timestampMode)}));A(t)&&(lS=!0),v(n)})):p(n)})(g({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){GS++;try{var t,r=[],i=[],n=[];Ur(e,(e=>{if(e)if(ie(t=e[0]))n.push(e);else if(ne(e))try{e.call(this)}catch(t){Hr.error("Error executing queued PostHog call",e,t)}else ie(e)&&"alias"===t?r.push(e):ie(e)&&-1!==t.indexOf("capture")&&ne(this[t])?n.push(e):i.push(e)}));var s=function(e,t){Ur(e,(function(e){try{if(ie(e[0])){var r=t;Wr(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Hr.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{GS--}}push(e){if(GS>0&&ie(e)&&le(e[0])){var t=aw.prototype[e[0]];ne(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,n,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!ae(e)&&le(e)){this._healCookielessSentinelDistinctId();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!le(null==t?void 0:t.$current_url)&&(Hr.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!=r&&r._originatedFromCaptureException||Hr.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 c=new Date,d=(null==r?void 0:r.timestamp)||c,h=At(null==r?void 0:r.uuid,Jv),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===Hs&&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(Zn);(null==r?void 0:r.$set)&&!v&&(p.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(p.$unset=_);var f=v?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==Ws,e===Us);if(f&&(p.$set_once=f),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,s=p,o=e=>le(e)?e.slice(0,n):e,a=new Set,p=function e(t,r){if(t!==Object(t))return o?o(t):t;if(!a.has(t)){var i;if(a.add(t),ie(t))i=[],Ur(t,(t=>{i.push(e(t))}));else{var n={};Wr(t,((t,r)=>{a.has(t)||(n[r]=e(t,r))})),i=n}return i}}(s)),p.timestamp=d,ae(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),v&&(p.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return k.forEach(i),t.forEach(i),r}(p.properties,XS)),e===Fv.DISMISSED||e===Fv.SENT){var m=null==t?void 0:t[Lv.SURVEY_ID],y=null==t?void 0:t[Lv.SURVEY_ITERATION];Uv({id:m,current_iteration:y}),p.$set=g({},p.$set,{[ha({id:m,current_iteration:y},e===Fv.SENT?"responded":"dismissed")]:!0})}else e===Fv.SHOWN&&(p.$set=g({},p.$set,{[Lv.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Xb.SHOWN){var b=null==t?void 0:t[eS.TOUR_TYPE];b&&(p.$set=g({},p.$set,{[eS.TOUR_LAST_SEEN_DATE+"/"+b]:(new Date).toISOString()}))}var S=g({},p.properties.$set,p.$set);if(oe(S)||this.setPersonPropertiesForFlags(S),!de(this.config.before_send)){var w=this._runBeforeSend(p);if(!w)return;(p=w).uuid=At(p.uuid,Jv)}this._internalEventEmitter.emit("eventCaptured",p);var C=null!==(i=null==r?void 0:r._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),E={method:"POST",url:C,data:p,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(C)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}Hr.critical("This capture call is ignored due to client rate limiting.")}}else Hr.error("No event name provided to posthog.capture")}else Hr.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new VS(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}_processCookieIdentityChange(e){var t,r,i;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,this.persistence.get_property(hs)===Os&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,s,o,a){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return r;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var l=a?void 0:this.persistence.remove_event_timer(t),c=g({},r);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this._inCookielessMode()&&(c[bs]=!0),"$snapshot"===t){var d=g({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=d.distinct_id,(!le(c.distinct_id)&&!he(c.distinct_id)||ue(c.distinct_id))&&Hr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=function(t,r,i,s){var o,a,l,c;if(void 0===s&&(s=!1),!u)return{};var d,h=t?[...Aa,...r||[]]:[],p=function(e){for(var t=0;Rt.length>t;t++){var r=Rt[t],i=r[1],n=r[0].exec(e),s=n&&(ne(i)?i(n,e):i);if(s)return s}return["",""]}(u),v=p[0],g=p[1],_=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},f={};ae(i)||(f.detectGoogleSearchApp=i);var m={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,S=null==e||null==(l=e.screen)?void 0:l.width,w=null==e||null==(c=e.screen)?void 0:c.height,k=null==e?void 0:e.devicePixelRatio;ae(y)||(m.userAgentDataPlatform=y),ae(b)||(m.maxTouchPoints=b),ae(S)||(m.screenWidth=S),ae(w)||(m.screenHeight=w),ae(k)||(m.devicePixelRatio=k);var C,E=zr(Qr({$os:v,$os_version:g,$browser:xt(u,navigator.vendor,_,f),$device:Pt(u),$device_type:Ft(u,m),$timezone:ja(),$timezone_offset:Ga()}),{$current_url:ni(s?Ot(null==n?void 0:n.href):null==n?void 0:n.href,h,Da),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Mt(u,navigator.vendor,_,f),$browser_language:$a(),$browser_language_prefix:(C=$a(),"string"==typeof C?C.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Br.LIB_NAME,$lib_version:Br.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Br.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=Br.SDK_DIST_CHANNEL),E}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var v=this.sessionManager.checkAndGetSessionAndWindowId(a,s.getTime(),!0),_=v.windowId;c.$session_id=v.sessionId,c.$window_id=_}this.sessionPropsManager&&zr(c,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&zr(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(f=this._retryQueue)?void 0:f.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===AS&&(c.$lib_custom_api_host=this.config.api_host),h=t!==Hs||a?t!==$s||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,o),c=zr(c,h),t===Hs&&i&&(c.title=i.title),!ae(l)){var m=s.getTime()-l;c.$duration=parseFloat((m/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();Wr(["$referrer","$referring_domain"],(e=>{e in y&&delete b[e]}));var S={};if(this._extensionEventPropertyProducers.length>0)for(var w of this._extensionEventPropertyProducers.slice())try{zr(S,w())}catch(e){Hr.error("Failed to produce browser extension event properties",e)}(c=zr({},p,y,b,g({},S,c))).$is_identified=this._isIdentified(),ie(this.config.property_denylist)?Wr(this.config.property_denylist,(function(e){delete c[e]})):Hr.error(JS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Hr.error(YS),c=k(c,t));var C=this._hasPersonProcessing();return c.$process_person_profile=C,C&&!a&&this._requirePersonProcessing("_calculate_event_properties"),c}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var n=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=zr({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&(Hr.error(YS),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),oe(o)?void 0:o}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t,r;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(r=this.sessionPersistence)||r.register(e),Object.keys(e).forEach((e=>this._sessionRegisteredPropKeys.add(e))),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach((e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)})),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!mg._is_supported())mg._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach((e=>t.push(e))),t.length>0?mg._set(this._sessionRegisteredPropertiesStorageKey,t):mg._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.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 r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.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:ZS}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.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:ZS})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:ZS})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=zv),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:ZS}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:ZS})}_validateIdentifyId(e){return!e||ue(e)?(Hr.critical("Unique user id has not been set in posthog.identify"),!1):e===ys?(Hr.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())||(Hr.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return Hr.uninitializedWarning("posthog.identify");if(he(e)&&(e=e.toString(),Hr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var i=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property(gn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property(fn)&&(this.unregister(fn),this.register({distinct_id:e}));var u,c=(this.persistence.get_property(hs)||Os)===Os,d=e!==l,h=!d&&c;if(d&&c)this.persistence.set_property(hs,Ds),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(Us,{distinct_id:e,$anon_distinct_id:l},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Ca(e,t,r),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(hs,Ds);var p=t||{},v=r||{};this.setPersonPropertiesForFlags({$set:p,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:v}),this._cachedPersonProperties=Ca(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||n||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ls)):h&&(t||r)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=Ca(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):Hr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(ie(e)?e:[e]).filter((e=>le(e)&&e.length>0));0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,r){var i;if(e&&t){null==(i=this.persistence)||i.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),s=n[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:g({},n,{[e]:t})}),s||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(Ws,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else Hr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=ve(e)?e:null==e?void 0:e.resetDeviceID,r=ve(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,n,s;if(void 0===t&&(t=!1),Hr.info("reset"),!this.__loaded)return Hr.uninitializedWarning("posthog.reset");var o=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(gn),l=this.get_property(_n),u=this.get_property(In),c=this.is_capturing();this.consent.reset(),t||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(s=this.persistence)||null==s._beginCookieSyncSuppression?void 0:s._beginCookieSyncSuppression(),h=!1;try{var p,v,_,f,m,y,b,S,w,k,C,E,T;if(null==(p=this.persistence)||p.clear(),null==(v=this.sessionPersistence)||v.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),ae(u)||null==(k=this.persistence)||k.register({[In]:u}),null==(_=this.surveys)||_.reset(),null==(f=this.featureFlags)||f.reset(),null==(m=this.conversations)||m.reset(),null==(y=this.logs)||y.reset(),null==(b=this.metrics)||b.reset(),null==(S=this.persistence)||S.set_property(hs,Os),null==(w=this.sessionManager)||w.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===As)this.register_once({distinct_id:ys,$device_id:null},"");else{var x=this.config.get_device_id(Jv());this.register_once({distinct_id:x,$device_id:e?x:a},""),e||ae(l)||this.register({[_n]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(T=this.persistence)||T.set_property(hs,r.isIdentifiedID?Ds:Os),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(ae(o)||null!=(E=this.sessionManager)&&E.setBootstrapSessionId(o,!0))){var I=g({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,h=!0}finally{var M;d&&(null==(M=this.persistence)||null==M._endCookieSyncSuppression||M._endCookieSyncSuppression(h))}this.reloadFeatureFlags()}shutdown(e){var t=this;return v((function*(){var e,r,i,n,s;if(t.__loaded){t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(r=t.logs)||r.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(n=t._requestQueue)||n.unload(),null==(s=t._retryQueue)||s.unload();try{var o;null==(o=t.featureFlags)||o.destroy()}catch(e){Hr.error("Error while destroying feature flags",e)}}else Hr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return i}alias(e,t){return e===this.get_property(pn)?(Hr.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(ae(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(fn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Hr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=g({},this.config);if(se(e)){var r,i,n,s,o,a,l,u,c,d,h,p;zr(this.config,sw(e));var v=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yb(g({},this.config,{persistence:"sessionStorage"}),v,!1);var _,f=this._checkLocalStorageForDebug(this.config.debug);ve(f)&&(this.config.debug=f),ve(this.config.debug)&&(this.config.debug?(Br.DEBUG=!0,ng._is_supported()&&ng._set("ph_debug",!0),Hr.info("set_config",{config:e,oldConfig:t,newConfig:g({},this.config)})):(Br.DEBUG=!1,ng._is_supported()&&ng._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){Br.LIB_NAME=e,Br.LIB_VERSION=t}startSessionRecording(e){var t,r,i,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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 r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(g({},i,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.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:aw._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.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:ew;return t!==ew&&(t=ew+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(hs))===Ds||(null==(t=this.sessionPersistence)?void 0:t.get_property(hs))===Ds}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Ns&&!this._isIdentified()&&oe(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[fn])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ms]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Hr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ms,!0),!0)}_is_persistence_disabled(){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!==Ls)}_sync_opt_out_with_persistence(){var e,t,r,i,n=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(i=this.sessionPersistence)||i.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==As){if(this._inCookielessMode()){var r,i,n,s,o;this._reset(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=new PS(this),this.pageViewManager=new $b(this),this.persistence&&(this.sessionPropsManager=new xS(this,this.sessionManager,this.persistence));var a,l=null!==(n=null==(s=this.config.__extensionClasses)?void 0:s.sessionRecording)&&void 0!==n?n:null==(o=aw.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ls&&(null==(u=this.surveys)||u.loadIfEnabled()),(ae(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Hr.warn(KS)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==As?(this.config.cookieless_mode===Ls&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Ls&&(this.register({distinct_id:ys,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Hr.warn(KS)}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===As||(this.config.cookieless_mode===Ls?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return r?FS(r,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){i&&("visible"===i.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Hs,{title:i.title},{send_instantly:!0}),this._visibilityStateListener&&(i.removeEventListener(Bs,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Yr(i,Bs,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Hr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,r,i,n){var s=t in e&&!de(e[t]),o=r in e&&!de(e[r]);return s?e[t]:!!o&&(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,Hr)}_runBeforeSend(e){var t;if(de(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(fe),i=ie(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i)try{if(n=s(n),de(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return _e(e.event)?Hr.warn(o+". This can cause unexpected behavior."):Hr.info(o),null}n.properties&&!oe(n.properties)||Hr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Hr.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(n.properties&&de(n.properties[a]))return Hr.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 n}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=ve(e)&&!e,r=ng._is_supported()&&"true"===ng._get("ph_debug");return!t&&(!!r||e)}}aw.__defaultExtensionClasses={},aw._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Gr(e.prototype[t[r]])}(aw,["identify"]);class lw{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,r=se(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==r?void 0:r.url_allowlist,e.url_ignorelist=null==r?void 0:r.url_ignorelist,e.dom_event_allowlist=null==r?void 0:r.dom_event_allowlist,e.element_allowlist=null==r?void 0:r.element_allowlist,e.css_selector_allowlist=null==r?void 0:r.css_selector_allowlist,e.css_selector_ignorelist=null==r?void 0:r.css_selector_ignorelist,e.element_attribute_ignorelist=null==r?void 0:r.element_attribute_ignorelist,e.capture_copied_text=null==r?void 0:r.capture_copied_text}}var uw=$r("[ExceptionAutocapture]"),cw=$r("[TracingHeaders]"),dw=$r("[Web Vitals]"),hw=9e5,pw=["CLS","FCP","INP","LCP"],vw=["INP","LCP"],gw=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],_w="[SessionRecording]",fw=$r(_w),mw=$r("[Heatmaps]");function yw(e){return se(e)&&"clientX"in e&&"clientY"in e&&he(e.clientX)&&he(e.clientY)}var bw=$r("[Product Tours]"),Sw=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(Tn))},ww=["$set_once","$set"],kw=$r("[SiteApps]"),Cw="Error while initializing PostHog app with config id ",Ew=(e,t)=>null!=e&&e.then?e.then(t):t(e),Tw="SDK is not enabled or survey functionality is not yet loaded",xw="Disabled. Not loading surveys.";class Iw{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(!this._disposed&&!this._config.disableSurveys){if(!e.ok)return Ov.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(de(t))return Ov.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=ve(t)?t:t.length>0,Ov.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}},this._configSource=e,this._initialClientState=t}setup(e){if(!this._disposed)return this._initializingClient=e,Ew(e.kv.initialize(),(()=>{if(this._initializingClient===e&&!this._disposed){this._initializingClient=void 0,this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())}}))}dispose(){var e,t,r;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(r=this._surveyManager)||null==r.dispose||r.dispose(),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach((e=>clearTimeout(e))),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith(Bv)||null!=i&&i.startsWith(qv))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._disposed&&this._client){var e=this._config;if(!this._surveyManager)if(this._isInitializingSurveys)Ov.info("Already initializing surveys, skipping...");else if(e.disableSurveys)Ov.info(xw);else if(e.cookielessMode&&this._configSource.isOptedOut())Ov.info("Not loading surveys in cookieless mode without consent.");else{var t=this._configSource.getExtensions();if(t){if(!ae(this._isSurveysEnabled)||e.advancedEnableSurveys){var r=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{var i=t.generateSurveys;if(i)return this._completeSurveyInitialization(i,r),void(this._isInitializingSurveys=!1);var n=t.loadExternalDependency;if(!n)return this._handleSurveyLoadError(Fs),void(this._isInitializingSurveys=!1);n((e=>{try{if(this._disposed)return;var t=this._configSource.getExtensions();e||null==t||!t.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,r)}finally{this._isInitializingSurveys=!1}}))}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}}else Ov.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),Ov.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){Ov.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){var r;void 0===t&&(t=!1);var i=null!==(r=this._client)&&void 0!==r?r:this._initialClientState;if(i&&!this._disposed){if(this._config.disableSurveys)return Ov.info(xw),e([]);var n=i.kv.get(rs);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then((t=>{this._disposed||e(t.surveys,t.context)})).catch((e=>Ov.error("Error in survey callback",e)));else{var s=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then((e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return Ov.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}}),(e=>this._handleSurveyResponse(i,{statusCode:0,error:e})));this._getSurveysInFlightPromise=s;var o=()=>{this._getSurveysInFlightPromise===s&&(this._getSurveysInFlightPromise=null)};s.then((t=>{o(),this._disposed||e(t.surveys,t.context)}),o).catch((e=>Ov.error("Error in survey callback",e)))}}}_sendSurveysRequest(e,t){var r=this._client;return r?r.sendRequest(e,t):new Promise((e=>e({statusCode:0,error:new Error(Tw)})))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:Tw}};var r=t.statusCode;if(200!==r||!t.json){var i="Surveys API could not be loaded, status: "+r;return 0!==r?Ov.error(i):t.error||Ov.warn(i),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this._lastSurveyRefreshFailedAt=null;var n,s=t.json.surveys||[],o=s.filter((e=>Dv(e)&&(ma(e)||Nv(e))));return o.length>0&&(null==(n=this._surveyEventReceiver)||n.register(o)),e.kv.set({[rs]:s,[is]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t,r=null==(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)?void 0:e.kv.get(is);return he(r)&&Date.now()-r>3e5}_isSurveyRefreshBackingOff(){return he(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r,i={id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null};Uv(i);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Ov.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!de(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ov.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((r=>{var i;t=null!==(i=r.find((t=>t.id===e)))&&void 0!==i?i:null})),t}_checkSurveyEligibility(e){if(de(this._surveyManager))return{eligible:!1,reason:Tw};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(de(this._surveyManager))return{eligible:!1,reason:Tw};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(de(this._surveyManager))return Ov.warn("init was not called"),{visible:!1,disabledReason:Tw};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return de(this._surveyManager)?(Ov.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Tw})):new Promise((r=>{this.getSurveys((t=>{var i,n=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(n){var s=this._checkSurveyRenderability(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var n;if(de(this._surveyManager))Ov.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(Wv.includes(s.type)){var o=null==i?void 0:i.querySelector(t);if(o)if(null!=(n=s.appearance)&&n.surveyPopupDelaySeconds){Ov.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var e,t;this._renderTimeouts.delete(a),this._disposed||(Ov.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,o,r),Ov.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(a)}else this._surveyManager.renderSurvey(s,o,r);else Ov.warn("Survey element not found")}else Ov.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ov.warn("Survey not found")}}displaySurvey(e,t){var r;if(de(this._surveyManager))Ov.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var n=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=g({},i,{appearance:g({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Av.Popover&&t.initialResponses&&Ov.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this._checkSurveyEligibility(i);if(!s.eligible)return void Ov.warn("Survey is not eligible to be displayed: ",s.reason)}t.displayType!==Av.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else Ov.warn("Survey not found")}}cancelPendingSurvey(e){de(this._surveyManager)?Ov.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}function Mw(e,t,r){if(de(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Rw{constructor(e){this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new IS,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e}init(){var e,t;ae(null==(e=this._instance)?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null==(t=this._instance)?void 0:t._addCaptureHook(((e,t)=>{this.on(e,t)})))}dispose(){var e;null==(e=this._captureHookUnsubscribe)||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new IS}register(e){var t,r;if(!ae(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t;this._actionRegistry.add(e),null==(t=e.steps)||t.forEach((e=>{this._actionEvents.add((null==e?void 0:e.event)||"")}))})),null!=(r=this._instance)&&r.autocapture)){var i=new Set;this._actionRegistry.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&i.add(e.selector)}))})),this._instance.autocapture.setElementSelectors(i)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!Mw(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>Mw(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&Mw((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>Mw(e.text,t.text,t.text_matching||"exact")||Mw(e.$el_text,t.text,t.text_matching||"exact")));var n,s,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(n=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!de(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),s=t.text,o=t.text_matching||"exact",n.some((e=>Mw(e,s,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var n=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||ka(t.properties.reduce(((e,t)=>{var r=ie(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class Pw{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null==(t=this._instance)||null==t.onSessionId?void 0:t.onSessionId((e=>this._onSessionIdChanged(e)))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&ka(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach((e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach((t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}}))})),r}_getMatchingItems(e,t,r){var i=(r===Cv.Activation?this._eventToItems:this._cancelEventToItems).get(e),n=[];return this._getItems((e=>{n=e.filter((e=>null==i?void 0:i.includes(e.id)))})),n.filter((i=>{var n,s=null==(n=i.conditions)||null==(n=n[r])||null==(n=n.values)?void 0:n.find((t=>t.name===e));return this._doesEventMatchFilter(s,t)}))}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var r;ae(null==(r=this._instance)?void 0:r._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){var r=e.filter((e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length}));if(t&&this._actionToItems.clear(),0!==r.length){this._actionMatcher||(this._actionMatcher=new Rw(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>this.onAction(e))));var i=[];r.forEach((e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach((t=>{if(i.push(t),t.name){var r,n=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];n.includes(e.id)||n.push(e.id),this._actionToItems.set(t.name,n)}}))})),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var n;t&&(null==(n=this._actionMatcher)||n.replace([]))}}_mergeItemMaps(e,t){t.forEach(((t,r)=>{var i,n=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach((e=>{n.includes(e)||n.push(e)})),e.set(r,n)}))}_setupEventBasedItems(e,t){var r,i,n=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})),s=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0})),o=this._buildEventToItemMap(e,Cv.Activation),a=this._buildEventToItemMap(e,Cv.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==s.length)&&(null!==(r=this._captureHookUnsubscribe)&&void 0!==r||(this._captureHookUnsubscribe=null==(i=this._instance)?void 0:i._addCaptureHook(((e,t)=>{this.onEvent(e,t)}))))}onEvent(e,t){var r,i,n=this._getLogger(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var o=this._activationOutcome(e,s);if("consume"===o)return n.info("event consumed activated item, removing it",{event:e,itemId:s}),void this._deactivateItems([s]);if("persist"===o)return n.info("shown item promoted to persisted activation",{event:e,itemId:s}),this._persistActivation(s),void this._clearActivationTimestamps([s])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,Cv.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map((e=>e.id))}),this._deactivateItems(a.map((e=>e.id))),a.forEach((e=>this._cancelPendingItem(e.id))))}if(this._eventToItems.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,Cv.Activation);this._activateItems(l.map((e=>e.id)))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t;if(0!==e.length){var r=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),i=[];for(var n of e)r&&this._shouldPersistArmedActivation(n)?this._persistActivation(n)&&this._recordActivationTimestamp(n):i.push(n);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter((t=>t!==e));var t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getRawPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e,t=this._getActivationTimestampsKey();if(!t)return{};var r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return r&&"object"==typeof r?r:{}}_recordActivationTimestamp(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps();this._writeActivationTimestamps(g({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var n of Object.entries(t)){var s=n[0],o=n[1];e.includes(s)?i=!0:r[s]=o}i&&(oe(r)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(r))}}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(this._getPersistedActivatedIds().includes(e)){var t=this._getRawActivationTimestamps()[e];return he(t)?t:void 0}}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],n=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return n&&i===n?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];if(r&&r!==e){var i=this._getRawPersistedActivatedIds(),n=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter((e=>he(n[e]))).forEach((e=>this._cancelPendingItem(e)))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}dispose(){var e,t,r;null==(e=this._sessionIdUnsubscribe)||e.call(this),this._sessionIdUnsubscribe=void 0,null==(t=this._captureHookUnsubscribe)||t.call(this),this._captureHookUnsubscribe=void 0,null==(r=this._actionMatcher)||r.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class Fw extends Pw{constructor(e){super(e)}_getActivatedKey(){return ns}_getActivatedSessionKey(){return ss}_getActivationTimestampsKey(){return os}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[os]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(os)}_shouldPersistArmedActivation(e){var t,r;this._getItems((t=>{r=t.find((t=>t.id===e))}));var i=null==(t=r)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return he(i)&&i>0}_getShownEventName(){return Fv.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return Ov}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ns]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ss]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(ss)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||ya(r)?e===Fv.SHOWN?"consume":"ignore":e===Fv.SHOWN?"persist":e===Fv.DISMISSED||e===Fv.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Lw{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);var t={};for(var r of e){var i=this._instance.get_property(r);ae(i)||(t[r]=i)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach((e=>this._instance.unregister(e))):this._instance.unregister(e)}}class Aw{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=null==h?void 0:h.__PosthogExtensions__;if(e){var t=e.generateSurveys,r=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:r?e=>r(this._instance,"surveys",e):void 0}}}createEventReceiver(){return new Fw(this._instance)}}var Ow=null!=e&&e.location?si(e.location.hash,"__posthog")||si(location.hash,"state"):null,Dw="_postHogToolbarParams",Nw=$r("[Toolbar]"),Bw=$r("[FeatureFlags]");class qw{constructor(e,t){void 0===t&&(t=!1),this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var r,i,n,s,o;return{bootstrap:{featureFlags:null==(r=e.bootstrap)?void 0:r.featureFlags,featureFlagPayloads:null==(i=e.bootstrap)?void 0:i.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(n=e.remote_config_refresh_interval_ms)&&void 0!==n?n:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(s=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==s?s:[],flagKeys:ie(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(Bw.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),ae(e.flag_keys)||ie(e.flag_keys)||Bw.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}}var Hw=$r("[FeatureFlags]"),$w=$r("[FeatureFlags]",{debugEnabled:!0}),Uw="\" failed. Feature flags didn't load in time.",Ww="connection_error",zw=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},Vw=e=>{var t={};for(var r of Vr(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},jw="Refusing to render web experiment since the viewer is a likely bot",Gw={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>ba(t,e),not_regex:(e,t)=>!ba(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Qw{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Qw._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(Qw._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t._flagToExperiments)||r.set(e.feature_flag_key,e));var i=t._instance.getFeatureFlag(e.feature_flag_key);le(i)&&e.variants[i]&&t._applyTransforms(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];Qw._matchesTestVariant(s,t._instance)&&t._applyTransforms(e.name,n,s.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Qw._logInfo(jw);else if(!this._config.disable_web_experiments){if(de(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Qw._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),n=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=n&&n.variants[i]&&this._applyTransforms(n.name,i,n.variants[i].transforms)}}))}}previewWebExperiment(){var e=Qw.getWindowLocation();if(null!=e&&e.search){var t=ii(null==e?void 0:e.search,"__experiment_id"),r=ii(null==e?void 0:e.search,"__experiment_variant");t&&r&&(Qw._logInfo("previewing web experiments "+t+" && "+r),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),r,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(Qw._logInfo("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this._applyTransforms(i[0].name,t,i[0].variants[t].transforms))}static _matchesTestVariant(e,t){return!de(e.conditions)&&Qw._matchUrlConditions(e,t)&&Qw._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(de(e.conditions)||de(null==(r=e.conditions)?void 0:r.url))return!0;var i=Qw.getWindowLocation();if(i){var n,s,o,a=li(t,i.href);return null==(n=e.conditions)||!n.url||Gw[null!==(s=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,a)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(de(e.conditions)||de(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Ba();if(r.utm_source){var i,n,s,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==r.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.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)==r.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==r.utm_term;return d&&p&&v&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];Hr.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?Qw._logInfo(jw):"control"!==t?r.forEach((r=>{if(r.selector){var i;Qw._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var n=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==n||n.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):Qw._logInfo("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?FS(r,this._config.custom_blocked_useragents):void 0}}var Kw=$r("[Conversations]"),Zw="Conversations not available yet.",Yw="console",Jw="__posthogHandledLogsRequestError",Xw=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[Jw]=!0,r},ek=e=>!!e&&"object"==typeof e&&!0===e[Jw],tk={featureFlags:class{constructor(e){this.name=Vv,this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=Hw,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t=this._refreshIntervalMs;ae(t)||this._config.remoteRequestsDisabled||!i||"hidden"===i.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==i?void 0:i.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._mutableConfigSource=new qw(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var r;null==(r=this._mutableConfigSource)||r.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),Ew(e.kv.initialize(),(()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))}))}_finishSetup(t){if(this._client===t)return e&&Yr(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties((()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues)),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){var e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&i&&!ae(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),ae(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),null!=i&&i.addEventListener&&Yr(i,Bs,this._onVisibilityChange)))}_scheduleNextRefresh(){ae(this._refreshIntervalMs)||(ae(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){ae(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==i||null==i.removeEventListener||i.removeEventListener(Bs,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null==(t=this._dynamicProperties)||t.dispose(),this._dynamicProperties=void 0,this._reloadingHandlers=[],null==e||e.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return null==(t=this._client)?void 0:t.kv.get(e)}_set(e){this._persist((()=>{var t;return null==(t=this._client)?void 0:t.kv.set(e)}))}_remove(e){this._persist((()=>{var t;return null==(t=this._client)?void 0:t.kv.remove(e)}))}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){var e={};for(var t of[Vn,Qn,Kn,Yn]){var r=this._prop(t);ae(r)||(e[t]=r)}this._baseEventProperties=e;var i=g({},e),n=this._prop(zn);if(n)for(var s of Object.entries(n))i["$feature/"+s[0]]=s[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(ds);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e=this._config.evaluationContexts;return null!=e&&e.length?e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_getValidFlagKeys(){var e=this._config.flagKeys;if(!ae(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t}))}initialize(){var e,t,r=this._config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var n,s,o=null!==(n=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==n?n:{},a=Object.keys(i).filter((e=>!!i[e])).reduce(((e,t)=>(e[t]=i[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(e[t]=o[t],e)),{});return this._receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,r){var i,n,s=null!=r&&r.merge&&null!==(i=this._prop(zn))&&void 0!==i?i:{},o=null!=r&&r.merge&&null!==(n=this._prop(Qn))&&void 0!==n?n:{},a=g({},s,e),l=g({},o,t),u={};for(var c of Object.entries(a)){var d=c[0],h=c[1];u[d]={key:d,enabled:b(h),variant:S(h),reason:void 0,metadata:ae(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this._receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(Gn),t=this._prop(Yn),r=this._prop(Jn);if(!r&&!t)return e||{};var i=zr({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var s of n){var o,a,l=i[s],u=null==t?void 0:t[s],c=ae(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=ae(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[s],p=g({},l,{enabled:c,variant:c?null!=d?d:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),h&&(p.metadata=g({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[s]=p}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((r=>{var i=e[r];return{key:r,enabled:b(i),variant:S(i),payload:y(t[r])}}))}getFlagVariants(){var e=this._prop(zn),t=this._prop(Yn);if(!t)return e||{};for(var r=zr({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(Qn),t=this._prop(Jn);if(!t)return e||{};for(var r=zr({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||this._reloadDebouncer||(this._reloadingHandlers.slice().forEach((e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}})),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter((t=>t!==e))}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(ls)}_callFlagsEndpoint(e){this._clearDebouncer();var t=this._client;if(t&&!this._config.remoteRequestsDisabled&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},t.initialPersonProperties,this._prop(Xn)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(es),timezone:ja()};ae(t.deviceId)||(r.$device_id=t.deviceId),(null!=e&&e.disableFlags||this._config.featureFlagsDisabled)&&(r.disable_flags=!0);var i=this._getValidEvaluationEnvironments();i.length&&(r.evaluation_contexts=i);var n=this._getValidFlagKeys();ae(n)||(r.flag_keys=n);var s=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(s?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;var l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[cs]:[Ww]}),this._logger.error("Feature flag request failed",e),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then((e=>{var t,i,n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a===this._requestGeneration){if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),!r.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!o;var u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?Ww:"unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),n.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var c=!(null==(i=n.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),this._set({[cs]:u}),c?this._logger.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(n,o,{partialResponse:s}),l()}}else l()})).catch(u)}catch(e){u(e)}}}_hasStatusZeroCircuitBreakerTripped(){return oi(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=ai(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.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 r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else this._logger.warn('getFeatureFlag for key "'+e+Uw)}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._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r,i=this.getFlagVariants(),n=e in i,s=i[e],o=this.getFlagPayloads()[e],a=String(s),l=this._prop(Kn)||void 0,u=this._prop(ds)||void 0,c=this._prop(ls)||{};if(this._config.deduplicateCallsPerSession){var d,h=null==(d=this._client)?void 0:d.session.sessionId,p=this._prop(us);h&&h!==p&&(c={},r=h)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(a))r&&this._set({[ls]:c,[us]:r});else{var v,_,f,m,b,S,w,k,C,E,T,x;ie(c[e])?c[e].push(a):c[e]=[a],this._set(g({[ls]:c},r?{[us]:r}:{}));var I=this.getFeatureFlagDetails(e),M=[...null!==(v=this._prop(cs))&&void 0!==v?v:[]];ae(s)&&M.push("flag_missing");var R={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this._config.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[e])&&void 0!==m?m:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};ae(null==I||null==(S=I.metadata)?void 0:S.has_experiment)||(R.$feature_flag_has_experiment=I.metadata.has_experiment),ae(null==I||null==(w=I.metadata)?void 0:w.version)||(R.$feature_flag_version=I.metadata.version);var P,F=null!==(k=null==I||null==(C=I.reason)?void 0:C.description)&&void 0!==k?k:null==I||null==(E=I.reason)?void 0:E.code;F&&(R.$feature_flag_reason=F),null!=I&&null!=(T=I.metadata)&&T.id&&(R.$feature_flag_id=I.metadata.id),ae(null==I?void 0:I.original_variant)&&ae(null==I?void 0:I.original_enabled)||(R.$feature_flag_original_response=ae(I.original_variant)?I.original_enabled:I.original_variant),null!=I&&null!=(x=I.metadata)&&x.original_payload&&(R.$feature_flag_original_payload=null==I||null==(P=I.metadata)?void 0:P.original_payload),M.length&&(R.$feature_flag_error=M.join(",")),this._captureFeatureFlagCalled(R)}else r&&this._set({[ls]:c,[us]:r});if(n)return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:y(o)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+Uw)}_captureFeatureFlagCalled(e){try{var t;null==(t=this._client)||t.capture("$feature_flag_called",e).catch((e=>{this._logger.error("Failed to capture feature flag call",e)}))}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var r=this;return v((function*(){var i=r._client;if(i){var n={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},s=r._getValidEvaluationEnvironments();s.length&&(n.evaluation_contexts=s);var o,a=r._getValidFlagKeys();ae(a)||(n.flag_keys=a);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:r._config.compression,sentAt:"body",timeoutMs:r._config.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[e])||void 0}catch(e){return void r._logger.error("Remote config feature flag request failed",e)}try{t(o)}catch(e){r._logger.error("Remote config feature flag callback failed",e)}}}))()}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+Uw),t.defaultValue;var r=this.getFeatureFlag(e,t);return ae(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,r){this._receivedFeatureFlags(e,t,r)}_receivedFeatureFlags(e,t,r){if(this._client){this._hasLoadedFlags=!0;var i=function(e,t,r,i,n,s){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===s&&(s=Hw);var o=((e,t)=>{var r=e.flags;return r?g({},e,{featureFlags:Object.fromEntries(Object.keys(r).map((e=>{var t;return[e,null!==(t=r[e].variant)&&void 0!==t?t:r[e].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((e=>r[e].enabled)).filter((e=>{var t;return null==(t=r[e].metadata)?void 0:t.payload})).map((e=>{var t;return[e,null==(t=r[e].metadata)?void 0:t.payload]})))}):(e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)})(e,s),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(ie(l)){s.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(l)for(var p=0;l.length>p;p++)h[l[p]]=!0;return{[Vn]:l,[zn]:h,[Zn]:!1}}var v=l,_=u,f=a;if(null!=n&&n.partialResponse)v=g({},t,v),_=g({},r,_),f=g({},i,f);else if(e.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));v=g({},t,Object.fromEntries(Object.entries(v).filter((e=>m.has(e[0]))))),_=g({},r,Object.fromEntries(Object.entries(_||{}).filter((e=>m.has(e[0]))))),f=g({},i,Object.fromEntries(Object.entries(f||{}).filter((e=>m.has(e[0])))))}else v=g({},t,v),_=g({},r,_),f=g({},i,f);return g({[Vn]:Object.keys(Vw(v)),[zn]:v||{},[Qn]:_||{},[Gn]:f||{},[Zn]:!0===e.minimalFlagCalledEvents},c?{[Kn]:c}:{},d?{[ds]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);i&&this._set(i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([Yn,Jn]),this._fireFeatureFlagsCallbacks(),void $w.info("All overrides cleared");if(ie(e))return this._set({[Yn]:zw(e)}),this._fireFeatureFlagsCallbacks(),void $w.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,r=e;this._override_warning=Boolean(null!==(t=r.suppressWarning)&&void 0!==t&&t);var i={},n=r.flags,s=r.payloads;return n&&(i[Yn]=ie(n)?zw(n):n),s&&(i[Jn]=s),Object.keys(i).length&&this._set(i),!1===n&&!1===s?this._remove([Yn,Jn]):!1===n?this._remove(Yn):!1===s&&this._remove(Jn),this._fireFeatureFlagsCallbacks(),!1===n?$w.info("Flag overrides cleared"):n&&$w.info("Flag overrides set",{flags:n}),void(!1===s?$w.info("Payload overrides cleared"):s&&$w.info("Payload overrides set",{payloads:s}))}if(e&&"object"==typeof e)return this._set({[Yn]:e}),this._fireFeatureFlagsCallbacks(),void $w.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i=(this._prop(jn)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},s={$feature_flag:e,$feature_enrollment:t,$set:n};i&&(s.$early_access_feature_name=i.name),r&&(s.$feature_enrollment_stage=r);var o=g({},this.getFlagVariants(),{[e]:t});this._set({[Vn]:Object.keys(Vw(o)),[zn]:o,[Xn]:g({},this._prop(Xn)||{},n)}),this._fireFeatureFlagsCallbacks();try{var a;null==(a=this._client)||a.capture("$feature_enrollment_update",s).catch((e=>{this._logger.error("Failed to capture early access feature enrollment",e)}))}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(jn);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return v((function*(){var i=r._client;if(i){var n,s=t?"&"+t.map((e=>"stage="+e)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+s,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r._set({[jn]:n=o.json.earlyAccessFeatures})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(n)}catch(e){r._logger.error("Early access feature callback failed",e)}}}))()}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,r)=>(e[r]=t[r],e)),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((t=>{try{t(r,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(Xn)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,s={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(s[o]=n[o]));this._set({[Xn]:g({},r,s,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=g({},this._prop(Xn)||{});e.forEach((e=>{delete r[e]})),this._set({[Xn]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(Xn),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(es)||{},i=g({},r);for(var n of Object.keys(e))i[n]=g({},r[n],e[n]);this._set({[es]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(es)||{};this._set({[es]:g({},t,{[e]:{}})})}else this._remove(es)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},rk={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===Zs||this._recordingStatus===Ys?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=zs,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t;if(null==i||!i.visibilityState||"visible"===i.visibilityState)return!0;var r=null==e||null==(t=e.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=r&&r.length)||r.some((e=>"visible"===e.name))})(),this._onVisibilityChange=()=>{var e;"visible"===(null==i?void 0:i.visibilityState)&&(this._documentWasEverVisible=!0,null==(e=this._lazyLoadedSessionRecording)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw fw.error("started without valid sessionManager"),new Error(_w+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===As)throw new Error(_w+' cannot be used with cookieless_mode="always"');null!=i&&i.addEventListener&&Yr(i,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(){this._sessionRecordingDisposed=!0,null==i||null==i.removeEventListener||i.removeEventListener("visibilitychange",this._onVisibilityChange),this.stopRecording()}get _isRecordingEnabled(){var t,r=!(null==(t=this._instance.get_property(In))||!t.enabled),i=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&r&&i&&!n}startIfEnabledOrStop(e){var t;if(!(this._sessionRecordingDisposed||this._isRecordingEnabled&&null!=(t=this._lazyLoadedSessionRecording)&&t.isStarted)){var r=!ae(Object.assign)&&!ae(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),fw.info("starting")):(this._recordingStatus=zs,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==Zs&&this._recordingStatus!==Ys&&(this._recordingStatus=Ks),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=h.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return this._instance.register_for_session({[ks]:!0}),fw.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(On),null==(t=this._persistence)||t.unregister(Mn)}_validateSampleRate(e,t){if(de(e))return null;var r,i=he(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(fw.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,r,i=this._persistence,n=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),s=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:s;de(o)&&this._resetSampling();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[In]:g({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:g({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:ae(a)?null:a,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):(this._recordingStatus===Zs&&(this._recordingStatus=Ys,fw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):fw.warn("log called before recorder was ready")}get _scriptName(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(In);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(In);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return fw.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!de(e.cache_timestamp)&&Date.now()-e.cache_timestamp<=ml}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed){if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return fw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ks]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(n=h.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===Ys||this._recordingStatus===Zs)return;return this._recordingStatus=Zs,fw.info("persisted remote config is stale, requesting fresh config before starting"),void new nS(this._instance).load()}this._recordingStatus=Ks,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Pn]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Rn]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?Fn:Ln]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}}},ik={autocapture:class extends bb{constructor(e){super(new lw(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Hr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,Hr.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var r;if(e&&(null==(r=e.history[t])||!r.__posthog_wrapped__)){var i=this;Lh(e.history,t,(e=>function(r,n,s){e.call(this,r,n,s),i._capturePageview(t)}))}}_getCurrentLocation(){var t=null==e?void 0:e.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:se(e)?e:{}}_shouldCaptureHashChanges(e){return void 0===e&&(e=this._getCaptureOptions()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){var t=this._getCaptureOptions(),r=this._lastLocation;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this._shouldCaptureHashChanges(t)&&e.hash!==r.hash))}_capturePageview(e){try{var t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(Hs,{navigation_type:e}),this._lastLocation=t}catch(t){Hr.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var t=()=>{this._capturePageview("popstate")};Yr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var t=()=>{this._capturePageview("hashchange")};Yr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[bn]),this.rageclicks=new vb(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return se(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return de(this._config.capture_heatmaps)?de(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;mw.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[bn]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){yw(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==i?void 0:i.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&i&&(this._flushHandler=this._flush.bind(this),Yr(e,qs,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),Yr(i,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),Yr(i,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Db(this.instance,Ab,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Yr(i,Bs,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&i&&(this._flushHandler&&e.removeEventListener(qs,this._flushHandler),this._onClickHandler&&i.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&i.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&i.removeEventListener(Bs,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(t=this._deadClicksCapture)||t.stop(),this._initialized=!1)}_getProperties(t,r){var i=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(t,r,i){for(var n=t;n&&gi(n)&&!_i(n,"body");){if(n===i)return!1;var s=void 0;try{var o,a,l;s=null==(o=null!==(a=null==(l=n.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:e)?void 0:o.getComputedStyle(n).position}catch(e){return!1}if(Z(r,s))return!0;n=Ii(n)}return!1}(Ei(t),["fixed","sticky"],s);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:i),target_fixed:o,type:r}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!vi(e.target)&&yw(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Di(Ei(e),this.instance.config.rageclick)&&this._capture(g({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!vi(e.target)&&yw(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(e){var r=this._config.disable_capture_url_hashes?Ot(e.location.href):e.location.href,i=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...Aa,...i||[]]:[],s=ni(r,n,Da);this._buffer=this._buffer||{},this._buffer[s]||(this._buffer[s]=[]),this._buffer[s].push(t)}}_flush(){this._buffer&&!oe(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Db,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",g({$current_url:this._buffer.url},this._buffer.metrics.reduce(((e,t)=>g({},e,{["$web_vitals_"+t.name+"_event"]:g({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},de(null==e?void 0:e.name)||de(null==e?void 0:e.value))dw.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!ae(i)){var n=he(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),ae(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=i),this._buffer.firstMetricTimestamp=ae(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=g({},e,r?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete o.entries,se(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){var a={};for(var l of gw){var u="url"===l&&"string"==typeof e.attribution[l]?this._maskedURL(e.attribution[l]):e.attribution[l];ae(u)||(a[l]=u)}o.attribution=a}else delete o.attribution;ae(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else dw.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=!1,s=h.__PosthogExtensions__,o=null==s?void 0:s.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&ae(o)?null==s?void 0:s.postHogWebVitalsCallbacks:void 0);if(!ae(a)){var l=a.withoutAttribution,u=this.attributionMetrics;n=!ae(l),e=u.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,t=u.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,r=u.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,i=u.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(e&&t&&r&&i){var c={reportSoftNavs:this.useSoftNavs},d=n&&this.attributionMetrics.indexOf("INP")>-1?g({},c,{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this),d),this._initialized=!0}else dw.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Cn]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=se(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return de(r)?(null==(t=this._instance.persistence)?void 0:t.props[xn])||pw:r}get flushToCaptureTimeoutMs(){return(se(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=se(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return ve(e)?e?pw:[]:ie(e)?e:vw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=se(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){var e=se(this._perfConfig)&&he(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:hw;return e>0&&6e4>=e?hw:e}get isEnabled(){var e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return dw.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=se(this._perfConfig)?this._perfConfig.web_vitals:ve(this._perfConfig)?this._perfConfig:void 0;return ve(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(dw.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=se(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=se(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Cn]:r}),this._instance.persistence.register({[xn]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t=h.__PosthogExtensions__,r=this._callbackFlavor,i=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=i&&i[r]||"web-vitals"===r&&ae(i)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,r,(t=>{t?dw.error("failed to load script",t):e()}))}_maskedURL(t){var r=t||(null==e?void 0:e.location.href);if(r){var i=this._instance.config.disable_capture_url_hashes?Ot(r):r,n=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Aa,...n||[]]:[];return ni(i,s,Da)}dw.error("Could not determine current URL")}}},nk={exceptionObserver:class{constructor(t){var r;this._startCapturing=()=>{var t;if(e&&this.isEnabled&&null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions){var r=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=r(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){uw.error("failed to start",e),this._stopCapturing()}}},this._instance=t,this._remoteEnabled=!(null==(r=this._instance.persistence)||!r.props[Sn]),this._rateLimiter=new xe(g({},function(e){var t,r,i,n;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:uw})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return se(e)?t=g({},t,e):(ae(e)?this._remoteEnabled:e)&&(t=g({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(uw.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return uw.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Sn]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,n=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(n)?uw.info("Skipping exception capture because of client rate limiting.",{exception:n}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=X_(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(wn))&&void 0!==t?t:[],this._exceptionStepsConfig=Or(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Dr(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Or(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var n=e.config;if("errorTracking"in n){var s=null!==(t=null==(r=n.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=n.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[wn]:this._suppressionRules,[kn]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(kn),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=r?r:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!le(e)||0===e.trim().length)return void Z_.warn("Ignoring exception step because message must be a non-empty string");var r=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>Lr.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Z_.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(g({[Pr]:e,[Fr]:(new Date).toISOString()},i))}catch(e){Z_.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Z_.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Z_.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Z_.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Z_.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&de(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(s=globalThis._posthogReleaseId)&&s.length>0?s:void 0;i&&(r.$release_id=i);try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return n&&this._exceptionStepsBuffer.clear(),n}catch(e){return Z_.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void Z_.error("Failed to process exception event. Ignoring this exception.",e)}var s}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:g({},e,{$exception_steps:t})}catch(t){return Z_.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Pr]:e,[Fr]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return se(e)?g({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce(((e,t)=>{var r=t.type,i=t.value;return le(r)&&r.length>0&&e.$exception_types.push(r),le(i)&&i.length>0&&e.$exception_values.push(i),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var r=e.values.map((e=>{var r=wa[e.operator],i=t[e.key];if(!r||!i)return!1;var n=ie(e.value)?e.value:[e.value];return n.length>0&&r(n,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return Z_.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap((e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}));return t.some((e=>{var t=e.filename;return!!t&&Y_.some((e=>t.startsWith(e)))}))}_isInjectedBrowserScriptException(e){return e.some((e=>{var t=e.value;return le(t)&&J_.some((e=>t.includes(e)))}))}_isPostHogException(e){if(e.length>0){var t,r,i,n,s=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!de(e)&&ie(e)}}},sk=g({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[Tn]:!!t.productTours}),!Sw(this._instance))return!this._productTourManager&&de(null==(r=this._persistence)?void 0:r.props[as])||bw.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&Sw(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?bw.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=h.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!ie(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[as];if(ie(i)&&!t)return this._cachedTours=i,void e(i,{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(Sw(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||bw.warn(n):bw.error(n),void e([],{isLoaded:!1,error:n})}var s=ie(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[as]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){de(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(as)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},tk),ok={siteApps:class{constructor(e){this._siteAppElementPatchCount=0,this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,i,n,s,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(c)){var h=d[0];l[h]={id:u[h],type:h,properties:d[1]}}var p=e.$set_once,v=e.$set;return{event:g({},_(e,ww),{properties:g({},e.properties,v?{$set:g({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:g({},null!==(i=null==(n=e.properties)?void 0:n.$set_once)&&void 0!==i?i:{},p)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(kw.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(kw.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,n,s,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==i?void 0:i.defaultView,c=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!c)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var d=[],h=this,p=new WeakSet,v=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push((()=>{e[t]=i}))}},g=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},_=e=>e.map((e=>"string"==typeof e?e:g(e))).filter((e=>!ce(e)));return v(c,"appendChild",(e=>function(t){var r=g(t);return r?e.call(this,r):t})),v(c,"insertBefore",(e=>function(t,r){var i=g(t);return i?e.call(this,i,r):t})),v(c,"replaceChild",(e=>function(t,r){var i=g(t);return i?e.call(this,i,r):r})),[null==(t=u.Element)?void 0:t.prototype,null==(r=u.Document)?void 0:r.prototype,null==(n=u.DocumentFragment)?void 0:n.prototype].forEach((e=>{v(e,"append",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,_(r))})),v(e,"prepend",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,_(r))}))})),[null==(s=u.Element)?void 0:s.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((e=>{v(e,"before",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,_(r))})),v(e,"after",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,_(r))})),v(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var n=_(r);return r.length&&!n.length?void 0:e.apply(this,n)}))})),v(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(e=>function(t,r){var i=g(r);return i?e.call(this,t,i):null})),this._restoreSiteAppElementPatches=()=>{d.forEach((e=>e())),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(kw.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>this._runWithPreparedSiteAppElements((()=>null==t.processEvent?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,n=n=>{t.errored=!n,t.loaded=!0,kw.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var s=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1).processEvent;s&&(t.processEvent=s),i=!0}catch(t){kw.error(Cw+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){kw.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements((()=>null==i.processEvent?void 0:i.processEvent(r)))}catch(t){kw.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(e){var t,r,i,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void kw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var s=e.config;if(null!=(i=s.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;h["__$$ph_site_app_"+t]=n._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(n._instance,r,(e=>{if(e)return kw.error(Cw+t,e)}))};for(var a of s.siteApps)o()}else kw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},ak={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(ae(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ae(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return cw.error("failed to load script",t);e()}))}_getConfiguredHostnames(){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}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return ie(e)?(ie(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(ie(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},lk=g({surveys:class extends Iw{constructor(e){var t;super(new Aw(e),{get projectToken(){return t.config.token},kv:new Lw(t=e)}),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?cS(e,t.query):e;return new Promise((e=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})}))}}},tk),uk={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,r,n){if(void 0===t&&(t=void 0),void 0===r&&(r=void 0),void 0===n&&(n=void 0),Jr(this.instance.config))return!1;if(!e||!i)return!1;t=null!=t?t:e.location,n=null!=n?n:e.history;try{if(!r){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}r=null==e?void 0:e.localStorage}var s,o=Ow||si(t.hash,"__posthog")||si(t.hash,"state"),a=o?jr((()=>JSON.parse(atob(decodeURIComponent(o)))))||jr((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?t.hash=a.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((s=JSON.parse(r.getItem(Dw)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=h.ph_load_toolbar||h.ph_load_editor;!de(t)&&ne(t)?t(e,this.instance):Nw.warn("No toolbar load function found")}loadToolbar(t){var r=!(null==i||!i.getElementById(ci));if(!e||r)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(Dw,JSON.stringify(g({},s,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(s);else if(0===this._getToolbarState()){var o;this._setToolbarState(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return Nw.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(s)})),Yr(e,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(s)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},ck=g({experiments:Qw},tk),dk={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this._remoteConfigSuccessful=e.ok,e.ok)){var t=e.config.conversations;de(t)||(ve(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Jr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==h?void 0:h.__PosthogExtensions__;if(e&&!ae(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(Fs);r(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else Kw.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,Kw.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else Kw.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){Kw.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():Kw.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!ce(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Jr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":ae(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?de(this._remoteConfig)||!this._remoteConfig.token?"missing_token":null!=h&&h.__PosthogExtensions__?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,r){var i=this;return v((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(Kw.warn(Zw),null)}))()}getMessages(e,t){var r=this;return v((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(Kw.warn(Zw),null)}))()}markAsRead(e){var t=this;return v((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Kw.warn(Zw),null)}))()}getTickets(e){var t=this;return v((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Kw.warn(Zw),null)}))()}requestRestoreLink(e){var t=this;return v((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Kw.warn(Zw),null)}))()}restoreFromToken(e){var t=this;return v((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Kw.warn(Zw),null)}))()}restoreFromUrlToken(){var e=this;return v((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Kw.warn(Zw),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}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},hk={logs:class{constructor(t){var r,i=this;this.name=jv,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=$r("[logs]"),this._coreLogger=g({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(ek)||i._logger.error(...t)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect())},this._instance=t,this._instance&&null!=(r=this._instance.config.logs)&&r.captureConsoleLogs&&(this._isLogsEnabled=!0),e&&Yr(e,"online",this._onReconnect)}_buildCore(e,t,r,i){var n,s=function(e,t){var r,i,n,s,o,a,l,u=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,c=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,d=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,h=ae(d)?Math.max(c,2048):Math.max(c,d),p=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(s=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==s?s:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(n=this._instance)||null==(n=n.config)?void 0:n.logs,r);return[new Yt(this._createHost(e,t),s,this._coreLogger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore((()=>this._queue),(e=>{this._queue=e}));this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Yw);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}setup(e){if(!this._disposed){this._client=e;var t=!1,r=e.onRemoteConfig((e=>{var r;t=e.ok&&!0===(null==(r=e.config.logs)?void 0:r.captureConsoleLogs),this.onRemoteConfig(e)}));this._disposed?r.dispose():(this._remoteConfigSubscription=r,t||this.loadIfEnabled())}}dispose(){var t,r,i,n;this._disposed||(this._disposed=!0,null==(t=this._remoteConfigSubscription)||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null==(r=this._consoleLogsDispose)||r.call(this),this._consoleLogsDispose=void 0,null==(i=this._core)||i.reset(),null==(n=this._consoleCore)||n.reset())}onRemoteConfig(e){var t;if(!this._disposed&&e.ok){var r=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!de(r)&&r&&(this._isLogsEnabled=!0,this.loadIfEnabled())}}reset(){var e,t;this._queue=[],null==(e=this._core)||e.reset(),this._consoleQueue=[],null==(t=this._consoleCore)||t.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}get logger(){return this._capture_logger||(this._capture_logger={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._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch((e=>this._logFlushError(e))),this._consoleCore&&this._consoleCore.flush().catch((e=>this._logFlushError(e))))}_logFlushError(e){ek(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this._disposed&&this._isLogsEnabled&&!this._isLoaded&&!this._isLoading){var e=null==h?void 0:h.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;if(t){this._isLoading=!0;try{t(this._instance,"logs",(t=>{if(this._isLoading=!1,!this._disposed){var r,i=e.logs;t||null==i||!i.initializeLogs?this._logger.error("Could not load logs script",t):(this._consoleLogsDispose=i.initializeLogs(null!==(r=this._client)&&void 0!==r?r:this._instance),this._isLoaded=!0)}}))}catch(e){throw this._isLoading=!1,e}}else this._logger.error(Fs)}else this._logger.error("PostHog Extensions not found.")}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===C.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===C.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Br.LIB_NAME,getLibraryVersion:()=>Br.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(oi(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:Xw(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(n),t(e))},n=setTimeout((()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Xw(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Xw(e.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}}))}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=ai(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.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."))))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Br.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,Yw,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=Zt(s,Kt(r,Br.LIB_NAME,Br.LIB_VERSION),i,Br.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,de(n)||(t.sessionStartTimestamp=n),de(s)||(t.lastActivityTimestamp=s)}if(null!=h&&null!=(e=h.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ot(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},pk={metrics:class{constructor(e){this._logger=$r("[metrics]"),this._instance=e}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new tr(this._createHost(),function(e){var t,r,i,n,s,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(s=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==s?s:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch((e=>this._logger.error("PostHog metrics flush failed:",e)))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Br.LIB_NAME,getLibraryVersion:()=>Br.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((r=>{var i=!1,n=e=>{i||(i=!0,clearTimeout(s),r(e))},s=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(g({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;n({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("metrics request failed with status "+t)})}}}))}))}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},vk=g({},tk,rk,ik,nk,sk,ok,lk,ak,uk,ck,dk,hk,pk);aw.__defaultExtensionClasses=g({},vk);var gk=function(){Br.SDK_DIST_CHANNEL="npm";var t=jS[ew]=new aw;return function(){function t(){t.done||(t.done=!0,tw=!1,Wr(jS,(function(e){e._dom_loaded()})))}null!=i&&i.addEventListener?"complete"===i.readyState?t():Yr(i,"DOMContentLoaded",t,{capture:!1}):e&&Hr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{kv as Compression,Jb as DEFAULT_PRODUCT_TOUR_APPEARANCE,Av as DisplaySurveyType,aw as PostHog,Xb as ProductTourEventName,eS as ProductTourEventProperties,Fv as SurveyEventName,Lv as SurveyEventProperties,Cv as SurveyEventType,Tv as SurveyPosition,Rv as SurveyQuestionBranchingType,Mv as SurveyQuestionType,Pv as SurveySchedule,xv as SurveyTabPosition,Iv as SurveyType,Ev as SurveyWidgetType,gk as default,gk as posthog,sS as severityLevels};
|
|
1
|
+
var e="undefined"!=typeof window?window:void 0,t="undefined"!=typeof globalThis?globalThis:e,r=null==t?void 0:t.navigator,i=null==t?void 0:t.document,n=null==t?void 0:t.location,s=null==t?void 0:t.fetch,o=null!=t&&t.XMLHttpRequest&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,u=null==r?void 0:r.userAgent;function c(){return!(!e||!1===e.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var h=null!=e?e:{};function p(e,t,r,i,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,n)}function _(e){return function(){var t=this,r=arguments;return new Promise((function(i,n){var s=e.apply(t,r);function o(e){p(s,i,n,o,a,"next",e)}function a(e){p(s,i,n,o,a,"throw",e)}o(void 0)}))}}function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},v.apply(null,arguments)}function g(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}var f={DomContentLoaded:0,Load:1,FullSnapshot:2,IncrementalSnapshot:3,Meta:4,Custom:5,Plugin:6},m={Mutation:0,MouseMove:1,MouseInteraction:2,Scroll:3,ViewportResize:4,Input:5,TouchMove:6,MediaInteraction:7,StyleSheetRule:8,CanvasMutation:9,Font:10,Log:11,Drag:12,StyleDeclaration:13,Selection:14,AdoptedStyleSheet:15,CustomElement:16},y=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function b(e){return"string"==typeof e||e}function S(e){return"string"==typeof e?e:void 0}var w=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],k=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),C=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),E="min_length",T="max_length",x=["$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"],I=["token"],M=20,R=1e3,P=1e4,F="[Circular]",L="[Truncated]",A="[Unserializable]",O="[Function]";function D(e){for(var t="",r=0;e.length>r;r++){var i=e.charCodeAt(r);if(55296>i||i>56319)t+=56320>i||i>57343?e[r]:"�";else{var n=e.charCodeAt(r+1);56320>n||n>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}var N=["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"],B=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return N.concat(t).some((e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)}))};function q(e,t){return-1!==e.indexOf(t)}var H=function(e){return e.trim()},U=function(e){return e.replace(/^\$/,"")};function W(e){var t,r=[];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(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}})))&&void 0!==t?t:"null"}var z=Object.prototype,V=z.hasOwnProperty,j=z.toString,G=Array.isArray||function(e){return"[object Array]"===j.call(e)},Q=e=>"function"==typeof e,K=e=>e===Object(e)&&!G(e),Z=e=>{if(K(e)){for(var t in e)if(V.call(e,t))return!1;return!0}return!1},Y=e=>void 0===e,J=e=>"[object String]"==j.call(e),X=e=>J(e)&&0===e.trim().length,ee=e=>null===e,te=e=>Y(e)||ee(e),re=e=>"[object Number]"==j.call(e)&&e==e,ie=e=>re(e)&&e>0,ne=e=>"[object Boolean]"===j.call(e),se=e=>e instanceof FormData,oe=e=>q(x,e),ae=e=>q(I,e);function le(e){return null===e||"object"!=typeof e}function ue(e,t){return{}.toString.call(e)==="[object "+t+"]"}function ce(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return he(e,Error)}}function de(e){return"undefined"!=typeof Event&&he(e,Event)}function he(e,t){try{return e instanceof t}catch(e){return!1}}var pe=[!0,"true",1,"1","yes"],_e=e=>q(pe,e),ve=[!1,"false",0,"0","no"];function ge(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),re(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),ge(n||r,t,r,i))}class fe{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ge(e.bucketSize,0,100,e._logger),this._refillRate=ge(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ge(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),n=this._buckets[i];return n?this._applyRefill(n,r):this._buckets[i]=n={tokens:this._bucketSize,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}}var me="Mobile",ye="iOS",be="Android",Se="Tablet",we=be+" "+Se,ke="iPad",Ce="Apple",Ee=Ce+" Watch",Te="Safari",xe="BlackBerry",Ie="Samsung",Me=Ie+"Browser",Re=Ie+" Internet",Pe="Chrome",Fe=Pe+" OS",Le=Pe+" "+ye,Ae="Internet Explorer",Oe=Ae+" "+me,De="Opera",Ne=De+" Mini",Be="Edge",qe="Microsoft "+Be,He="Firefox",$e=He+" "+ye,Ue="Nintendo",We="PlayStation",ze="Xbox",Ve=be+" "+me,je=me+" "+Te,Ge="Windows",Qe=Ge+" Phone",Ke="Nokia",Ze="Ouya",Ye="Generic",Je=Ye+" "+me.toLowerCase(),Xe=Ye+" "+Se.toLowerCase(),et="Konqueror",tt="Oculus Browser",rt="Vivaldi",it="Yandex",nt="Whale",st="DuckDuckGo",ot="Pale Moon",at="Waterfox",lt="Brave",ut="Google Search App",ct="(\\d+(\\.\\d+)?)",dt=new RegExp("Version/"+ct),ht=new RegExp(ze,"i"),pt=new RegExp(We+" \\w+","i"),_t=new RegExp(Ue+" \\w+","i"),vt=new RegExp(xe+"|PlayBook|BB10","i"),gt={"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"},ft=function(e,t,r,i){t=t||"";var n=function(e){return null!=e&&e.brave?lt:null}(r);return n||(null!=i&&i.detectGoogleSearchApp&&q(e,"GSA/")?ut:q(e," OPR/")&&q(e,"Mini")?Ne:q(e," OPR/")?De:vt.test(e)?xe:q(e,"IE"+me)||q(e,"WPDesktop")?Oe:q(e,"OculusBrowser")?tt:q(e,Me)?Re:q(e,Be)||q(e,"Edg/")?qe:q(e,rt+"/")?rt:q(e,"YaBrowser/")?it:q(e,nt+"/")?nt:q(e,st+"/")||q(e,"Ddg/")?st:q(e,"FBIOS")?"Facebook "+me:q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?Le:q(e,"CrMo")||q(e,Pe)?Pe:q(e,be)&&q(e,Te)?Ve:q(e,"FxiOS")?$e:q(e.toLowerCase(),et.toLowerCase())?et:q(e,lt+"/")?lt:((e,t)=>t&&q(t,Ce)||function(e){return q(e,Te)&&!q(e,Pe)&&!q(e,be)}(e))(e,t)?q(e,me)?je:Te:q(e,"PaleMoon/")?ot:q(e,at+"/")?at:q(e,He)?He:q(e,"MSIE")||q(e,"Trident/")?Ae:q(e,"Gecko")?He:"")},mt={[Oe]:[new RegExp("rv:"+ct)],[qe]:[new RegExp(Be+"?\\/"+ct)],[Pe]:[new RegExp("("+Pe+"|CrMo)\\/"+ct)],[Le]:[new RegExp("CriOS\\/"+ct)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ct)],[Te]:[dt],[je]:[dt],[De]:[new RegExp("(Opera|OPR)\\/"+ct)],[He]:[new RegExp(He+"\\/"+ct)],[$e]:[new RegExp("FxiOS\\/"+ct)],[et]:[new RegExp("Konqueror[:/]?"+ct,"i")],[xe]:[new RegExp(xe+" "+ct),dt],[Ve]:[new RegExp("android\\s"+ct,"i")],[Re]:[new RegExp(Me+"\\/"+ct)],[tt]:[new RegExp("OculusBrowser\\/"+ct)],[rt]:[new RegExp(rt+"\\/"+ct)],[it]:[new RegExp("YaBrowser\\/"+ct)],[nt]:[new RegExp(nt+"\\/"+ct)],[lt]:[new RegExp(lt+"\\/"+ct)],[st]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ct)],[ot]:[new RegExp("PaleMoon\\/"+ct)],[at]:[new RegExp(at+"\\/"+ct)],[ut]:[new RegExp("GSA\\/"+ct)],[Ae]:[new RegExp("(rv:|MSIE )"+ct)],Mozilla:[new RegExp("rv:"+ct)]},yt=function(e,t,r,i){var n=ft(e,t,r,i),s=mt[n];if(Y(s))return null;for(var o=0;s.length>o;o++){var a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},bt=[[new RegExp(ze+"; "+ze+" (.*?)[);]","i"),e=>[ze,e&&e[1]||""]],[new RegExp(Ue,"i"),[Ue,""]],[new RegExp(We,"i"),[We,""]],[vt,[xe,""]],[new RegExp(Ge,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Qe,""];if(new RegExp(me).test(t)&&!/IEMobile\b/.test(t))return[Ge+" "+me,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=gt[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[Ge,i]}return[Ge,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[ye,[e[3],e[4],e[5]||"0"].join(".")]:[ye,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Y(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+be+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+be+")","i"),e=>e&&e[2]?[be,[e[2],e[3],e[4]||"0"].join(".")]:[be,""]],[/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/,[Fe,""]],[/Linux|debian/i,["Linux",""]]],St=function(e){return _t.test(e)?Ue:pt.test(e)?We:ht.test(e)?ze:new RegExp(Ze,"i").test(e)?Ze:new RegExp("("+Qe+"|WPDesktop)","i").test(e)?Qe:/iPad/.test(e)?ke:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ee:vt.test(e)?xe:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Ke,"i").test(e)?Ke:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(me).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)?be:we:new RegExp("(pda|"+me+")","i").test(e)?Je:new RegExp(Se,"i").test(e)&&!new RegExp(Se+" pc","i").test(e)?Xe:""},wt=function(e,t){var r,i,n,s,o=St(e);return o===ke||o===we||"Kobo"===o||"Kindle Fire"===o||o===Xe?Se:o===Ue||o===ze||o===We||o===Ze?"Console":o===Ee?"Wearable":o?me:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(n=null==t?void 0:t.screenHeight)&&void 0!==n?n:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?me:Se:"Desktop"},kt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ct(e,t){return"string"==typeof(r=e)&&kt.test(r)?e:t();var r}function Et(e,t){var r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return r}function Tt(e){return e?e.split("#")[0]:e}function xt(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function It(e,t,r){return Mt.apply(this,arguments)}function Mt(){return(Mt=_((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,n)=>{i=xt((()=>{try{null==r||r(),e()}catch(e){n(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var Rt,Pt="NativeGzipValidationError",Ft=e=>e.length>=2&&31===e[0]&&139===e[1],Lt=(e,t)=>e===C.GZipJS||t===C.GZipJS||"gzip"===t,At=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Ot=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return At(e)||t===Pt},Dt=e=>{throw Et(Pt,"Native gzip produced invalid output: "+e)},Nt=function(){var e=_((function*(e,t){18>e.size&&Dt("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ft(r)&&8===r[2]||Dt("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Rt)return Rt;Rt=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Rt[e]=t>>>0}return Rt})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&Dt("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&Dt("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function Bt(e,t,r){return qt.apply(this,arguments)}function qt(){return qt=_((function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),s=n.writable.getWriter(),o=s.write(i).then((()=>s.close())).catch(function(){var e=_((function*(e){try{yield s.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),a=new Response(n.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield Nt(l,i),l}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})),qt.apply(this,arguments)}var Ht={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},$t=Ht.info,Ut=0x8000000000000000,Wt={}.propertyIsEnumerable;function zt(e,t){try{return Gt(e,t,{ancestors:new WeakSet,remainingNodes:P},0)}catch(e){return[]}}function Vt(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:L};if(r.remainingNodes--,ne(e))return{boolValue:e};if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if("undefined"==typeof BigInt)return{stringValue:String(e)};var n=BigInt(e).toString();return e>=Ut||-Ut>e?(null==t||t.debug("Attribute "+n+" is outside the int64 range; encoding it as a string"),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:D(e)};if("function"==typeof e)return{stringValue:O};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(r.ancestors.has(e))return{stringValue:F};if(i>=M)return{stringValue:L};if(e instanceof Date){var s=e.getTime(),o=Number.isFinite(s)?e.toISOString():String(e);return{stringValue:"string"==typeof o?D(o):String(o)}}r.ancestors.add(e);try{try{var a=e.toJSON;if("function"==typeof a)return Vt(a.call(e),t,r,i+1)}catch(e){}return G(e)?{arrayValue:{values:jt(e,t,r,i+1)}}:{kvlistValue:{values:Gt(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:D(String(e))}}function jt(e,t,r,i){for(var n=[],s=Math.min(e.length,R),o=0;s>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(te(a))continue;n.push(Vt(a,t,r,i))}catch(e){n.push({stringValue:A})}return e.length>o&&n.push({stringValue:L}),n}function Gt(e,t,r,i){var n=[];for(var s in e)if(Wt.call(e,s)){if(n.length>=R||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[s];if(ee(o)||Y(o))continue;n.push({key:D(s),value:Vt(o,t,r,i)})}catch(e){n.push({key:D(s),value:{stringValue:A}})}}return n}function Qt(e){try{return D(String(e))}catch(e){return A}}function Kt(e,t,r,i){var n,s=Ht[e.level||"info"]||$t,o=s.text,a=s.number,l=(void 0===(n=re(i)?i:void 0)&&(n=Date.now()),String(n)+"000000"),u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),te(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),te(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var c=v({},u),d=e.attributes;if(d){var h=[];try{h=Object.keys(d)}catch(e){h=[]}for(var p of h){var _=void 0;try{_=d[p]}catch(e){_=A}Object.defineProperty(c,p,{value:_,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:o,body:{stringValue:Qt(e.body)},attributes:zt(c,r)};return e.trace_id&&(g.traceId=e.trace_id),e.span_id&&(g.spanId=e.span_id),Y(e.trace_flags)||(g.flags=e.trace_flags),g}function Zt(e,t,r){return v({},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":r})}function Yt(e,t,r,i){return{resourceLogs:[{resource:{attributes:zt(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let Jt=class{constructor(e,t,r,i,n,s,o){var a;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=n,this._waitForStoragePersist=s,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(k.LogsQueue,[])}reset(){this._clearFlushTimer(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e,t){var r;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var i=this._runBeforeSend(e);if(null!==i)if(i.body){if(this._checkRateLimit()){var n={record:Kt(i,null!==(r=null==t?void 0:t.context)&&void 0!==r?r:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady((()=>this._enqueue(n)))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=G(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Log was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return _((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return _((function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(k.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,n=0;r.length>0&&i>n;){var s,o,a=e._queueGeneration;e._evictedSinceAdvance=0;var l=Math.min(r.length,e._maxBatchRecordsPerPost),u=r.slice(0,l),c=u.map((e=>e.record)),d=Yt(c,e._buildResourceAttributes(),null!==(s=e._scopeName)&&void 0!==s?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance._sendLogsBatch(d);if(e._queueGeneration!==a)return;if("too-large"===h.kind&&u.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(u.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?e._logger.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"===h.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(u.length),r=null!==(o=e._instance.getPersistedProperty(k.LogsQueue))&&void 0!==o?o:[],n+=u.length,"fatal"===h.kind)throw h.error}}}))()}_persistQueueAdvance(e){var t=this;return _((function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),n=null!==(r=t._instance.getPersistedProperty(k.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(k.LogsQueue,n.slice(i)),yield t._waitForStoragePersist()}))()}_buildResourceAttributes(){return Zt(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(k.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(k.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=xt((()=>{this._flushTimer=void 0,this._flushInBackground()}),e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(k.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return _((function*(){t._clearFlushTimer();var r=t.flush().catch((()=>{}));void 0!==e?yield It(r,e):yield r}))()}flushWithTimeout(e){var t=this;return _((function*(){var r=t.flush();yield It(r,e,(()=>{r.catch((()=>{}))}))}))()}_flushInBackground(){this.flush().then((()=>{this._consecutiveFlushFailures=0}),(e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())}))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}};var Xt=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function er(e){return String(e)+"000000"}function tr(e,t,r,i){var n="";return i&&(n=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+n}let rr=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,t=this._flushPromise,r=function(){var r=_((function*(){t&&(yield t.catch((()=>{}))),yield e._doFlush()}));return function(){return r.apply(this,arguments)}}(),i=r().finally((()=>{this._flushPromise===i&&(this._flushPromise=null)}));return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(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._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=t.attributes?v({},t.attributes):void 0,i=tr(t.type,t.name,t.unit,r)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var n=this._series.get(i);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,n)}var s=this._typeByName.get(t.name);void 0===s?this._typeByName.set(t.name,t.type):s===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+s+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(n,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Xt.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,Xt)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=G(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this._logger.info("Metric was rejected in beforeSend function"),null;i=s}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=xt((()=>{this._flushTimer=void 0,this.flush().catch((e=>{this._logger.error("Metrics flush failed:",e)}))}),this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return _((function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}}))()}_buildPayload(e){return t=this._buildMetrics(e),r=function(e,t,r){return v({},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":r})}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:zt(r)},scopeMetrics:[{scope:{name:i,version:n},metrics:t}]}]};var t,r,i,n}_buildMetrics(e){var t=er(Date.now()),r=new Map;for(var i of e.values()){var n,s=tr(i.type,i.name,i.unit,void 0),o=r.get(s);o||(o=v({name:i.name},i.unit&&{unit:i.unit}),"count"===i.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===i.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=zt(null!==(n=i.attributes)&&void 0!==n?n:{},this._logger),l=er(i.windowStartMs);if("count"===i.type){var u,c={attributes:a,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!==(u=i.total)&&void 0!==u?u:0};o.sum.dataPoints.push(c)}else if("gauge"===i.type){var d,h={attributes:a,timeUnixNano:t,asDouble:null!==(d=i.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(h)}else i.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Xt})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var n=i[0],s=i[1],o=this._series.get(n);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,s.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=s.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(s.hist)if(o.hist){o.hist.count+=s.hist.count,o.hist.sum+=s.hist.sum,o.hist.min=Math.min(o.hist.min,s.hist.min),o.hist.max=Math.max(o.hist.max,s.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=s.hist.bucketCounts[a]}else o.hist=s.hist}else this._admitNewSeries()&&this._series.set(n,s)}}};function ir(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var nr,sr,or;function ar(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return or&&r.length===sr||(sr=r.length,or=r.reduce(((r,i)=>{nr||(nr={});var n=nr[i];if(n)r[n[0]]=n[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,nr[i]=[l,u];break}}return r}),{})),or}}class lr{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),s=this.parseStacktrace(i,n);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var t=this;return _((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&G(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.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 r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),v({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return _((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,n,s={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(i=t.handled)||void 0===i||i,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,v({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:ar(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var n=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,n)}};return v({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}var ur="?";function cr(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?ur:r,in_app:!(null!=t&&t.startsWith("webkit-masked-url://"))&&"<anonymous>"!==t};return Y(i)||(s.lineno=i),Y(n)||(s.colno=n),s}var dr=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:ur,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},hr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,pr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_r=/\((\S*)(?::(\d+))(?::(\d+))\)/,vr=(e,t)=>{var r=hr.exec(e);if(r)return cr(t,r[1],ur,+r[2],+r[3]);var i=pr.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var n=_r.exec(i[2]);n&&(i[2]=n[1],i[3]=n[2],i[4]=n[3])}var s=dr(i[1]||ur,i[2]);return cr(t,s[1],s[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},gr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mr=(e,t)=>{var r=gr.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=fr.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||ur,o=dr(s,n);return cr(t,n=o[1],s=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},yr=/\(error: (.*)\)/,br=50;class Sr{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=J(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ue(e,"DOMException")}isDOMError(e){return ue(e,"DOMError")}}class wr{match(e){return ce(e)}coerce(e,t){var r,i=this.getStack(e),n=void 0===i;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=i?i:null==(r=t.syntheticException)?void 0:r.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class kr{constructor(){}match(e){return!!ue(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var r;if(null!=e.error)return t.apply(e.error);var i=t.apply(e.message);return v({},i,{stack:null!==(r=this._buildLocationStack(e))&&void 0!==r?r:i.stack,synthetic:!0})}_hasUsableMessage(e){return J(e.message)&&e.message.length>0}_buildLocationStack(e){var t,r,i=e,n=null!==(t=i.lineno)&&void 0!==t?t:0,s=null!==(r=i.colno)&&void 0!==r?r:0;if(J(i.filename)&&0!==i.filename.length&&0!==n)return"Error\n at "+i.filename+":"+n+":"+s}}var Cr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Er{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),n=i[0],s=i[1];return{type:null!=n?n:"Error",value:null!=s?s:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Cr);return i&&(t=i[1],r=i[2]),[t,r]}}var Tr=["fatal","error","warning","log","info","debug"];function xr(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");if(t>=n.length)return i===r.length?n:n.length>t?n.slice(0,t)+"...":n}return""}class Ir{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(r=this.getStack(e))&&void 0!==r?r:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(de(e))return e.constructor.name;var t="name"in e?e.name:void 0;return J(t)&&!X(t)?t:"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 r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+xr(e)}isSeverityLevel(e){return J(e)&&!X(e)&&Tr.indexOf(e)>=0}getStack(e){try{return J(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:J(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(ce(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class Mr{match(e){return de(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+xr(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Rr{match(e){return le(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Pr{match(e){return ue(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!de(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return le(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}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(e){}return e}}var Fr="$message",Lr="$timestamp",Ar=new Set([Fr,Lr]),Or={enabled:!0,max_bytes:32768};function Dr(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Or.enabled,max_bytes:Br(e.max_bytes,Or.max_bytes)}:v({},Or)}class Nr{constructor(e){this._entries=[],this._totalBytes=0,this._config=Dr(e)}setConfig(e){this._config=Dr(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=W(e)}catch(e){return}try{var r=JSON.parse(t);if(!K(r))return;var i=r,n=i[Fr],s=i[Lr];if(!J(n)||0===n.trim().length)return;if(!J(s)&&!re(s))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map((e=>e.step))}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}}function Br(e,t){if(!re(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var qr={DEBUG:!1,LIB_VERSION:"0.6.0",LIB_NAME:"browser-common"},Hr=function(t,r){var i=(void 0===r?{}:r).debugEnabled,n={_log(r){if(e&&(qr.DEBUG||e.POSTHOG_DEBUG||i)&&!Y(e.console)&&e.console){for(var n=("__rrweb_original__"in e.console[r]?e.console[r].__rrweb_original__:e.console[r]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];n(t,...o)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];n._log("error",...t)},critical(){for(var e=arguments.length,r=new Array(e),i=0;e>i;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning(e){n.error("You must initialize PostHog before calling "+e)},createLogger:(e,r)=>Hr(t+" "+e,r)};return n},$r=Hr("[PostHog.js]"),Ur=$r.createLogger;function Wr(e,t){G(e)&&e.forEach(t)}function zr(e,t){if(!te(e))if(G(e))e.forEach(t);else if(se(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)V.call(e,r)&&t(e[r],r)}var Vr=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)void 0!==n[s]&&(e[s]=n[s]);return e};function jr(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var Gr=function(e){try{return e()}catch(e){return}},Qr=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){$r.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$r.critical(e)}}},Kr=function(e){var t={};return zr(e,(function(e,r){(J(e)&&e.length>0||re(e))&&(t[r]=e)})),t};var Zr=["herokuapp.com","vercel.app","netlify.app"];function Yr(e){var t=null==e?void 0:e.hostname;if(!J(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Zr)if(r===i)return!1;return!0}function Jr(e,t,r,i){var n=null!=i?i:{},s=n.capture,o=n.passive;null==e||e.addEventListener(t,r,{capture:void 0!==s&&s,passive:void 0===o||o})}function Xr(e){return"ph_toolbar_internal"===e.name}var ei=["localhost","127.0.0.1"],ti=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return W(e)}},ri=e=>{var t=null==i?void 0:i.createElement("a");return Y(t)?null:(t.href=e,t)},ii=function(e,t){var r,i;void 0===t&&(t="&");var n=[];return zr(e,(function(e,t){Y(e)||Y(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),n[n.length]=i+"="+r)})),n.join(t)},ni=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===t){r=s;break}}if(!G(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){$r.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},si=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");G(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},oi=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},ai=(e,t)=>e>=t&&c(),li=(e,t,r,i)=>{if(0===e){if(c()){var n=t+1;return n===r&&i(),n}return t}return 0};function ui(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Q(i))return t;try{var n=i(t);return J(n)&&n?n:t}catch(e){return $r.error("Error in get_current_url, falling back to window.location.href",e),t}}function ci(t){var r,i=null==e||null==(r=e.location)?void 0:r.href;return Y(i)?void 0:ui(t,i)}var di="__POSTHOG_TOOLBAR__",hi=1,pi=3,_i=11;function vi(e){return e instanceof Element&&(e.id===di||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function gi(e){return!!e&&e.nodeType===hi}function fi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function mi(e){return!!e&&e.nodeType===pi}function yi(e){return!!e&&e.nodeType===_i&&gi(e.host)}var bi=1e3;function Si(e){return e?H(e).split(/\s+/):[]}function wi(e,t){var r=ci(t);return!!(r&&e&&e.some((e=>r.match(e))))}function ki(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 Si(t)}function Ci(e){return te(e)?null:H(e).split(/(\s+)/).filter((e=>Ki(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ei(e){var t="";return Hi(e)&&!$i(e)&&e.childNodes&&e.childNodes.length&&zr(e.childNodes,(function(e){var r;mi(e)&&e.textContent&&(t+=null!==(r=Ci(e.textContent))&&void 0!==r?r:"")})),H(t)}function Ti(e){var t;return Y(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var xi=["a","button","form","input","select","textarea","label"];function Ii(e,t){if(Y(t))return!0;var r,i=function(e){if(t.some((t=>function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}(e,t))))return{v:!0}};for(var n of e)if(r=i(n))return r.v;return!1}function Mi(e){var t=e.parentNode;return!(!t||!gi(t))&&t}var Ri=[".ph-no-autocapture","[data-ph-no-autocapture]"],Pi=["next","previous","prev",">","<"],Fi=[...Pi,"+","-","−","–"],Li=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Ai=[".ph-no-deadclick",".ph-no-capture"],Oi=[".ph-no-rageclick",".ph-no-capture"],Di=["","text","search","email","password","url","tel","number"];function Ni(t,r){if(!e||Bi(t))return!1;var i,n,s,o,a;if(ne(r)?(i=!!r&&Oi,n=void 0,s=!1):(i=null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:Oi,n=null==r?void 0:r.content_ignorelist,s=null!==(a=null==r?void 0:r.ignore_text_selection)&&void 0!==a&&a),!1===i)return!1;if(s&&function(e){return!(!e||!gi(e))&&(!!fi(e,"textarea")||(fi(e,"input")?q(Di,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(t))return!1;var l=qi(t,!1).targetElementList;return!function(e,t){if(!1===e||Y(e))return!1;var r;if(!0===e)r=Pi;else{if(!G(e))return!1;if(e.length>10)return $r.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map((e=>e.toLowerCase()))}return t.some((e=>{var t=e.safeText,i=e.ariaLabel;return r.some((e=>Li(t,e)||Li(i,e)))}))}(n,l.map((e=>{var t;return{safeText:Ei(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Ii(l,i)}var Bi=e=>!e||fi(e,"html")||!gi(e),qi=(t,r)=>{if(!e||Bi(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,n=[t],s=t;s.parentNode&&!fi(s,"body");)if(yi(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var o=Mi(s);if(!o)break;if(r||xi.indexOf(o.tagName.toLowerCase())>-1)i=!0;else try{var a=e.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}catch(e){}n.push(o),s=o}return{parentIsUsefulElement:i,targetElementList:n}};function Hi(e){for(var t=new Set,r=0,i=e;i.parentNode&&!fi(i,"body");i=i.parentNode){if(r++>=bi||t.has(i))return!1;t.add(i);var n=ki(i);if(q(n,"ph-sensitive")||q(n,"ph-no-capture"))return!1}if(q(ki(e),"ph-include"))return!0;var s=e.type||"";if(J(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!J(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 $i(e){return!!(fi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fi(e,"select")||fi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Ui=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Wi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zi=[16,15,14,13],Vi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),ji=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Gi=/[0-9A-Za-z_]/;function Qi(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var n=e.charCodeAt(i)-48;r&&(n*=2)>9&&(n-=9),t+=n,r=!r}return t%10==0}function Ki(e,t){if(void 0===t&&(t=!0),te(e))return!1;if(J(e)){e=H(e);var r=t?Ui.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Wi.lastIndex=0;t=Wi.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),n=0;i.length>n;n++)for(var s of zi){var o=n+s;if(i.length>=o){var a=i.slice(n,o);if(Ui.test(a)&&Qi(a))return!0}}}return!1}(e);if(r)return!1;var i=t?Vi.test(e):function(e){var t;for(ji.lastIndex=0;t=ji.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&Gi.test(r)&&Gi.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function Zi(e){var t=Ei(e);return Ki(t=(t+" "+Yi(e)).trim())?t:""}function Yi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&zr(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=Ei(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Yi(e)).trim())}catch(e){$r.error("[AutoCapture]",e)}})),t}function Ji(e){return e.replace(/"|\\"/g,'\\"')}function Xi(e){var t=e.attr__class;if(t)return G(t)?t:Si(t)}var en="[SessionRecording]",tn="redacted",rn=1e6;function nn(e){var t;return Math.min(rn,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:rn)}var sn={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:rn,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},on=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],an=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ln=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],un=e=>{te(e)||zr(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return on.includes(t)||ln.some((e=>t.includes(e)))})(t)&&(e[t]=tn)}))},cn=["/s/","/e/","/i/"];function dn(e,t,r,i){if(te(e))return e;var n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return J(n)&&(n=parseInt(n)),n>r?en+" "+i+" body too large to record ("+n+" bytes)":e}function hn(e,t){if(te(e))return e;var r=e;return Ki(r,!1)||(r=en+" "+t+" body "+tn),zr(an,(e=>{var i,n;null!=(i=r)&&i.length&&-1!==(null==(n=r)?void 0:n.indexOf(e))&&(r=en+" "+t+" body "+tn+" as might contain: "+e)})),r}var pn=new WeakSet,_n="$people_distinct_id",vn="distinct_id",gn="$device_id",fn="$device_model",mn="__alias",yn="__timers",bn="$autocapture_disabled_server_side",Sn="$heatmaps_enabled_server_side",wn="$exception_capture_enabled_server_side",kn="$error_tracking_suppression_rules",Cn="$error_tracking_capture_extension_exceptions",En="$web_vitals_enabled_server_side",Tn="$dead_clicks_enabled_server_side",xn="$product_tours_enabled_server_side",In="$logs_capture_enabled_server_side",Mn="$web_vitals_allowed_metrics",Rn="$session_recording_remote_config",Pn="$replay_sample_rate",Fn="$replay_override_sampling",Ln="$replay_override_linked_flag",An="$replay_override_url_trigger",On="$replay_override_event_trigger",Dn="$sesid",Nn="$session_is_sampled",Bn="$session_past_minimum_duration",qn="$session_recording_url_trigger_activated_session",Hn="$session_recording_event_trigger_activated_session",$n="$posthog_sr_group_event_trigger_",Un="$posthog_sr_group_url_trigger_",Wn="$posthog_sr_group_sampling_",zn="$debug_first_full_snapshot_timestamp",Vn="$sess_rec_flush_size",jn="$enabled_feature_flags",Gn="$active_feature_flags",Qn="$early_access_features",Kn="$feature_flag_details",Zn="$feature_flag_payloads",Yn="$feature_flag_request_id",Jn="$minimal_flag_called_events",Xn="$override_feature_flags",es="$override_feature_flag_payloads",ts="$stored_person_properties",rs="$stored_group_properties",is="$groups",ns="$surveys",ss="$surveys_loaded_at",os="$surveys_activated",as="$surveys_activated_session",ls="$surveys_activated_timestamps",us="ph_product_tours",cs="$flag_call_reported",ds="$flag_call_reported_session_id",hs="$feature_flag_errors",ps="$feature_flag_evaluated_at",_s="$user_state",vs="$client_session_props",gs="$capture_rate_limit",fs="$initial_campaign_params",ms="$initial_referrer_info",ys="$initial_person_info",bs="$epp",Ss="$posthog_cookieless",ws="$cookieless_mode",ks="$sdk_debug_extensions_init_method",Cs="$sdk_debug_extensions_init_time_ms",Es="$sdk_debug_recording_script_not_loaded",Ts="$sdk_debug_replay_event_trigger_status",xs="$sdk_debug_replay_linked_flag_trigger_status",Is="$sdk_debug_replay_matched_recording_trigger_groups",Ms="$sdk_debug_replay_pending_trigger_conditions",Rs="$sdk_debug_replay_remote_trigger_matching_config",Ps="$sdk_debug_replay_trigger_groups_count",Fs="$sdk_debug_replay_url_trigger_status",Ls="$session_recording_start_reason",As="PostHog loadExternalDependency extension not found.",Os="on_reject",Ds="always",Ns="anonymous",Bs="identified",qs="identified_only",Hs="visibilitychange",$s="beforeunload",Us="$pageview",Ws="$pageleave",zs="$identify",Vs="$groupidentify",js="disabled",Gs="sampled",Qs="active",Ks="buffering",Zs="paused",Ys="lazy_loading",Js="awaiting_config",Xs="missing_config",eo="rrweb_error",to="trigger",ro=to+"_activated",io=to+"_pending",no=to+"_"+js;function so(e,t,r,i,n,s){return 0===t?no:(null==e?void 0:e.get_property(r?i+r:n))===s?ro:io}function oo(e,t,r){return t.some((t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)}))}function ao(e){return e.includes(ro)?ro:e.includes(io)?io:no}function lo(e){var t=new Set(e);switch(t.delete(no),t.size){case 0:return no;case 1:return Array.from(t)[0];default:return io}}class uo{constructor(e){this._matchers=e}triggerStatus(e){return ao(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return ao(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class co{constructor(e){this._matchers=e}triggerStatus(e){return lo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return lo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class ho{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ro}stop(){}}var po=e=>"sessionRecording"in e;class _o{constructor(e,t){this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._instance=e,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(po(e)?K(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(po(e)?K(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){$r.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){$r.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return so(this._instance,this._urlTriggers.length,this._groupId,Un,qn,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Fs]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=ci(this._instance);if(!e)return!1;try{return oo(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=ci(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,n=oo(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&n||(n&&!i?e():!n&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var n=ci(this._instance);if(n&&n!==this._lastCheckedUrl){this._lastCheckedUrl=n;var s=this.urlBlocked,o=oo(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!s?e():!o&&s&&t();var a=this._urlTriggerStatus(i)===ro,l=oo(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",n)}}stop(){this._lastCheckedUrl=""}}class vo{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[xs]:e}),e}triggerStatusNoSideEffects(){var e=io;return te(this.linkedFlag)&&(e=no),this.linkedFlagSeen&&(e=ro),e}onConfig(e,t){var r;if(this.linkedFlag=(po(e)?K(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!te(this.linkedFlag)&&!this.linkedFlagSeen){var i=J(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,n=J(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var s=!1;if(K(r)&&i in r){var o=r[i];s=ne(o)?!0===o:n?o===n:!!o}var a=s&&!this.linkedFlagSeen;this.linkedFlagSeen=s,a&&t(i,n)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class go{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(po(e)?K(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return so(this._instance,this._eventTriggers.length,this._groupId,$n,Hn,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ts]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===ro,n=this._eventTriggers.includes(e);!i&&n&&t("event",e)}}stop(){}}class fo{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new _o(e,t.id),this._eventTriggerMatching=new go(e,t.id),this._linkedFlagMatching=new vo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map((e=>e.name)),n={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(n),this._eventTriggerMatching.onConfig(n),this._linkedFlagMatching.onConfig(n,r);var s=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new uo(s):new co(s)}else this._combinedMatching=new ho}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return this.triggerStatusNoSideEffects(e)!==io?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter((e=>e.status===io)).map((e=>e.label))}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r;null==(r=this._instance.persistence)||r.register({["url"===e?Un+this.group.id:$n+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function mo(e){if(e.rrwebError)return eo;if(!e.receivedFlags)return Ks;if(!e.isRecordingEnabled)return js;if(e.urlTriggerMatching.urlBlocked)return Zs;var t=!0===e.isSampled,r=new uo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?Gs:r===ro?Qs:r===io?Ks:!1===e.isSampled?js:Qs}function yo(e){if(e.rrwebError)return eo;if(!e.receivedFlags)return Ks;if(!e.isRecordingEnabled)return js;if(e.urlTriggerMatching.urlBlocked)return Zs;var t=new co([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==no,i=ne(e.isSampled);return r&&t===io?Ks:r&&t===no||i&&!e.isSampled?js:!0===e.isSampled?Gs:Qs}function bo(){var e=[];return function(t,r){if(K(r)||G(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function So(e){var t=JSON.stringify(e,bo());return t?new Blob([t]).size:0}function wo(e){if(ee(e))return 4;if(Y(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(G(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=Y(i)||ee(i)?4:wo(i)}return t}var n=e,s=2,o=!0;for(var a in n)if({}.hasOwnProperty.call(n,a)){var l=n[a];Y(l)||(o||(s+=1),o=!1,s+=a.length+3+wo(l))}return s;default:return 0}}function ko(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),n=e.sizes.slice(r);return[ko({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),ko({size:n.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:n,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var Co=Uint8Array,Eo=Uint16Array,To=Uint32Array,xo=new Co([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Io=new Co([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Mo=new Co([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ro=function(e,t){for(var r=new Eo(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new To(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},Po=Ro(xo,2),Fo=Po[1];Po[0][28]=258,Fo[258]=28;for(var Lo=Ro(Io,0)[1],Ao=new Eo(32768),Oo=0;32768>Oo;++Oo){var Do=(43690&Oo)>>>1|(21845&Oo)<<1;Ao[Oo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var No=function(e,t,r){for(var i=e.length,n=0,s=new Eo(t);i>n;++n)++s[e[n]-1];var o,a=new Eo(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new Eo(1<<t);var l=15-t;for(n=0;i>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[Ao[d]>>>l]=u}else for(o=new Eo(i),n=0;i>n;++n)o[n]=Ao[a[e[n]-1]++]>>>15-e[n];return o},Bo=new Co(288);for(Oo=0;144>Oo;++Oo)Bo[Oo]=8;for(Oo=144;256>Oo;++Oo)Bo[Oo]=9;for(Oo=256;280>Oo;++Oo)Bo[Oo]=7;for(Oo=280;288>Oo;++Oo)Bo[Oo]=8;var qo=new Co(32);for(Oo=0;32>Oo;++Oo)qo[Oo]=5;var Ho=No(Bo,9,0),$o=No(qo,5,0),Uo=function(e){return(e/8>>0)+(7&e&&1)},Wo=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof Eo?Eo:e instanceof To?To:Co)(r-t);return i.set(e.subarray(t,r)),i},zo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Vo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},jo=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,s=r.slice();if(!n)return[new Co(0),0];if(1==n){var o=new Co(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(i=1;n>i;++i)s[i].s>h&&(h=s[i].s);var p=new Eo(h+1),_=Go(r[c-1],p,0);if(_>t){i=0;var v=0,g=_-t,f=1<<g;for(s.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));n>i;++i){var m=s[i].s;if(t>=p[m])break;v+=f-(1<<_-p[m]),p[m]=t}for(v>>>=g;v>0;){var y=s[i].s;t>p[y]?v-=1<<t-p[y]++-1:++i}for(;i>=0&&v;--i){var b=s[i].s;p[b]==t&&(--p[b],++v)}_=t}return[new Co(p),_]},Go=function(e,t,r){return-1==e.s?Math.max(Go(e.l,t,r+1),Go(e.r,t,r+1)):t[e.s]=r},Qo=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Eo(++t),i=0,n=e[0],s=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[r.subarray(0,i),t]},Ko=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},Zo=function(e,t,r){var i=r.length,n=Uo(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;i>s;++s)e[n+s+4]=r[s];return 8*(n+4+i)},Yo=function(e,t,r,i,n,s,o,a,l,u,c){zo(t,c++,r),++n[256];for(var d=jo(n,15),h=d[0],p=d[1],_=jo(s,15),v=_[0],g=_[1],f=Qo(h),m=f[0],y=f[1],b=Qo(v),S=b[0],w=b[1],k=new Eo(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var E=jo(k,7),T=E[0],x=E[1],I=19;I>4&&!T[Mo[I-1]];--I);var M,R,P,F,L=u+5<<3,A=Ko(n,Bo)+Ko(s,qo)+o,O=Ko(n,h)+Ko(s,v)+o+14+3*I+Ko(k,T)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return Zo(t,c,e.subarray(l,l+u));if(zo(t,c,1+(A>O)),c+=2,A>O){M=No(h,p,0),R=h,P=No(v,g,0),F=v;var D=No(T,x,0);for(zo(t,c,y-257),zo(t,c+5,w-1),zo(t,c+10,I-4),c+=14,C=0;I>C;++C)zo(t,c+3*C,T[Mo[C]]);c+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)zo(t,c,D[H=31&q[C]]),c+=T[H],H>15&&(zo(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}else M=Ho,R=Bo,P=$o,F=qo;for(C=0;a>C;++C)if(i[C]>255){var H;Vo(t,c,M[257+(H=i[C]>>>18&31)]),c+=R[H+257],H>7&&(zo(t,c,i[C]>>>23&31),c+=xo[H]);var U=31&i[C];Vo(t,c,P[U]),c+=F[U],U>3&&(Vo(t,c,i[C]>>>5&8191),c+=Io[U])}else Vo(t,c,M[i[C]]),c+=R[i[C]];return Vo(t,c,M[256]),c+R[256]},Jo=new To([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xo=function(){for(var e=new To(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),ea=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=Xo[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},ta=function(e,t,r,i,n){return function(e,t,r,i,n,s){var o=e.length,a=new Co(i+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(i,a.length-n),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=Zo(l,u,e.subarray(c,d)):(l[c]=true,u=Zo(l,u,e.subarray(c,o)))}else{for(var h=Jo[t-1],p=h>>>13,_=8191&h,v=(1<<r)-1,g=new Eo(32768),f=new Eo(v+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},S=new To(25e3),w=new Eo(288),k=new Eo(32),C=0,E=0,T=(c=0,0),x=0,I=0;o>c;++c){var M=b(c),R=32767&c,P=f[M];if(g[R]=P,f[M]=R,c>=x){var F=o-c;if((C>7e3||T>24576)&&F>423){u=Yo(e,l,0,S,w,k,E,T,I,c-I,u),T=C=E=0,I=c;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=R-P&32767;if(F>2&&M==b(c-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,c),H=Math.min(258,F);q>=N&&--D&&R!=P;){if(e[c+A]==e[c+A-N]){for(var U=0;H>U&&e[c+U]==e[c+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var W=Math.min(N,U-2),z=0;for(L=0;W>L;++L){var V=c-N+L+32768&32767,j=V-g[V]+32768&32767;j>z&&(z=j,P=V)}}}N+=(R=P)-(P=g[R])+32768&32767}if(O){S[T++]=268435456|Fo[A]<<18|Lo[O];var G=31&Fo[A],Q=31&Lo[O];E+=xo[G]+Io[Q],++w[257+G],++k[Q],x=c+A,++C}else S[T++]=e[c],++w[e[c]]}}u=Yo(e,l,true,S,w,k,E,T,I,c-I,u)}return Wo(a,0,i+Uo(u)+n)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,i)},ra=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},ia=function(e,t){var r=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&&ra(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}},na=function(e){return 10+(e.filename&&e.filename.length+1||0)};function sa(e,t){void 0===t&&(t={});var r=ea(),i=e.length;r.p(e);var n=ta(e,t,na(t),8),s=n.length;return ia(n,t),ra(n,s-8,r.d()),ra(n,s-4,i),n}function oa(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Co(e.length+(e.length>>>1)),n=0,s=function(e){i[n++]=e},o=0;r>o;++o){if(n+5>i.length){var a=new Co(n+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?s(l):2048>l?(s(192|l>>>6),s(128|63&l)):l>55295&&57344>l?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return Wo(i,0,n)}function aa(e,t){for(var r="",i=0;e.length>i;){var n=e[i++];r+=String.fromCharCode(n)}return r}class la{constructor(e,t){var r,i;void 0===t&&(t={}),this._loggedTracker={},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,n,s,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(n=e.attributes)?void 0:n.length)&&void 0!==i?i:0)+(null!==(s=null==(o=e.texts)?void 0:o.length)&&void 0!==s?s:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);if(t.attributes){var i=t.attributes.length;t.attributes=t.attributes.filter((e=>{var t=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t[0])&&e}));var n,s,o=i-t.attributes.length;o>0&&(null==(n=(s=this._options).onDroppedAttributeMutations)||n.call(s,o))}var a=this._numberOfChanges(t);return 0!==a||r===a?e:void 0},this._rrweb=e,this._options=t,this._rateLimiter=new fe({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:$r})}reset(){this._loggedTracker={}}stop(){this._rateLimiter.stop(),this.reset()}}qr.DEBUG=!1,qr.LIB_VERSION="1.422.0",qr.LIB_NAME="web";class ua{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(Vn,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Vn);return K(t=r)&&J(t.sessionId)&&re(t.size)&&r.sessionId===e?r.size:0}}function ca(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<ge(100*t,0,100,$r)}function da(e){return"$survey_response_"+e}function ha(e,t){if(!t)return null;var r=e[da(t)];return G(r)?[...r]:r}function pa(e,t){void 0===e&&(e={});var r={};return t.questions.forEach((t=>{if(!Y(t.originalQuestionIndex)){var i,n=0===(i=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+i,s=ha(e,t.id);Y(s)||(r[n]=s)}})),v({$survey_questions:t.questions.map((t=>({id:t.id,question:t.question,response:ha(e,t.id)})))},e,r)}function _a(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function va(e){return"string"==typeof e&&e.trim()?e.trim():null}function ga(e){return e.toLowerCase()}function fa(e,t,r){if(!e||!t)return null;var i=ga(t),n=Object.keys(e).find((e=>ga(e)===i));if(n)return null==r||r.debug("Found exact translation match: "+n),n;if(i.includes("-")){var s=i.split("-")[0],o=Object.keys(e).find((e=>ga(e)===s));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var ma=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function ya(e,t,r){var i,n=fa(e.translations,t,r),s=v({},e),o=!1;if(n){var a,l=null==(a=e.translations)?void 0:a[n];if(l)if(null==r||r.info("Applying survey-level translation for language: "+n),Y(l.name)||(s.name=l.name,o=!0),s.appearance){var u=v({},s.appearance);for(var c of ma){var d=l[c];Y(d)||(u[c]=d,o=!0)}s.appearance=u}else(function(e){return ma.some((t=>!Y(e[t])))})(l)&&(o=!0)}var h=e.questions.map((e=>function(e,t,r){var i,n=fa(e.translations,t,r);if(!n)return{question:e,matchedKey:null,hasChanges:!1};var s=null==(i=e.translations)?void 0:i[n];if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=v({},e),a=!1;return Y(s.question)||(o.question=s.question,a=!0),Y(s.description)||(o.description=s.description,a=!0),Y(s.buttonText)||(o.buttonText=s.buttonText,a=!0),"link"in o&&!Y(s.link)&&(o.link=s.link,a=!0),"lowerBoundLabel"in o&&!Y(s.lowerBoundLabel)&&(o.lowerBoundLabel=s.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Y(s.upperBoundLabel)&&(o.upperBoundLabel=s.upperBoundLabel,a=!0),"choices"in o&&function(e){return G(e.choices)}(s)&&(o.choices=s.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,r))),p=h.map((e=>e.question)),_=h.some((e=>e.hasChanges)),g=null;return n||(g=(null==(i=h.find((e=>e.matchedKey)))?void 0:i.matchedKey)||null),_&&(s.questions=p,o=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:s,matchedKey:o?n||g:null}}function ba(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function Sa(e){var t;return ba(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var wa=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},ka=e=>e.toLowerCase(),Ca={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=>wa(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!wa(t,e))))),icontains:(e,t)=>t.map(ka).some((t=>e.map(ka).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(ka).every((t=>e.map(ka).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var r=parseFloat(t);return!isNaN(r)&&e.some((e=>r<parseFloat(e)))}))};function Ea(e,t){return!e||Object.entries(e).every((e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(null==i)return!1;var n=Ca[r.operator];return!!n&&n(r.values,[String(i)])}))}function Ta(e,t,r){return ti({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var xa=new Set(["is_not","not_icontains","not_regex"]);function Ia(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,n=null==i?void 0:i[e.key],s=e.operator||"exact";if(Y(n)||ee(n))return xa.has(s);var o=Ca[s];return!!o&&!Y(e.value)&&!ee(e.value)&&o(G(e.value)?e.value.map(String):[String(e.value)],G(n)?n.map(String):[String(n)])}))}var Ma=Ur("[SessionRecording]");function Ra(e,t){return t?e:"!"+e}function Pa(e,t){return e===t||e!=="!"+t&&null}class Fa{constructor(e,t,r,i,n,s,o){this._sampleRate=null,this._recordingStatusFunction=yo,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=n,this._tryTakeFullSnapshot=s,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=re(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new uo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=mo):(this._triggerStatusMatcher=new co([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=yo),this._instance.register_for_session({[Rs]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,((e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()}))}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t=this._instance.get_property("$session_recording_remote_config"),r=null==t?void 0:t.minimumDurationMilliseconds;return re(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&te(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e((e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){Ma.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,n=this._sampleRate;if(!re(n))return null==(r=this._instance.persistence)||r.unregister(Nn),void(null==(i=this._instance.persistence)||i.unregister(Pn));var s=this._instance.get_property(Nn),o=this._instance.get_property(Pn),a=Pa(s,e),l=re(o)&&o!==n,u=Y(o)&&s===e,c=l||u||!ne(a),d=c?ca(e,n):a;c&&(d?this._reportStarted("sampled"):Ma.warn("Sample rate ("+n+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[Nn]:Ra(e,d),[Pn]:ee(o)&&s===e?null:n})}ensureSamplingDecision(e){if(re(this._sampleRate)){var t=this._instance.get_property(Nn);ne(Pa(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,n;null==(e=this._instance.persistence)||e.unregister(Hn),null==(t=this._instance.persistence)||t.unregister(qn),null==(r=this._instance.persistence)||r.unregister(Nn),null==(i=this._instance.persistence)||i.unregister(Pn),null==(n=this._instance.persistence)||n.unregister(Bn)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===io}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter((e=>e.status===io)).map((e=>e.label))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}}class La{constructor(e,t,r,i,n){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=n}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Rs]:"v2_trigger_groups",[Ps]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):Ma.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return eo;if(e.urlTriggerMatching.urlBlocked)return Zs;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return js;var i=!1,n=!1;for(var s of t){var o=s.triggerStatus(e.sessionId);if(o===ro){var a=s.group.id,l=r.get(a);Y(l)?$r.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(n=!0)}else o===io&&(i=!0)}return n?Gs:i?Ks:js}({isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;re(i)&&(ee(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var n=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var s=function(i){i.checkUrlTriggerConditions(t,r,(t=>{n._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),n.updateActiveTriggers(e),n._onTriggerActivated(t))}),e)};for(var o of this._triggerGroupMatchers)s(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return Ma.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var n=function(r){r.checkEventTriggerConditions(e.event,(n=>{if(i._checkGroupLevelProperties(r,e.properties)){var s=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(ts),a=s.some((t=>!t.properties||0===t.properties.length||Ia(t.properties,e.properties,o)));a&&(r.activateTrigger(n,t),i.updateActiveTriggers(t),i._onTriggerActivated(n))}}),t)};for(var s of this._triggerGroupMatchers)n(s)}catch(e){Ma.error("Could not activate event trigger for trigger groups",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,n=i.id,s=i.sampleRate,o=Wn+n,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(K(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,c=re(p)&&p!==s,l=h===e&&re(p)&&p===s&&ne(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var v=u||c||d||!ne(l),g=v?ca(e+n,s):l;v&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:i.name,sampleRate:s,isSampled:g}),this._triggerGroupSamplingResults.set(n,g),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:s,sampled:g}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(Nn),null==(t=this._instance.persistence)||t.unregister(Pn),null==(r=this._instance.persistence)||r.unregister(Bn),this._triggerGroupMatchers)){var n,s,o,a=i.group.id;null==(n=this._instance.persistence)||n.unregister($n+a),null==(s=this._instance.persistence)||s.unregister(Un+a),null==(o=this._instance.persistence)||o.unregister(Wn+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,n=i.id,s="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);s&&t.push({id:n,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Is]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===io)return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap((t=>t.triggerStatusNoSideEffects(e)!==io?[]:t.getPendingTriggerConditions(e).map((e=>'trigger group "'+t.group.name+'": '+e))))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||Ia(r,t,this._instance.get_property(ts))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new fo(t._instance,e,((r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()}));t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}}var Aa=e=>{if(i){try{for(var t=e+"=",r=i.cookie.split(";").filter((e=>e.length)),n=0;r.length>n;n++){for(var s=r[n];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},Oa="https?://(.*)",Da=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Na=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Da],Ba="<masked>",qa=["li_fat_id"];function Ha(e,t,r){if(!i)return{};var n,s=t?[...Da,...r||[]]:[],o=$a(si(i.URL,s,Ba),e),a=(n={},zr(qa,(function(e){var t=Aa(e);n[e]=t||null})),n);return Vr(a,o)}function $a(e,t){var r=Na.concat(t||[]),i={};return zr(r,(function(t){var r=ni(e,t);i[t]=r||null})),i}function Ua(e){var t=function(e){return e?0===e.search(Oa+"google.([^/?]*)")?"google":0===e.search(Oa+"bing.com")?"bing":0===e.search(Oa+"yahoo.com")?"yahoo":0===e.search(Oa+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",n={};if(!ee(t)){n.$search_engine=t;var s=i?ni(i.referrer,r):"";s.length&&(n.ph_keyword=s)}return n}function Wa(){return navigator.language||navigator.userLanguage}var za="$direct";function Va(){return(null==i?void 0:i.referrer)||za}function ja(e,t,r){void 0===r&&(r=!1);var i=e?[...Da,...t||[]]:[],s=r?Tt(null==n?void 0:n.href):null==n?void 0:n.href,o=null==s?void 0:s.substring(0,1e3);return{r:Va().substring(0,1e3),u:o?si(o,i,Ba):void 0}}function Ga(e,t){var r;void 0===t&&(t=!1);var i=e.r,n=e.u,s=t?Tt(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==za?za:null==(r=ri(i))?void 0:r.host};if(s){o.$current_url=s;var a=ri(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=$a(s);Vr(o,l)}if(i){var u=Ua(i);Vr(o,u)}return o}function Qa(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ka(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Za=1e5,Ya="https://schema.org",Ja=[],Xa="actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),el="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),tl="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),rl="Accommodation AdministrativeArea Country Place State".split(" "),il={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:el,publisher:tl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ja},Offer:{seller:tl},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Person:{},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:tl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:tl,areaServed:rl,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ja}},nl={},sl=[[el,nl],["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),il.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),il.Event],[tl,il.Organization],[rl,il.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),il.Product],["AggregateRating EmployerAggregateRating Rating".split(" "),nl]],ol="AlignmentObject BedDetails Certification ContactPoint CreditCard DefinedRegion EducationalOccupationalCredential EntryPoint GeoCoordinates GeoShape InteractionCounter JobPosting LocationFeatureSpecification MathSolver MemberProgram MemberProgramTier MerchantReturnPolicy MerchantReturnPolicySeasonalOverride MonetaryAmount NutritionInformation OccupationalExperienceRequirements OfferShippingDetails OpeningHoursSpecification PeopleAudience PostalAddress PriceSpecification PropertyValue QuantitativeValue ServicePeriod ShippingConditions ShippingDeliveryTime ShippingRateSettings ShippingService SpeakableSpecification Thing UnitPriceSpecification".split(" ");function al(e,t){return V.call(e,t)?e[t]:void 0}function ll(e){var t=typeof e;return ee(e)||"string"===t||"number"===t||"boolean"===t}function ul(e){return ll(e)||G(e)&&e.every(ll)?e:void 0}function cl(e){if(V.call(il,e))return il[e];for(var t of sl){var r=t[1];if(t[0].includes(e))return r}return ol.includes(e)?nl:void 0}function dl(e,t){if(!K(e))return null;var r=al(e,"@type"),i=function(e){return("string"==typeof e?[e]:G(e)?e:[]).filter((e=>"string"==typeof e)).map((e=>e.replace(/^https?:\/\/schema\.org\//,""))).filter((e=>!!cl(e)))}(r).filter((e=>!t||!t.length||t.includes(e)));if(!i.length)return null;var n={"@type":"string"==typeof r?i[0]:i},s=ul(al(e,"@id"));for(var o of(Y(s)||(n["@id"]=s),Xa)){var a=ul(al(e,o));Y(a)||(n[o]=a)}for(var l of i){var u=cl(l),c=function(){var t=al(e,d),r=u[d];if(!0===r){var i=ul(t);Y(i)||(n[d]=i)}else if(G(t)){var s=t.map((e=>dl(e,r))).filter(K);s.length&&(n[d]=s)}else{var o=dl(t,r);o&&(n[d]=o)}};for(var d of Object.keys(u))c()}return n}function hl(e){if(!K(e))return null;var t=al(e,"@context");if("string"!=typeof t||!/^https?:\/\/schema\.org\/?$/.test(t))return null;var r=dl(e);if(r)return v({"@context":Ya},r);var i=al(e,"@graph");if(!G(i))return null;var n=i.map((e=>dl(e))).filter(K);return n.length?{"@context":Ya,"@graph":n}:null}function pl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function _l(e,t,r){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some((e=>(t.lastIndex=0,t.test(e)))))return!0;try{return!!r&&e.matches(r)}catch(e){return!1}}function vl(e){return pl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(pl)}function gl(e){return Y(e)?void 0:Math.round(e)}function fl(e){return K(e)?e.network_timing:e}var ml,yl,bl=36e5,Sl=943718.4,wl="[SessionRecording]",kl=Ur(wl),Cl=[m.MouseMove,m.MouseInteraction,m.Scroll,m.ViewportResize,m.Input,m.TouchMove,m.MediaInteraction,m.Drag],El=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Tl(){var e;return null==h||null==(e=h.__PosthogExtensions__)?void 0:e.rrweb}function xl(){var e;return null==(e=Tl())?void 0:e.record}function Il(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,bo())}}function Ml(e){return aa(sa(oa(Il(e))))}function Rl(e){return Pl.apply(this,arguments)}function Pl(){return(Pl=_((function*(e){var t=Il(e),r=yield Bt(t,qr.DEBUG,{rethrow:!0});return aa(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Fl="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,Ll=!1;function Al(e){return G(e)&&0===e.length?ml=null!=ml?ml:Ml([]):Ml(e)}function Ol(e){return Dl.apply(this,arguments)}function Dl(){return(Dl=_((function*(e){return G(e)&&0===e.length?ml||(yl=null!=yl?yl:Rl([]).then((e=>(ml=e,e))).catch((e=>{throw ml=void 0,yl=void 0,e}))):Rl(e)}))).apply(this,arguments)}function Nl(e){return Fl&&!Ll&&function(e){return e.type===f.FullSnapshot||e.type===f.IncrementalSnapshot&&(e.data.source===m.Mutation||e.data.source===m.StyleSheetRule)}(e)}function Bl(e){return{event:e,size:wo(e)}}function ql(e,t){return v({},e,{data:t,cv:"2024-10"})}function Hl(e,t){return v({},e,{cv:"2024-10",data:v({},e.data,t)})}function $l(e){try{if(e.type===f.FullSnapshot)return Bl(ql(e,Ml(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation)return Bl(Hl(e,{texts:Al(e.data.texts),attributes:Al(e.data.attributes),removes:Al(e.data.removes),adds:Al(e.data.adds)}));if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule)return Bl(Hl(e,{adds:e.data.adds?Ml(e.data.adds):void 0,removes:e.data.removes?Ml(e.data.removes):void 0}))}catch(e){kl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:So(e)}}function Ul(){return Ul=_((function*(e){try{if(e.type===f.FullSnapshot)return Bl(ql(e,yield Rl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation){var t=yield Promise.all([Ol(e.data.texts),Ol(e.data.attributes),Ol(e.data.removes),Ol(e.data.adds)]);return Bl(Hl(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule){var r=yield Promise.all([e.data.adds?Rl(e.data.adds):void 0,e.data.removes?Rl(e.data.removes):void 0]);return Bl(Hl(e,{adds:r[0],removes:r[1]}))}}catch(t){return Ot(t)&&(Ll=!0),kl.error("could not compress event asynchronously - trying synchronous compression",t),$l(e)}return{event:e,size:So(e)}})),Ul.apply(this,arguments)}function Wl(e,t){return e.type===f.Custom&&e.data.tag===t}function zl(e){return Wl(e,"sessionIdle")}function Vl(e){return Wl(e,"$session_ending")}function jl(e){return Wl(e,"$session_starting")}class Gl{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(wl+" must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return Pa(this._instance.get_property(Nn),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return re(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,n,s;if(r&&(e!==this._sessionId||t!==this._windowId)){var o,a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(o=this._flushedSizeTracker)?void 0:o.currentTrackedSize(l)}),null==(i=this._instance.persistence)||i.unregister(zn),this._maxDepthExceeded=!1,null==(n=Tl())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){var c=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(c)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(s=this._strategy)||s.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Bn])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return re(r)&&re(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!re(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return re(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var n,s=this._getBufferDuration();return!!ee(s)||r>s||(null==(n=this._instance.persistence)||n.register({[Bn]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==Ks?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&(this._holdFlushUntilInteraction=!1),this._drainCompressionQueueSync(),this._flushBuffer()):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=i&&i.visibilityState&&("visible"===i.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+i.visibilityState,{}))},this._instance=e,this._documentWasEverVisible=null==t||t;var r=this._sessionManager.checkAndGetSessionAndWindowId(),n=r.windowId;this._sessionId=r.sessionId,this._windowId=n,this._linkedFlagMatching=new vo(this._instance),this._urlTriggerMatching=new _o(this._instance),this._eventTriggerMatching=new go(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||kl.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new ua(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,n,s,o,a,l,u=null==(e=this._remoteConfig)?void 0:e.masking,c={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector,maskAllElementAttributes:null==(n=this._instance.config.session_recording)?void 0:n.maskAllElementAttributes},d=null!==(s=null==c?void 0:c.maskAllInputs)&&void 0!==s?s:null==u?void 0:u.maskAllInputs,h=null!==(o=null==c?void 0:c.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,p=null!==(a=null==c?void 0:c.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,_=null!==(l=null==c?void 0:c.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Y(d)&&Y(h)&&Y(p)&&Y(_)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!te(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter((e=>{var i=null==r?void 0:r[e],n=t[e];return!Y(i)&&i!==n}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,kl.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+i.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector,maskAllElementAttributes:null==r?void 0:r.maskAllElementAttributes},project:t}))}}}get _canvasResolutionScale(){var e;return ge(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,Ur("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,n,s,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,c=null!==(i=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(s=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==s?s:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:ge(c,0,12,Ur("canvas recording fps"),4),quality:ge(d,0,1,Ur("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled),r=this._instance.config.enable_recording_console_log;return null!=r?r:t}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,n={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},s=(null==n?void 0:n.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==i?void 0:i.recordBody),a=fl(this._instance.config.capture_performance),l=fl(null==i?void 0:i.capturePerformance),u=!!(ne(a)?a:l);return s||o||u?{recordHeaders:s,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,r=[],i=null==(e=h.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this._isConsoleLogCaptureEnabled&&r.push(i());var s=null==(t=h.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Q(s))if(!ei.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){var o=Q(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(s(((e,t,r)=>{var i,n={payloadSizeLimitBytes:sn.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...sn.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...sn.payloadHostDenyList]},s=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=nn(n),e=>(null!=e&&e.requestBody&&(e.requestBody=dn(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=dn(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t,r)=>{var i;if(null==r||!r(e.name)){var n=ri(e.name),s=0===t.indexOf("http")?null==(i=ri(t))?void 0:i.pathname:t;"/"===s&&(s="");var o=null==n?void 0:n.pathname.replace(s||"","");if(!(n&&o&&cn.some((e=>0===o.indexOf(e)))))return e}})((un((i=t).requestHeaders),un(i.responseHeaders),i),e.api_host,r));var i},c=Q(e.session_recording.maskNetworkRequestFn);return c&&Q(e.session_recording.maskCapturedNetworkRequestFn)&&$r.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var r=e.session_recording.maskNetworkRequestFn({url:t.name});return!r&&t.isInitial?r:v({},t,{name:null==r?void 0:r.url})}),n.maskRequestFn=Q(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r=u(t);if(r){var i=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,n=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return te(n)&&i?(pn.add(i),i):null!=n?n:void 0}}:e=>function(e){if(!Y(e))return e.requestBody=hn(e.requestBody,"Request"),e.responseBody=hn(e.responseBody,"Response"),e}(u(e)),v({},sn,n,{recordHeaders:s,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else kl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Tt(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Tt(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...Da,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(si(r,i,Ba))}_maskUrl(e){var t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var r,i=t.maskCapturedNetworkRequestFn({name:e});return null!==(r=null==i?void 0:i.name)&&void 0!==r?r:null==i?void 0:i.url}if(t.maskNetworkRequestFn){var n=t.maskNetworkRequestFn({url:e});return null==n?void 0:n.url}return e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):kl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(El((()=>xl().addCustomEvent(e,t))))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{var t=xl();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e){void 0===e&&(e=!1),Promise.resolve().then((()=>{var t;return null==(t=this._jsonLdCapture)?void 0:t.scan(e)}))}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;var t=new URL(e.location.href),r=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==r&&(this._lastHref=r,this._tryAddCustomEvent("$url_changed",{href:r}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach((e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)}))}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(El((()=>xl().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,n=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return re(n)&&Number.isFinite(n)&&n>=1e3&&36e5>=n?n:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval((()=>{this._tryTakeFullSnapshot()}),e))}}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null==(e=this._jsonLdCapture)||e.scan(),clearInterval(this._fullSnapshotTimer),kl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null==(e=this._jsonLdCapture)||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),kl.info("recording resumed"))}_activateTrigger(e,t){var r;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,n;null==(i=this._instance.persistence)||i.register({["url"===e?qn:Hn]:this.sessionId}),null==(n=this._strategy)||n.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(Rn);if(e){var t;try{t=K(e)?e:JSON.parse(e)}catch(e){return void kl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,n=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-n>bl)return kl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(Rn))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(t){var r,n,s=this._remoteConfig;if(s){this.isStarted||(this._holdFlushUntilInteraction=!1!==this._isIdle&&!this._suppressNextFreshStartHold,this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=this._holdFlushUntilInteraction,this._heldBufferOverflowed=!1),this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var o=this._sessionManager.checkAndGetSessionAndWindowId(),a=o.windowId;this._sessionId=o.sessionId,this._windowId=a,null==(r=this._instance.persistence)||r.unregister(zn),null!=s&&s.endpoint&&(this._endpoint=null==s?void 0:s.endpoint),this._strategy=2===(null==s?void 0:s.version)&&(null==s?void 0:s.triggerGroups)&&s.triggerGroups.length>0?new La(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Fa(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(s),null==(n=this._removeEventTriggerCaptureHook)||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(Fn,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Fn)})),this._checkOverride(Ln,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ln)})),this._checkOverride(On,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(On)})),this._checkOverride(An,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(An)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Jr(e,"beforeunload",this._onBeforeUnload),Jr(e,"pagehide",this._onPageHide),Jr(e,"offline",this._onOffline),Jr(e,"online",this._onOnline),Jr(i,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&Q(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&Q(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",(()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId(((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)}))})):Q(this._sessionManager.on)||kl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),te(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",(e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){kl.error("Could not add $pageview to rrweb session",e)}}))),this.status===Qs&&this._reportStarted(t||"recording_initialized"))}else kl.info("remote config must be stored in persistence before recording can start")}_teardown(){var t,r,n,s,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==i||i.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(t=this._removePageViewCaptureHook)||t.call(this),this._removePageViewCaptureHook=void 0,null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=void 0,null==(n=this._onSessionIdListener)||n.call(this),this._onSessionIdListener=void 0,null==(s=this._onSessionIdleResetForcedListener)||s.call(this),this._onSessionIdleResetForcedListener=void 0,null==(o=this._forceIdleSessionIdListener)||o.call(this),this._forceIdleSessionIdListener=void 0,null==(a=this._strategy)||a.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t,r;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._jsonLdCapture)||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1,null==(r=this._stopRrweb)||r.call(this),this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch((()=>{})).then((()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._teardown(),kl.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),kl.info("stopped")})),!0}stop(){this._stopRecordingProducers(),this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),kl.info("stopped"))}_restartForSessionIdChange(e){var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,null==(t=Tl())||null==t.resetSnapshotCostState||t.resetSnapshotCostState(),this.start("session_id_changed"),this._holdFlushUntilInteraction=e,this._heldEpochShipsOnUnload=!1}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard(){this._clearBuffer(),this._teardown(),kl.info("discarded")}_captureProcessedEvent(e,t,r,i,n){var s={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:n};this.status!==js?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(s)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,kl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=Tl())||null==e.getLastSnapshotCost?void 0:e.getLastSnapshotCost();t&&t!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=t,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=t.durationMs||(this._slowestFullSnapshot=t),500>t.durationMs||kl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(t.durationMs),stylesheetMs:Math.round(t.stylesheetMs),nodeCount:t.nodeCount,cssRuleCount:t.cssRuleCount,nonDeferrableCssRuleCount:t.nonDeferrableCssRuleCount,deferredStylesheetCount:t.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){e.type!==f.FullSnapshot?e.type===f.IncrementalSnapshot&&(Y(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,kl.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter((t=>t!==e))}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.compressionEnabled?$l(e.event):{event:e.event,size:So(e.event)};this._captureQueuedCompressionEvent(e,t.event,t.size)}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach((e=>{this._processQueuedCompressionEventSync(e)}))}_enqueueCompression(e,t,r,i){var n=this,s={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(s),this._queuedCompressionEvents+=1;var o=function(){var r=_((function*(){try{if(s.processed)return;var r,i;try{var o=t?Nl(e)?yield function(e){return Ul.apply(this,arguments)}(e):$l(e):{event:e,size:So(e)};r=o.event,i=o.size}catch(t){kl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=So(e)}n._captureQueuedCompressionEvent(s,r,i)}finally{n._finishQueuedCompressionEvent(s)}}));return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(o):o()}onRRwebEmit(e){var t,r,i,n,s,o,a,l,u;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&K(e))){if(e.type===f.Meta){var c=this._maskReplayUrl(e.data.href);if(this._lastHref=c,!c)return;e.data.href=c}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,(()=>this._pauseRecording()),(()=>this._resumeRecording()),((e,t)=>this._activateTrigger(e,t))),!this._urlTriggerMatching.urlBlocked||function(e){return e.type===f.Custom&&"recording paused"===e.data.tag}(e)){var d,h,p;e.type===f.FullSnapshot&&(null!=(d=Tl())&&null!=d.wasMaxDepthReached&&d.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then((()=>this._safeTrackFullSnapshotCost())),this._scheduleFullSnapshot(),null==(h=this._mutationThrottler)||h.reset(),null==(p=this._instance.persistence)||p.register_once({[zn]:e.timestamp},void 0));var _=e.type===f.FullSnapshot&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));_&&this._clearBufferBeforeMostRecentMeta();var v=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(v){var g=function(e){var t=e;if(t&&K(t)&&6===t.type&&K(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(v),y=function(e){return Vl(e)?e.data.payload:null}(g),b=function(e){return jl(e)?e.data.payload:null}(g),S=function(e){return zl(e)?e.data.payload:null}(g);y||b?null!=y&&y.lastActivityTimestamp&&(g.timestamp=y.lastActivityTimestamp):null!=S&&S.sessionId||this._updateWindowAndSessionIds(g),e.type===f.FullSnapshot&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var w=null!==(i=null!==(n=null!==(s=null==y?void 0:y.currentSessionId)&&void 0!==s?s:null==b?void 0:b.nextSessionId)&&void 0!==n?n:null==S?void 0:S.sessionId)&&void 0!==i?i:this._sessionId,k=null!==(o=null!==(a=null!==(l=null==y?void 0:y.currentWindowId)&&void 0!==l?l:null==b?void 0:b.nextWindowId)&&void 0!==a?a:null==S?void 0:S.windowId)&&void 0!==o?o:this._windowId;if(!0!==this._isIdle||function(e){return zl(e)||Vl(e)||jl(e)}(g)){g.type===f.FullSnapshot&&(this._eventsDroppedWhileIdle=0),S&&(g.timestamp=S.lastActivityTimestamp+S.threshold);var C=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,_?this._scheduleJsonLdScan(!0):C||this._scheduleJsonLdScan();var E=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(this._queuedCompressionEvents>0||E&&Nl(g))this._enqueueCompression(g,E,w,k);else{var T=E?$l(g):{event:g,size:So(g)};this._captureProcessedEvent(g,T.event,T.size,w,k)}}else(function(e){return e.type===f.FullSnapshot||e.type===f.Meta||e.type===f.IncrementalSnapshot&&e.data.source!==m.CanvasMutation})(g)&&this._eventsDroppedWhileIdle++}else!0===this._isIdle&&this._eventsDroppedWhileIdle++}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):js}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[Nn]:this.sessionId,[Pn]:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t,r=null==e||null==(t=e.location)?void 0:t.href;if(!r)return;var i=this._maskReplayUrl(r);if(!i)return;return new URL(i).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout((()=>{this._flushBuffer()}),2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every((e=>(null==e?void 0:e.type)===f.Custom&&!Vl(e)&&!jl(e)))}_describePendingTriggerConditions(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if(e!==Ks)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ms]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ms]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[Ms]:t}),kl.info("buffering: "+r))}_flushBuffer(){var e;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>Sl?this._clearBuffer():this._buffer;var t=this._buffer;null==(e=this._strategy)||e.ensureSamplingDecision(this.sessionId);var r=this._isBelowMinimumDuration(),i=this.status;if(this._maybeLogBufferingReason(i),i===Ks||i===Zs||i===js||r)return this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==t)return this._buffer;if(t.data.length>0){var n,s=this._currentMaskedHostname();ko(t).forEach((e=>{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:qr.LIB_NAME,$lib_version:qr.LIB_VERSION,$snapshot_host:s})})),null==(n=this._strategy)||n.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,n=this._buffer.sessionId!==i;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>Sl){var s=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==s)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+r>Sl)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1],i=this._sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i.sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(this._buffer.data[t].type===f.Meta){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce(((e,t)=>e+t),0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Ls]:e}),kl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",v({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Cl.indexOf(null==(t=e.data)?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());var r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var i="unknown"===this._isIdle;this._isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}var n=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),s=n.windowId,o=n.sessionId,a=this._sessionId!==o,l=this._windowId!==s;if(this._windowId=s,this._sessionId=o,a||l){var u=a&&!1!==this._isIdle;u&&(this._isIdle="unknown"),this._restartForSessionIdChange(u)}else if(t&&this._releaseHoldAndFlush(),r){var c,d=["sampled","active"].includes(this.status)||(null==(c=this._strategy)?void 0:c.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&d&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,r,i,n,s,o,a,l,u=this._sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp,c=null==(e=Tl())||null==e.getDeferredStylesheetStats?void 0:e.getDeferredStylesheetStats();return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:u,$sdk_debug_replay_flushed_size:null==(t=this._flushedSizeTracker)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:gl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:gl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(n=this._slowestFullSnapshot)?void 0:n.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(s=this._slowestFullSnapshot)?void 0:s.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null==(o=this._slowestFullSnapshot)?void 0:o.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==c?void 0:c.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==c?void 0:c.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==c?void 0:c.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:gl(null==c?void 0:c.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:gl(null==c?void 0:c.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:gl(null==(a=Tl())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=Tl())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_rrweb_error:this._rrwebError,$sdk_debug_rrweb_attached:!!this._stopRrweb,$sdk_debug_rrweb_start_attempted:this._rrwebStartAttempted}}_startRecorder(){var t;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var r,n,s,o,a={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},l=this._instance.config.session_recording;for(var u of Object.entries(l||{})){var c=u[0],d=u[1];if(c in a)if("maskInputOptions"===c)a.maskInputOptions=v({password:!0},d);else if("sampling"===c){var h=null!=d?d:{},p={};Y(h.mousemove)||(p.mousemove=h.mousemove),Y(h.mouseInteraction)||(p.mouseInteraction=h.mouseInteraction),a.sampling=p}else a[c]=d}!0===(null==l?void 0:l.captureJsonLd)&&!0!==a.slimDOMOptions&&"all"!==a.slimDOMOptions&&(a.slimDOMOptions=v({},a.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(a.recordCanvas=!0,a.sampling=v({},a.sampling,{canvas:this._canvasRecording.fps}),a.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},a.canvasResolutionScale=this._canvasResolutionScale,a.canvasMasking={configured:()=>{var e;return Q(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(Q(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,kl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(a.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,a.maskTextSelector=null!==(n=this._masking.maskTextSelector)&&void 0!==n?n:void 0,a.blockSelector=null!==(s=this._masking.blockSelector)&&void 0!==s?s:void 0,a.maskAllElementAttributes=null!==(o=this._masking.maskAllElementAttributes)&&void 0!==o&&o),a.maskAllElementAttributes&&a.maskAttributeFn&&(a.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,kl.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this._warnIfClientMaskingShadowsServer();var _=xl();if(_){this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new la(_,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";kl.info(r,{node:t}),this.log(wl+" "+r,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e});var g=this._gatherRRWebPlugins();if(this._stopRrweb=_(v({emit:e=>{this.onRRwebEmit(e)},plugins:g,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,kl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},a)),!this._stopRrweb)return this._rrwebError=!0,void kl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==l?void 0:l.captureJsonLd)&&i&&null!=e&&e.MutationObserver&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,r){var i=new WeakMap,n=r.getCaptureState||(()=>!0),s=Za,o=t=>{try{var o=n();if(!s||!1===o||!t.isConnected||t.ownerDocument!==e||function(e,t){for(var r=e;r;){if(_l(r,t.blockClass,t.blockSelector)||_l(r,t.maskTextClass,t.maskTextSelector))return!0;var i=r.parentNode;r=r.parentElement||(i&&i.nodeType===i.DOCUMENT_FRAGMENT_NODE?i.host:null)}return!1}(t,r))return;var a=function(e){if(!e||e.length>Za)return null;try{var t=JSON.parse(e),r=G(t)?t.map(hl):hl(t);if(ee(r)||G(r)&&(!r.length||r.some(ee)))return null;var i=JSON.stringify(r);return i.length>2e4?null:[r,i]}catch(e){return null}}(t.text);if(!a)return void i.delete(t);var l=a[0],u=a[1];if(ee(o))return void i.set(t,u);if(i.get(t)!==u){if(u.length>s)return void(s=0);r.emit(l)&&(i.set(t,u),s-=u.length)}}catch(e){return}};try{var a=new t((e=>{try{if(!s||!1===n())return;var t=e=>{for(var t of vl(e))o(t)};for(var r of e)if("childList"===r.type)pl(r.target)&&o(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&pl(i)&&o(i)}else"attributes"===r.type&&pl(r.target)&&o(r.target)}catch(e){return}}));return a.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t){void 0===t&&(t=!1),s&&!1!==n()&&vl(e.documentElement).forEach((e=>{t&&i.delete(e),o(e)}))},stop(){return a.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(i,e.MutationObserver,{blockClass:a.blockClass,blockSelector:a.blockSelector,maskTextClass:a.maskTextClass,maskTextSelector:a.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=ne(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:a,activePlugins:g.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else kl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}var Ql,Kl=["type"],Zl=Object.defineProperty,Yl=(e,t,r)=>((e,t,r)=>t in e?Zl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Jl=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Jl||{}),Xl=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Xl||{}),eu=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(eu||{}),tu=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(tu||{}),ru=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ru||{}),iu=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(iu||{}),nu=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(nu||{});function su(e,t){return-1!==e.indexOf(t)}var ou={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},au={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},lu={};function uu(e){if(lu[e])return lu[e];var t=function(e){var t,r,i=null==(r=null==(t=null==globalThis?void 0:globalThis.Zone)?void 0:t.__symbol__)?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in ou?ou[e]:void 0,n=Boolean(i&&i.every((e=>{var t,i;return Boolean(null==(i=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:i.toString().includes("[native code]"))}))),s=e in au?au[e]:void 0,o=Boolean(s&&s.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(n&&o)return lu[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var c=u[e].prototype;return c?(function(e){return su(e,"AppleWebKit")&&!su(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),lu[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var cu={};function du(e,t,r){var i,n=e+"."+String(r);if(cu[n])return cu[n].call(t);var s=uu(e),o=null==(i=Object.getOwnPropertyDescriptor(s,r))?void 0:i.get;return o?(cu[n]=o,o.call(t)):t[r]}var hu={};function pu(e,t,r){var i=e+"."+String(r);if(hu[i])return hu[i].bind(t);var n=uu(e)[r];return"function"!=typeof n?t[r]:(hu[i]=n,n.bind(t))}function _u(){return uu("MutationObserver").constructor}function vu(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],n={next:i},s=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return n.next.apply(this,t)}));return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},i=e[t],o=r(i);o;){if(o.next===s)return void(o.next=n.next);o=r(i=o.next)}else e[t]=n.next}}catch(e){return()=>{}}}var gu={childNodes:e=>du("Node",e,"childNodes"),parentNode:e=>du("Node",e,"parentNode"),parentElement:e=>du("Node",e,"parentElement"),textContent:e=>du("Node",e,"textContent"),contains:(e,t)=>pu("Node",e,"contains")(t),getRootNode:e=>pu("Node",e,"getRootNode")(),host:e=>e&&"host"in e?du("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?du("Element",e,"shadowRoot"):null,querySelector:(e,t)=>pu("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>pu("Element",e,"querySelectorAll")(t),mutationObserver:_u,patch:vu},fu=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0});function mu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var yu=0,bu=6e4;function Su(){yu+=1}function wu(){return yu}function ku(e,t){return t!==yu||e>bu}var Cu=0,Eu=0,Tu=0,xu=fu(),Iu=null,Mu=null,Ru=[],Pu=0,Fu=0,Lu={slowestBatchMs:0},Au={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0},Ou=e=>e&&e>0?e:null;function Du(e){(Cu+=1)>1||(xu=fu(),Ru=[],Pu=0,Mu=Ou(e),Eu=mu(),Tu=yu)}function Nu(){return 0===Cu?Iu||fu():(Cu-=1)>0?xu:(xu.durationMs=mu()-Eu,xu.deferredStylesheetCount=Pu,Au.deferredCount+=Pu,Mu=null,ku(xu.durationMs,Tu)?xu:Iu=xu)}var Bu=32;function qu(e,t,r){var i=e.length;if(r>=Bu)return i;for(var n=0;e.length>n;n++){var s=e[n];try{var o=s.cssRules;if(o&&o.length)i+=qu(o,t,r+1);else if(t&&s.styleSheet){var a=s.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=qu(l,t,r+1))}}}catch(e){}}return i}function Hu(e){if(0!==Cu){var t=qu(e,null,0);xu.cssRuleCount+=t,Fu>0&&(xu.nonDeferrableCssRuleCount+=t)}}function $u(e){Fu+=1;try{return e()}finally{Fu-=1}}function Uu(e){Cu>0&&(xu.stylesheetMs+=e)}function Wu(e){if(0===Cu||null===Mu)return!1;var t=xu.cssRuleCount-xu.nonDeferrableCssRuleCount;return t>=Mu||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),qu(t,r,0)}catch(e){return 0}}(e)>Mu}function zu(){Au.failedCount+=1}function Vu(e){e>0&&(Au.abandonedCount+=e)}function ju(e){return e.nodeType===e.ELEMENT_NODE}function Gu(e){var t=e&&"host"in e&&"mode"in e&&gu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&gu.shadowRoot(t)===e)}function Qu(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Ku(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Zu(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}var Yu=0;function Ju(e){var t=0===Yu,r=t?mu():0;Yu+=1;try{var i=e.rules||e.cssRules;if(!i)return null;Hu(i);var n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),Ku(Array.from(i,(e=>Xu(e,n))).join(""))}catch(e){return null}finally{Yu-=1,t&&Uu(mu()-r)}}function Xu(e,t){var r;if(tc(e)){var i;try{i=Ju(e.styleSheet)||Zu(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return fc(i,e.styleSheet.href)}catch(e){}return i}var n=e.cssText;return rc(e)&&e.selectorText.includes(":")&&(n=ec(n)),t?fc(n,t):n}function ec(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function tc(e){return"styleSheet"in e}function rc(e){return"selectorText"in e}var ic=/^-?[A-Za-z_][\w-]*$/,nc=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function sc(e){var t=[],r=!1,i=null,n=new Map;function s(e){var n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void s(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!n.importRule)return r=!0,void(i=e);o(t[t.length-1],n.importRule,e)}function o(e,t,r){var i;try{var n;try{n=r||Zu(t)}catch(e){n=t.cssText}try{n&&(null==(i=t.styleSheet)?void 0:i.href)&&(n=fc(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){s(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&tc(r)){var i=n.get(r);return null===i?(e.parts.push(r.cssText),void(e.index+=1)):i?void t.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:r}):void o(e,r,null)}if(!function(e,r){try{var i=function(e){var t,r=e;if(!r.cssRules||0===r.cssRules.length)return null;if(r.media&&"string"==typeof r.media.mediaText)return"@media "+r.media.mediaText+" {";if(rc(e)){if("number"==typeof r.type&&1!==r.type)return null;var i=r.style?r.style.cssText:"";return e.selectorText+" {"+(i?" "+i:"")}if("containerName"in r)return"string"!=typeof r.containerQuery||r.containerName&&!ic.test(r.containerName)?null:"@container "+(r.containerName?r.containerName+" ":"")+r.containerQuery+" {";if("string"==typeof r.conditionText){var n="";try{n=(null==(t=e.constructor)?void 0:t.name)||""}catch(e){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?"@supports "+r.conditionText+" {":null}return"string"==typeof r.name?"keyText"in r.cssRules[0]?ic.test(r.name)?"@keyframes "+r.name+" {":null:""===r.name?"@layer {":nc.test(r.name)?"@layer "+r.name+" {":null:null}(e);if(null===i)return!1;var n=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?fc(i,n):i,fixColons:"sheet"===r.kind&&rc(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var s=r.cssText;"sheet"===e.kind&&rc(r)&&r.selectorText.includes(":")&&(s=ec(s)),e.parts.push(e.sheetHref?fc(s,e.sheetHref):s),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;Hu(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var s=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:s,sheetHref:i,index:0,parts:[],importRule:null}),function(e,t){for(var r=[{sheet:t,rules:e,index:0}],i=function(){var e=r[r.length-1];if(e.index>=e.rules.length)return r.pop(),0;var t=e.rules[e.index];if(e.index+=1,!tc(t)||n.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return n.set(t,null),0}if(!i||r.some((e=>e.sheet===i)))return 0;try{var s=i.rules||i.cssRules;if(!s)return 0;Hu(s);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(s);n.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(s,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var n=mu(),o=e>0?e:1;try{for(;!r&&o>0;){var l=t[t.length-1];if(l.rules.length>l.index){o-=1;try{a(l)}catch(e){s(null)}}else{var u=null;try{if("group"===l.kind){var c=l.prelude+l.parts.join("")+"}";u=l.fixColons?ec(c):c}else u=Ku(l.parts.join(""))}catch(e){}s(u)}}}catch(e){r=!0,i=null}finally{Uu(mu()-n)}return r},text:()=>r?i:null,remainingRules(){if(r)return 0;var e=0;for(var i of t)e+=i.rules.length-i.index;return e}}}class oc{constructor(){Yl(this,"idNodeMap",new Map),Yl(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;var r=null==(t=this.getMeta(e))?void 0:t.id;return null!=r?r:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e))),ju(e)){var r=gu.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ac(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,n=e.type,s=e.maskInputFn,o=e.value||"",a=n&&lc(n);return(r[i.toLowerCase()]||a&&r[a])&&(o=s?s(o,t):"*".repeat(o.length)),o}function lc(e){return e.toLowerCase()}var uc=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function cc(e){var t=e.element,r=e.name,i=e.value,n=e.maskAttributeFn,s=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==s&&s&&uc.has(lc(r))?i:"*".repeat(i.length):n?n(r,i,t):i:i}var dc="__rrweb_original__";function hc(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?lc(t):null}catch(e){return null}}var pc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,_c=/^(?:[a-z+]+:)?\/\//i,vc=/^www\..*/i,gc=/^(data:)([^,]*),(.*)/i;function fc(e,t){return(e||"").replace(pc,((e,r,i,n,s,o)=>{var a,l=i||s||o,u=r||n||"";if(!l)return e;if(_c.test(l)||vc.test(l))return"url("+u+l+u+")";if(gc.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var c=t.split("/"),d=l.split("/");for(var h of(c.pop(),d))"."!==h&&(".."===h?c.pop():c.push(h));return"url("+u+c.join("/")+u+")"}))}var mc,yc,bc="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Sc=4096,wc=1e5,kc=10,Cc=new Map,Ec=1,Tc=new RegExp("[^a-z0-9-_:]"),xc=-2;function Ic(){return Ec++}var Mc=/^[^ \t\n\r\u000c]+/,Rc=/^[, \t\n\r\u000c]+/,Pc=new WeakMap;function Fc(e,t){return t&&""!==t.trim()?Lc(e,t):t}function Lc(e,t){var r=Pc.get(e);if(r||(r=e.createElement("a"),Pc.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Ac(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?bc:e}(e,t.maxBase64ImageLength):e}function Oc(e,t,r,i,n,s){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&n){var a=null==(o=n.sheet)?void 0:o.href;if(a)return a}var l=Fc(e,i);if(l.startsWith("data:")){if("img"===t&&n){var u=l;return((null==s?void 0:s.type)||void 0!==(null==s?void 0:s.quality))&&(u=function(e,t,r,i){if(wc>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>Sc||e.naturalHeight>Sc)return t;var n=Cc.get(t);if(n&&n.type===r&&n.quality===i)return n.result;try{var s=document.createElement("canvas");s.width=e.naturalWidth,s.height=e.naturalHeight;var o=s.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=s.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(Cc.size>=kc){var u=Cc.keys().next().value;void 0!==u&&Cc.delete(u)}return Cc.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(n,l,s.type,s.quality)),Ac(u,s)}if("image"===t)return Ac(l,s)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=Fc(e,i);return"image"===t&&c.startsWith("data:")?Ac(c,s):c}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,n=e.exec(t.substring(r));return n?(r+=(i=n[0]).length,i):""}for(var n=[];i(Rc),t.length>r;){var s=i(Mc);if(","===s.slice(-1))s=Fc(e,s.substring(0,s.length-1)),n.push(s);else{var o="";s=Fc(e,s);for(var a=!1;;){var l=t.charAt(r);if(""===l){n.push((s+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,n.push((s+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return n.join(", ")}(e,i):"style"===r?fc(i,Lc(e)):"object"===t&&"data"===r?Fc(e,i):i:Fc(e,i)}function Dc(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function Nc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&Nc(gu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&Nc(gu.parentNode(e),t,r)}function Bc(e,t,r,i){var n;if(ju(e)){if(!gu.childNodes(n=e).length)return!1}else{if(null===gu.parentElement(e))return!1;n=gu.parentElement(e)}try{if("string"==typeof t){if(i){if(n.closest("."+t))return!0}else if(n.classList.contains(t))return!0}else if(Nc(n,t,i))return!0;if(r)if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}catch(e){}return!1}function qc(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var Hc=new Map;function $c(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function Uc(e){return null==e?"":e.toLowerCase()}var Wc=50,zc=!1,Vc=!1;function jc(e,t){var r=t.doc,i=t.mirror,n=t.blockClass,s=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,c=t.inlineStylesheet,d=void 0===c||c,h=t.maskInputOptions,p=void 0===h?{}:h,_=t.maskTextFn,v=t.maskInputFn,g=t.maskAllElementAttributes,f=void 0!==g&&g,m=t.maskAttributeFn,y=t.slimDOMOptions,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=void 0!==w&&w,C=t.recordCanvas,E=void 0!==C&&C,T=t.canvasMaskingConfigured,x=t.onSerialize,I=t.onIframeLoad,M=t.iframeLoadTimeout,R=void 0===M?5e3:M,P=t.onIframeListenerRegistered,F=t.onStylesheetLoad,L=t.stylesheetLoadTimeout,A=void 0===L?5e3:L,O=t.keepIframeSrcFn,D=void 0===O?()=>!1:O,N=t.newlyAddedElement,B=void 0!==N&&N,q=t.depth,H=void 0===q?0:q,U=t.maxDepth,W=void 0===U?Wc:U,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=W)return Vc=!0,zc||(zc=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=Bc(e,o,a,void 0===z)),Cu>0&&(xu.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,n=t.blockSelector,s=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,c=t.maskInputFn,d=t.maskAllElementAttributes,h=void 0!==d&&d,p=t.maskAttributeFn,_=t.dataURLOptions,v=void 0===_?{}:_,g=t.inlineImages,f=t.recordCanvas,m=t.canvasMaskingConfigured,y=t.keepIframeSrcFn,b=t.newlyAddedElement,S=void 0!==b&&b,w=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:nu.Document,childNodes:[],compatMode:e.compatMode}:{type:nu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:nu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r,i,n,s=t.doc,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskInputFn,c=t.maskAllElementAttributes,d=void 0!==c&&c,h=t.maskAttributeFn,p=t.dataURLOptions,_=void 0===p?{}:p,v=t.inlineImages,g=t.recordCanvas,f=t.canvasMaskingConfigured,m=t.keepIframeSrcFn,y=t.newlyAddedElement,b=void 0!==y&&y,S=t.rootId,w=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),k=function(e){if(e instanceof HTMLFormElement)return"form";var t=lc(e.tagName);return Tc.test(t)?"div":t}(e),C=new Set,E={},T=e.attributes.length,x=0;T>x;x++){var I=e.attributes[x];Dc(k,I.name)||(E[I.name]=Oc(s,k,lc(I.name),I.value,e,_))}if("link"===k&&o&&!w){var M=e.sheet;if(!M){var R=function(e){return e.href}(e);R&&!(M=$c(s,R))&&R.includes(".css")&&(M=$c(s,window.location.origin+"/"+R.replace(window.location.href,"")))}var P=null;M&&(Wu(M)?Cu>0&&(Ru.push(e),Pu+=1):P=Ju(M)),P&&(delete E.rel,delete E.href,E._cssText=P)}if("style"===k&&e.sheet&&!(e.innerText||gu.textContent(e)||"").trim().length){var F=$u((()=>Ju(e.sheet)));F&&(E._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var L=e.value,A=e.checked;"radio"!==E.type&&"checkbox"!==E.type&&"submit"!==E.type&&"button"!==E.type&&L?E.value=ac({element:e,type:hc(e),tagName:k,value:L,maskInputOptions:l,maskInputFn:u}):A&&(E.checked=A)}if("option"===k&&(e.selected&&!l.select?E.selected=!0:delete E.selected),"dialog"===k&&e.open){try{E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){E.rr_open_mode="modal",E.ph_rr_could_not_detect_modal=!0}C.add("rr_open_mode")}if("canvas"===k&&g&&!(null==f?void 0:f()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var n=t.getImageData;if(new Uint32Array((dc in n?n[dc]:n).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(E.rr_dataURL=e.toDataURL(_.type,_.quality));else if(!("__context"in e)){var O=e.toDataURL(_.type,_.quality),D=s.createElement("canvas");D.width=e.width,D.height=e.height,O!==D.toDataURL(_.type,_.quality)&&(E.rr_dataURL=O)}var N,B,q=!1;if("img"===k&&v){mc||(mc=s.createElement("canvas"),yc=mc.getContext("2d"));var H=e,U=H.currentSrc||H.getAttribute("src")||"<unknown-src>",W=H.crossOrigin,z=(t,r)=>q?cc({element:e,name:t,value:r,maskAllElementAttributes:d,maskAttributeFn:h}):r,V=()=>{qc(H,"load",V);try{mc.width=H.naturalWidth,mc.height=H.naturalHeight,yc.drawImage(H,0,0);var e=mc.toDataURL(_.type,_.quality);E.rr_dataURL=z("rr_dataURL",e)}catch(e){if("anonymous"!==H.crossOrigin)return H.crossOrigin="anonymous",void(H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V));console.warn("Cannot inline img src="+U+"! Error: "+e)}"anonymous"===H.crossOrigin&&(W?E.crossOrigin=z("crossOrigin",W):H.removeAttribute("crossorigin"))};H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V)}if("audio"===k||"video"===k){var j=E;j.rr_mediaState=e.paused?"paused":"played",C.add("rr_mediaState"),j.rr_mediaCurrentTime=e.currentTime,j.rr_mediaPlaybackRate=e.playbackRate,j.rr_mediaMuted=e.muted,j.rr_mediaLoop=e.loop,j.rr_mediaVolume=e.volume}if(b||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),w){var G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null==(r=s.defaultView)?void 0:r.getComputedStyle(e);E={class:E.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null==(i=s.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(Y+((null==(n=s.defaultView)?void 0:n.scrollY)||0))+"px"},C.add("rr_width"),C.add("rr_height"),C.add("rr_left"),C.add("rr_top"),J&&(E.rr_position=J.position||"static",C.add("rr_position"),J.transform&&"none"!==J.transform&&(E.rr_transform=J.transform,C.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(E.rr_display=J.display,C.add("rr_display")))}if("iframe"!==k||m(E.src)||(e.contentDocument||(E.rr_src=E.src),delete E.src),d||h)for(var X of Object.entries(E)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(E[ee]=cc({element:e,name:ee,value:te,maskAllElementAttributes:d,maskAttributeFn:h,isGenerated:C.has(ee)}))}q=!0;try{customElements.get(k)&&(N=!0)}catch(e){}return{type:nu.Element,tagName:k,attributes:E,childNodes:[],isSVG:(B=e,Boolean("svg"===B.tagName||B.ownerSVGElement)||void 0),needBlock:w,rootId:S,isCustom:N}}(e,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:v,inlineImages:g,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,n=t.maskTextFn,s=t.rootId,o=gu.parentNode(e),a=o&&o.tagName,l=gu.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if(Wu(o.sheet));else if(null==(r=o.sheet)?void 0:r.cssRules){var d=Ju(o.sheet);d&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(d)&&(l=d)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}l=fc(l,Lc(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=n?n(l,gu.parentElement(e)):l.replace(/[\S]/g,"*")),{type:nu.Text,textContent:l||"",isStyle:u,rootId:s}}(e,{doc:r,needsMask:s,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:nu.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:nu.Comment,textContent:gu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,inlineStylesheet:d,maskInputOptions:p,maskTextFn:_,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,keepIframeSrcFn:D,newlyAddedElement:B});if(!Q)return console.warn(e,"not serialized"),null;G=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===nu.Comment)return!0;if(e.type===nu.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e,t){var r,i;try{i=new URL(e,window.location.href)}catch(e){return null}var n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==n?void 0:n[1])&&void 0!==r?r:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Uc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Uc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Uc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Uc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Uc(e.attributes.property).match(/^(og|twitter|fb):/)||Uc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Uc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Uc(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Uc(e.attributes.name))||Uc(e.attributes.property).match(/^article:/)||Uc(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Uc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===nu.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?xc:Ic();var K=Object.assign(Q,{id:G});if(i.add(e,K),G===xc)return null;x&&x(e);var Z=!u;if(K.type===nu.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=gu.shadowRoot(e);Y&&Qu(Y)&&(K.isShadowHost=!0)}if((K.type===nu.Document||K.type===nu.Element)&&Z){y.headWhitespace&&K.type===nu.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:_,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onIframeListenerRegistered:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W};if(K.type===nu.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(gu.childNodes(e))){var ee=jc(X,J);ee&&K.childNodes.push(ee)}var te=null;if(ju(e)&&(te=gu.shadowRoot(e)))for(var re of Array.from(gu.childNodes(te))){var ie=jc(re,J);ie&&(Qu(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var ne=gu.parentNode(e);if(ne&&Gu(ne)&&Qu(ne)&&(K.isShadow=!0),K.type===nu.Element&&"iframe"===K.tagName){var se=function(e,t,r){var i,n=()=>{},s=e.contentWindow;if(!s)return n;try{i=s.document.readyState}catch(e){return n}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),qc(e,"load",c),e.addEventListener("load",o),t())},c=()=>u();return l=setTimeout(u,r),e.addEventListener("load",c),()=>{null!==l&&(clearTimeout(l),l=null),a?qc(e,"load",o):(a=!0,qc(e,"load",c))}}var d,h="about:blank";try{d=s.location.href}catch(e){return n}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),qc(e,"load",o)}}return e.addEventListener("load",o),()=>{qc(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&I){var r=jc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:_,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onIframeListenerRegistered:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W});r&&I(e,r)}}),R);null==P||P(e,se)}return K.type===nu.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!Hc.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,g=!1,b=()=>{if(!g){g=!0;try{(()=>{if(F){var t=jc(e,{doc:r,mirror:i,blockClass:n,blockSelector:s,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:_,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:T,preserveWhiteSpace:j,onSerialize:x,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:W});t&&F(e,t)}})()}finally{Hc.delete(t),h.abort()}}},w=setTimeout(b,u);h.signal.addEventListener("abort",(()=>clearTimeout(w)),{once:!0}),t.addEventListener("load",b,{signal:h.signal,once:!0}),Hc.set(t,h)}}}(e,0,A),K}function Gc(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}class Qc{constructor(){Yl(this,"parentElement",null),Yl(this,"parentNode",null),Yl(this,"ownerDocument"),Yl(this,"firstChild",null),Yl(this,"lastChild",null),Yl(this,"previousSibling",null),Yl(this,"nextSibling",null),Yl(this,"ELEMENT_NODE",1),Yl(this,"TEXT_NODE",3),Yl(this,"nodeType"),Yl(this,"nodeName"),Yl(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Qc))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Kc(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>Zc(r,e,t,i)}function Zc(e,t,r,i){Yc((()=>{var n=e.removeEventListener;"function"==typeof n&&(void 0!==i?n.call(e,t,r,i):n.call(e,t,r))}))}function Yc(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var Jc="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",Xc={map:{},getId(){return console.error(Jc),-1},getNode(){return console.error(Jc),null},removeNodeFromMap(){console.error(Jc)},has(){return console.error(Jc),!1},reset(){console.error(Jc)}};function ed(e,t,r){void 0===r&&(r={});var i=null,n=0;return function(){for(var s=arguments.length,o=new Array(s),a=0;s>a;a++)o[a]=arguments[a];var l=Date.now();n||!1!==r.leading||(n=l);var u=t-(l-n),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),n=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{n=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function td(e,t,r,i,n){void 0===n&&(n=window);var s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),s&&s.set){if(s.get)try{s.get.call(this)}catch(e){return}s.set.call(this,e)}}}),()=>td(e,t,s||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Xc=new Proxy(Xc,{get(e,t,r){return"map"===t&&console.error(Jc),Reflect.get(e,t,r)}}));var rd=Date.now;function id(e){var t,r,i,n,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=gu.parentElement(s.body))?void 0:t.scrollLeft)||(null==(r=null==s?void 0:s.body)?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(i=gu.parentElement(s.body))?void 0:i.scrollTop)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollTop)||0}}function nd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function sd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function od(e){return e?e.nodeType===e.ELEMENT_NODE?e:gu.parentElement(e):null}function ad(e,t,r,i){if(!e)return!1;var n=od(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(i&&null!==n.closest("."+t))return!0}else if(Nc(n,t,i))return!0}catch(e){}if(r){if(n.matches(r))return!0;if(i&&null!==n.closest(r))return!0}return!1}function ld(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===xc}function ud(e,t){if(Gu(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=gu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||ud(i,t))}function cd(e){return Boolean(e.changedTouches)}function dd(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function hd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function pd(e){return!!e&&(e instanceof Qc&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(gu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(rd=()=>(new Date).getTime());class _d{constructor(){Yl(this,"id",1),Yl(this,"styleIDMap",new WeakMap),Yl(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function vd(e){var t,r=null;return"getRootNode"in e&&(null==(t=gu.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&gu.host(gu.getRootNode(e))&&(r=gu.host(gu.getRootNode(e))),r}function gd(e){var t=e.ownerDocument;return!!t&&(gu.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=vd(r);)r=t;return r}(e);return gu.contains(t,r)}(e))}function fd(e){return"__ln"in e}class md{constructor(){Yl(this,"length",0),Yl(this,"head",null),Yl(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&fd(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&fd(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}var yd,bd=(e,t)=>e+"@"+t;class Sd{constructor(){Yl(this,"frozen",!1),Yl(this,"locked",!1),Yl(this,"texts",[]),Yl(this,"attributes",[]),Yl(this,"attributeMap",new WeakMap),Yl(this,"generatedAttributes",new WeakMap),Yl(this,"removes",[]),Yl(this,"mapRemoves",[]),Yl(this,"movedMap",{}),Yl(this,"addedSet",new Set),Yl(this,"movedSet",new Set),Yl(this,"droppedSet",new Set),Yl(this,"removesSubTreeCache",new Set),Yl(this,"mutationCb"),Yl(this,"blockClass"),Yl(this,"blockSelector"),Yl(this,"maskTextClass"),Yl(this,"maskTextSelector"),Yl(this,"inlineStylesheet"),Yl(this,"maskInputOptions"),Yl(this,"maskTextFn"),Yl(this,"maskInputFn"),Yl(this,"maskAllElementAttributes"),Yl(this,"maskAttributeFn"),Yl(this,"keepIframeSrcFn"),Yl(this,"recordCanvas"),Yl(this,"canvasMaskingConfigured"),Yl(this,"inlineImages"),Yl(this,"slimDOMOptions"),Yl(this,"dataURLOptions"),Yl(this,"doc"),Yl(this,"mirror"),Yl(this,"iframeManager"),Yl(this,"stylesheetManager"),Yl(this,"shadowDomManager"),Yl(this,"canvasManager"),Yl(this,"processedNodeManager"),Yl(this,"unattachedDoc"),Yl(this,"canvasManagerReleased",!1),Yl(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),Yl(this,"emit",(()=>{if(!this.frozen&&!this.locked){var e,t,r=mu(),i=wu();try{this.processBufferedMutations()}finally{e=mu()-r,t=i,Cu>0||ku(e,null!=t?t:yu)||e>Lu.slowestBatchMs&&(Lu.slowestBatchMs=e)}}})),Yl(this,"processBufferedMutations",(()=>{for(var e=[],t=new Set,r=new md,i=e=>{for(var t=e,r=xc;r===xc;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var s=gu.parentNode(n);if(s&&gd(n)&&"TEXTAREA"!==s.tagName){var o=Gu(s)?this.mirror.getId(vd(n)):this.mirror.getId(s),a=i(n);if(-1===o||-1===a)return r.addNode(n);var l=jc(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:e=>{dd(e,this.mirror)&&this.iframeManager.addIframe(e),hd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),pd(e)&&!ad(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(gu.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});l&&(e.push({parentId:o,nextId:a,node:l}),t.add(l.id))}};this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(var s of this.movedSet)kd(this.removesSubTreeCache,s)&&!this.movedSet.has(gu.parentNode(s))||n(s);for(var o of this.addedSet)Cd(this.droppedSet,o)||kd(this.removesSubTreeCache,o)?Cd(this.movedSet,o)?n(o):this.droppedSet.add(o):n(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(gu.parentNode(a.value)),c=i(a.value);-1!==u&&-1!==c&&(l=a)}if(!l)for(var d=r.tail;d;){var h=d;if(d=d.previous,h){var p=this.mirror.getId(gu.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var _=gu.parentNode(h.value);if(_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var v=gu.host(_);if(-1!==this.mirror.getId(v)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),n(l.value)}var g={texts:this.texts.map((e=>{var t=e.node,r=gu.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{var t,r=e.attributes;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof r.style){var i=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);r.style.length>i.length&&(i+n).split("var(").length===r.style.split("var(").length&&(r.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var s of Object.entries(r)){var o=s[0],a=s[1];"string"!=typeof a&&null!==a||(r[o]=cc({element:e.node,name:o,value:a,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null==(t=this.generatedAttributes.get(e.node))?void 0:t.has(o)}))}return{id:this.mirror.getId(e.node),attributes:r}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(g.texts.length||g.attributes.length||g.removes.length||g.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(g))})),Yl(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),Yl(this,"genTextAreaValueMutation",(e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(gu.childNodes(e),(e=>gu.textContent(e)||"")).join("");t.attributes.value=ac({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:hc(e),value:r,maskInputFn:this.maskInputFn})})),Yl(this,"processMutation",(e=>{var t;if(!ld(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var r=gu.textContent(e.target);ad(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue||this.texts.push({value:Bc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,od(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break;case"attributes":var i,n=e.target,s=e.attributeName,o=null!==(i=e.attributeNamespace)&&void 0!==i?i:null,a=function(e,t,r){if(!r)return t;var i=e.getAttributeNodeNS(r,t);if(i)return i.name;if("http://www.w3.org/1999/xlink"===r)return"xlink:"+t;if("http://www.w3.org/XML/1998/namespace"===r)return"xml:"+t;if("http://www.w3.org/2000/xmlns/"===r)return"xmlns"===t?t:"xmlns:"+t;var n=e.lookupPrefix(r);return n?n+":"+t:t}(n,s,o),l=o?n.getAttributeNS(o,s):e.target.getAttribute(s);if("value"===a){var u=n,c=hc(u);l=ac({element:u,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:c,value:l,maskInputFn:this.maskInputFn})}if(ad(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;var d=this.attributeMap.get(e.target),h="IFRAME"===n.tagName&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===a&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Dc(n.tagName,a)){var p=Oc(this.doc,lc(n.tagName),lc(a),l,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(l)&&(a="rr_src"),d.attributes[a]=p,null==(t=this.generatedAttributes.get(e.target))||t.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}var _=this.unattachedDoc.createElement("span"),v=n.style;for(var g of(e.oldValue&&(_.style.cssText=e.oldValue),Array.from(v))){var f=v.getPropertyValue(g),m=v.getPropertyPriority(g);f!==_.style.getPropertyValue(g)||m!==_.style.getPropertyPriority(g)?d.styleDiff[g]=""===m?f:[f,m]:d._unchangedStyles[g]=[f,m]}for(var y of Array.from(_.style))""===v.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===a&&"DIALOG"===n.tagName){d.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";var b=this.generatedAttributes.get(e.target);b||this.generatedAttributes.set(e.target,b=new Set),b.add("rr_open_mode")}}break;case"childList":if(ad(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{var r=this.mirror.getId(t),i=Gu(e.target)?this.mirror.getId(gu.host(e.target)):this.mirror.getId(e.target);ad(e.target,this.blockClass,this.blockSelector,!1)||ld(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(wd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||ud(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[bd(r,i)]?wd(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!Gu(e.target)||!Qu(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),gu.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),Yl(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ld(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[bd(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ad(e,this.blockClass,this.blockSelector,!1)||(gu.childNodes(e).forEach((e=>this.genAdds(e))),pd(e)&&gu.childNodes(gu.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]})),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift())}}function wd(e,t){for(var r=[t];r.length;){var i=r.pop();e.delete(i),gu.childNodes(i).forEach((e=>r.push(e)))}}function kd(e,t,r){return 0!==e.size&&function(e,t,r){var i=gu.parentNode(t);return!!i&&e.has(i)}(e,t)}function Cd(e,t){if(0===e.size)return!1;for(var r=gu.parentNode(t);r;){if(e.has(r))return!0;r=gu.parentNode(r)}return!1}var Ed=function(e,t){return void 0===t&&(t="rrweb"),yd?function(){try{return e(...arguments)}catch(e){if(yd&&!0===yd(e,t))return;throw e}}:e},Td=[];function xd(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function Id(e,t){var r,i=new Sd;i.init(e);try{r=new(_u())(Ed(i.processMutations.bind(i)));var n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),r.observe(t,n),Td.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function Md(e){var t=e.scrollCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=xd(e);if(o&&!ad(o,n,s,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=id(r.defaultView);l=d.left,u=d.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(c)!==h&&(a.set(c,h),t({id:c,x:l,y:u}))}},u=[Kc("scroll",Ed(ed(Ed((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(Kc("scrollend",Ed(l),r)),()=>u.forEach((e=>e()))}function Rd(e,t){for(var r=Td.length-1;r>=0;r--){var i=Td[r];if(i){var n=i.bufferBelongsToIframe(e);!n&&t&&t.has(i.bufferDoc())&&(n=!0),n&&(i.reset(),Td.splice(r,1))}}}var Pd=["INPUT","TEXTAREA","SELECT"],Fd=new WeakMap;function Ld(e){return function e(t,r){if(Bd("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Bd("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Bd("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Bd("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var n=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(n)}return r}(e,[])}function Ad(e,t,r){var i,n;return e?(e.ownerNode?i=t.getId(e.ownerNode):n=r.getId(e),{styleId:n,id:i}):{}}var Od=5e3;function Dd(e,t){var r,i,n,s,o=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:gu.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(n=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:n.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var t,r;try{r=null==(t=l.set)?void 0:t.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{o.adoptStyleSheets(e,s)}catch(e){}return r}}),Ed((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function Nd(e,t){void 0===t&&(t={});var r,i,n=e.doc.defaultView;if(!n)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,n=e.mouseInteractionCb,s=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,c=e.styleDeclarationCb,d=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,_=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),n(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),s(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),c(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),d(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),_(...arguments)}}(e,t);var s,o,a,l,u,c,d,h,p=[],_=Ed((()=>{if(i){i.destroy(),i.reset();var t=Td.indexOf(i);-1!==t&&Td.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect(),p.forEach((e=>e()))}));try{if(e.recordDOM){var g=Id(e,e.doc);r=g.observer,i=g.buffer}if(p.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,n=e.mirror;if(!1===r.mousemove)return()=>{};var s,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=ed(Ed((e=>{var r=Date.now()-s;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],s=null})),a),c=Ed(ed(Ed((e=>{var t=xd(e),r=cd(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;s||(s=rd()),l.push({x:i,y:o,id:n.getId(t),timeOffset:rd()-s}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?Xl.Drag:e instanceof MouseEvent?Xl.MouseMove:Xl.TouchMove)})),o,{trailing:!1})),d=[Kc("mousemove",c,i),Kc("touchmove",c,i),Kc("drag",c,i)];return Ed((()=>{d.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.sampling;if(!1===o.mouseInteraction)return()=>{};var a=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,l=[],u=null;return Object.keys(eu).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{var o=lc(e),a=(e=>r=>{var o=xd(r);if(!ad(o,n,s,!0)){var a=null,l=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=tu.Mouse;break;case"touch":a=tu.Touch;break;case"pen":a=tu.Pen}a===tu.Touch&&(eu[e]===eu.MouseDown?l="TouchStart":eu[e]===eu.MouseUp&&(l="TouchEnd"))}else cd(r)&&(a=tu.Touch);null!==a?(u=a,(l.startsWith("Touch")&&a===tu.Touch||l.startsWith("Mouse")&&a===tu.Mouse)&&(a=null)):eu[e]===eu.Click&&(a=u,u=null);var c=cd(r)?r.changedTouches[0]:r;if(c){var d=i.getId(o),h=c.clientX,p=c.clientY;Ed(t)(v({type:eu[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))}}})(e);if(window.PointerEvent)switch(eu[e]){case eu.MouseDown:case eu.MouseUp:o=o.replace("mouse","pointer");break;case eu.TouchStart:case eu.TouchEnd:return}l.push(Kc(o,a,r))})),Ed((()=>{l.forEach((e=>e()))}))}(e)),p.push(Md(e)),p.push(function(e,t){var r=e.viewportResizeCb,i=t.win,n=-1,s=-1;return Kc("resize",Ed(ed(Ed((()=>{var e=nd(),t=sd();n===e&&s===t||(r({width:Number(t),height:Number(e)}),n=e,s=t)})),200)),i)}(e,{win:n})),p.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,n=e.blockClass,s=e.blockSelector,o=e.ignoreClass,a=e.ignoreSelector,l=e.maskInputOptions,u=e.maskInputFn,c=e.userTriggeredOnInput;function d(e){var t=xd(e),i=e.isTrusted,d=r.defaultView;if(!t||!d||t instanceof d.HTMLElement){var p=t&&t.tagName;if(t&&"OPTION"===p&&(t=gu.parentElement(t)),t&&p&&Pd.indexOf(p)>=0&&!ad(t,n,s,!0)&&!(t.classList.contains(o)||a&&t.matches(a))){var _=t.value,v=!1,g=hc(t)||"";"radio"===g||"checkbox"===g?v=t.checked:(l[p.toLowerCase()]||l[g])&&(_=ac({element:t,maskInputOptions:l,tagName:p,type:g,value:_,maskInputFn:u})),h(t,c?{text:_,isChecked:v,userTriggered:i}:{text:_,isChecked:v});var f=t.name;"radio"===g&&f&&v&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;h(e,c?{text:r,isChecked:!v,userTriggered:!1}:{text:r,isChecked:!v})}}))}}}function h(e,r){var n=Fd.get(e);if(!n||n.text!==r.text||n.isChecked!==r.isChecked){Fd.set(e,r);var s=i.getId(e);Ed(t)(v({},r,{id:s}))}}var p=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>Kc(e,Ed(d),r))),_=r.defaultView;if(!_)return()=>{p.forEach((e=>e()))};var g=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]].map((e=>td(e[0],e[1],{set(){Ed(d)({target:this,isTrusted:!1})}},!1,_)))),Ed((()=>{p.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,n=e.mirror,s=e.sampling,o=e.doc,a=Ed((e=>ed(Ed((s=>{var o=xd(s);if(o&&!ad(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,c=o.playbackRate,d=o.loop;t({type:e,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),s.media||500))),l=[Kc("play",a(iu.Play),o),Kc("pause",a(iu.Pause),o),Kc("seeked",a(iu.Seeked),o),Kc("volumechange",a(iu.VolumeChange),o),Kc("ratechange",a(iu.RateChange),o)];return Ed((()=>{l.forEach((e=>e()))}))}(e)),e.recordDOM){var f=function(e){var t=new Map,r=new Set,i=!0,n=e=>{if(i)try{e()}catch(e){}},s=e=>{var r,i=t.get(e);if(i){for(;null==(r=i[0])?void 0:r.ready;){var s=i.shift();(null==s?void 0:s.emit)&&n(s.emit)}0===i.length&&t.delete(e)}};return{queueMutation(e,r){if(e){var i=t.get(e);i?(i.push({emit:r,ready:!0}),s(e)):n(r)}else n(r)},queuePendingMutation(o,a,l){if(!i)return()=>{};var u=t.get(o);u||t.set(o,u=[]);var c={emit:a,ready:!1};u.push(c);var d,h=!1,p=!1,_=()=>{h||p||(h=!0,void 0!==d&&r.delete(d),c.ready=!0,c.emit=void 0,s(o))};try{d=e.setTimeout(_,Od),h||p?e.clearTimeout(d):r.add(d)}catch(e){_()}return t=>{!p&&i&&(p=!0,void 0!==d&&(e.clearTimeout(d),r.delete(d)),h?t&&n(l):(c.ready=!0,t||(c.emit=void 0),s(o)))}},reset(){i=!1,r.forEach((t=>e.clearTimeout(t))),r.clear(),t.clear()}}}(n);p.push(f.reset),p.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,n=e.stylesheetManager,s=t.win,o=t.mutationQueue;if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};var a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Ad(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,adds:[{rule:a,index:l}]}))),l}),"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),s.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,c=s.CSSStyleSheet.prototype.deleteRule;s.CSSStyleSheet.prototype.deleteRule=new Proxy(c,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Ad(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,removes:[{index:a}]}))),l}),"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(l=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;n.onCssomSheetMutation(t);var c=Ad(t,i,n.styleMirror),d=c.id,h=c.styleId;if(!(d&&-1!==d||h&&-1!==h))return l;var p=o.queuePendingMutation(t,(()=>r({id:d,styleId:h,replace:a})),(()=>{var e=Ju(t);null!==e&&r({id:d,styleId:h,replace:e})}));try{u.call(l,(()=>p(!0)),(()=>p(!1)))}catch(e){p(!1)}}catch(e){}return l}),"host")})),s.CSSStyleSheet.prototype.replaceSync&&(u=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t);var u=Ad(t,i,n.styleMirror),c=u.id,d=u.styleId;return(c&&-1!==c||d&&-1!==d)&&o.queueMutation(t,(()=>r({id:c,styleId:d,replaceSync:a}))),l}),"host")}));var d={};qd("CSSGroupingRule")?d.CSSGroupingRule=s.CSSGroupingRule:(qd("CSSMediaRule")&&(d.CSSMediaRule=s.CSSMediaRule),qd("CSSConditionRule")&&(d.CSSConditionRule=s.CSSConditionRule),qd("CSSSupportsRule")&&(d.CSSSupportsRule=s.CSSSupportsRule));var h={};return Object.entries(d).forEach((e=>{var t=e[0],s=e[1];h[t]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t.parentStyleSheet);var u=Ad(t.parentStyleSheet,i,n.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...Ld(t),l];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,adds:[{rule:a,index:h}]})))}return l}),"host")}),s.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Ed(((e,t,s)=>{var a=s[0],l=e.apply(t,s);n.onCssomSheetMutation(t.parentStyleSheet);var u=Ad(t.parentStyleSheet,i,n.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...Ld(t),a];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,removes:[{index:h}]})))}return l}),"host")})})),Ed((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=c,l&&(s.CSSStyleSheet.prototype.replace=l),u&&(s.CSSStyleSheet.prototype.replaceSync=u),Object.entries(d).forEach((e=>{var t=e[0],r=e[1];r.prototype.insertRule=h[t].insertRule,r.prototype.deleteRule=h[t].deleteRule}))}))}(e,{win:n,mutationQueue:f})),p.push(Dd(e,e.doc)),p.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,n=e.ignoreCSSAttributes,s=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:Ed(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2],h=e.apply(t,o);if(n.has(u))return h;var p=null==(l=t.parentRule)?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);var _=Ad(p,i,s.styleMirror),v=_.id,g=_.styleId;if(v&&-1!==v||g&&-1!==g){var f=Ld(t.parentRule);a.queueMutation(p,(()=>r({id:v,styleId:g,set:{property:u,value:c,priority:d},index:f})))}return h}),"host")});var u=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:Ed(((e,t,o)=>{var l,u=o[0],c=e.apply(t,o);if(n.has(u))return c;var d=null==(l=t.parentRule)?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);var h=Ad(d,i,s.styleMirror),p=h.id,_=h.styleId;if(p&&-1!==p||_&&-1!==_){var v=Ld(t.parentRule);a.queueMutation(d,(()=>r({id:p,styleId:_,remove:{property:u},index:v})))}return c}),"host")}),Ed((()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u}))}(e,{win:n,mutationQueue:f})),e.collectFonts&&p.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var n=[],s=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=vu(r.fonts,"add",(function(e){return function(r){return setTimeout(Ed((()=>{var e=s.get(r);e&&(t(e),s.delete(r))})),0),e.apply(this,[r])}}));return n.push((()=>{i.FontFace=o})),n.push(a),Ed((()=>{n.forEach((e=>e()))}))}(e))}for(var m of(p.push((o=(s=e).doc,a=s.mirror,l=s.blockClass,u=s.blockSelector,c=s.selectionCb,d=!0,(h=Ed((()=>{var e=o.getSelection();if(!(!e||d&&(null==e?void 0:e.isCollapsed))){d=e.isCollapsed||!1;for(var t=[],r=e.rangeCount||0,i=0;r>i;i++){var n=e.getRangeAt(i),s=n.startContainer,h=n.startOffset,p=n.endContainer,_=n.endOffset;ad(s,l,u,!0)||ad(p,l,u,!0)||t.push({start:a.getId(s),startOffset:h,end:a.getId(p),endOffset:_})}c({ranges:t})}})))(),Kc("selectionchange",h))),p.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?vu(r.customElements,"define",(function(e){return function(r,i,n){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,n])}})):()=>{}}(e)),e.plugins))p.push(m.observer(m.callback,n,m.options))}catch(e){try{_()}catch(e){}throw e}return _}function Bd(e){return void 0!==window[e]}function qd(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Hd{constructor(e){Yl(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Yl(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var n=r||this.getRemoteIdToLocalIdMap(e),s=i||this.getLocalIdToRemoteIdMap(e),o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),s.set(o,t)),o}getIds(e,t){var r=this.getRemoteIdToLocalIdMap(e),i=this.getLocalIdToRemoteIdMap(e);return t.map((t=>this.getId(e,t,r,i)))}getRemoteId(e,t,r){var i;return"number"!=typeof t||0>t?t:null!==(i=(r||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==i?i:-1}getRemoteIds(e,t){var r=this.getLocalIdToRemoteIdMap(e);return t.map((t=>this.getRemoteId(e,t,r)))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){var t=this.iframeRemoteIdToLocalIdMap.get(e);return t||this.iframeRemoteIdToLocalIdMap.set(e,t=new Map),t}getLocalIdToRemoteIdMap(e){var t=this.iframeLocalIdToRemoteIdMap.get(e);return t||this.iframeLocalIdToRemoteIdMap.set(e,t=new Map),t}}class $d{constructor(e){Yl(this,"iframes",new WeakMap),Yl(this,"crossOriginIframeMap",new WeakMap),Yl(this,"crossOriginIframeMirror",new Hd(Ic)),Yl(this,"crossOriginIframeStyleMirror"),Yl(this,"crossOriginIframeRootIdMap",new WeakMap),Yl(this,"mirror"),Yl(this,"mutationCb"),Yl(this,"wrappedEmit"),Yl(this,"loadListener"),Yl(this,"pageHideListener"),Yl(this,"stylesheetManager"),Yl(this,"recordCrossOriginIframes"),Yl(this,"messageHandler"),Yl(this,"nestedIframeListeners",new Map),Yl(this,"attachedWindows",new WeakMap),Yl(this,"attachedDocuments",new WeakMap),Yl(this,"attachedIframes",new Map),Yl(this,"loadListenerDisposers",new WeakMap),Yl(this,"iframeElementsById",new Map),Yl(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Hd(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null==(i=this.attachedIframes.get(e))?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach((e=>Yc(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{Zc(e.win,"pagehide",e.handler)})),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var n=this.attachedDocuments.get(e);n||this.attachedDocuments.set(e,n=new Set),n.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var s=e.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){var o=this.handleMessage.bind(this);Yc((()=>{s.addEventListener("message",o),this.nestedIframeListeners.set(s,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(s)}))}Yc((()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var n=()=>{var t;null==(t=this.pageHideListener)||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument),e.contentWindow&&this.crossOriginIframeMap.delete(e.contentWindow)};t.addEventListener("pagehide",n),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:n})}})),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){var r;switch(t.type){case Jl.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Jl.IncrementalSnapshot,data:{source:Xl.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case Jl.Meta:case Jl.Load:case Jl.DomContentLoaded:return!1;case Jl.Plugin:return t;case Jl.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Jl.IncrementalSnapshot:switch(t.data.source){case Xl.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Xl.Drag:case Xl.TouchMove:case Xl.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Xl.ViewportResize:return!1;case Xl.MediaInteraction:case Xl.MouseInteraction:case Xl.Scroll:case Xl.CanvasMutation:case Xl.Input:return this.replaceIds(t.data,e,["id"]),t;case Xl.StyleSheetRule:case Xl.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Xl.Font:return t;case Xl.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Xl.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,r,i){for(var n of i)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(r,t[n]):e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===nu.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,n=this.attachedWindows.get(r);n&&(n.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(Zc(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(Zc(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var s=this.attachedDocuments.get(r);s&&(s.forEach((e=>{Yc((()=>this.mirror.removeNodeFromMap(e)))})),Yc((()=>Rd(r,s))),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach(((t,r)=>{this.mirror.has(r)||e.push(r)})),e.forEach((e=>this.removeIframeById(e)))}}reattachIframes(){this.attachedIframes.forEach(((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)}))}destroy(){this.recordCrossOriginIframes&&Zc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{Zc(t,"message",e)})),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach((t=>e.add(t))),this.attachedIframes.forEach((t=>e.add(t.element))),e.forEach((e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)})),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}}class Ud{constructor(e){Yl(this,"shadowDoms",new WeakSet),Yl(this,"mutationCb"),Yl(this,"scrollCb"),Yl(this,"bypassOptions"),Yl(this,"mirror"),Yl(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var r,i;if(Qu(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var n=null!==(r=null==(i=gu.host(e))?void 0:i.ownerDocument)&&void 0!==r?r:t,s=Id(v({},this.bypassOptions,{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),o=s.observer,a=s.buffer;this.restoreHandlers.push({doc:n,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();var e=Td.indexOf(a);-1!==e&&Td.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:Md(v({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(gu.host(e))),this.restoreHandlers.push({doc:n,handler:Dd({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})}),0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push({doc:t,handler:vu(e.prototype,"attachShadow",(function(e){return function(i){var n=e.call(this,i),s=gu.shadowRoot(this);return s&&gd(this)&&r.addShadowRoot(s,t),n}}))})}reset(){this.restoreHandlers.forEach((e=>{var t=e.handler;try{t()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}}var Wd="skip-frame";function zd(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var Vd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jd="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Gd=0;64>Gd;Gd++)jd[Vd.charCodeAt(Gd)]=Gd;var Qd=new Map,Kd=(e,t,r)=>{if(e&&(Jd(e,t)||"object"==typeof e)){var i=function(e,t){var r=Qd.get(e);return r||Qd.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),n=i.indexOf(e);return-1===n&&(n=i.length,i.push(e)),n}};function Zd(e,t,r,i){if(e instanceof Array)return e.map((e=>Zd(e,t,r,i)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){var n=e.constructor.name,s=function(e){var t,r=new Uint8Array(e),i=r.length,n="";for(t=0;i>t;t+=3)n+=Vd[r[t]>>2],n+=Vd[(3&r[t])<<4|r[t+1]>>4],n+=Vd[(15&r[t+1])<<2|r[t+2]>>6],n+=Vd[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1)+"=":i%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e);return{rr_type:n,base64:s}}return e instanceof DataView?{rr_type:e.constructor.name,args:[Zd(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[Zd(e.data,t,r,i),e.width,e.height]}:Jd(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Kd(e,t,r)}:e}var Yd=(e,t,r,i)=>e.map((e=>Zd(e,t,r,i))),Jd=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(r.find((r=>e instanceof t[r])))},Xd=["webgl","webgl2"];function eh(e){return"nodeType"in e}function th(e,t,r,i){var n=[];try{if(i){var s=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return vu(i.prototype,"configure",(function(i){return function(n){var s=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!s||eh(s)&&ad(s,t,r,!0))return i.call(this,n);eh(s)&&!("__context"in s)&&(s.__context="webgpu");var o=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return i.call(this,null!==o&&n?v({},n,{usage:"number"==typeof n.usage?n.usage|o:o}):n)}}))}(e,t,r);s&&n.push(s)}var o=vu(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(n){for(var s=function(e){return"experimental-webgl"===e?"webgl":e}(n),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!ad(this,t,r,!0)&&("__context"in this||(this.__context=s),i&&Xd.includes(s)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...a])}}));n.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach((e=>e()))}}function rh(e,t,r,i,n,s,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=vu(e,l,(function(e){return function(){for(var a=arguments.length,u=new Array(a),c=0;a>c;c++)u[c]=arguments[c];var d=e.apply(this,u);if(Kd(d,s,this),this.canvas&&"tagName"in this.canvas&&!ad(this.canvas,i,n,!0)){var h=Yd(u,s,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(s){var c=td(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!ad(this.canvas,i,n,!0)&&r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(c)}};for(var c of l)u(c);return a}var ih,nh,sh,oh='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastFingerprintMap = /* @__PURE__ */ new Map();\n const transparentFingerprintMap = /* @__PURE__ */ new Map();\n const lastSentAtMap = /* @__PURE__ */ new Map();\n const PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n function hashPixels(data) {\n const view = new Uint32Array(\n data.buffer,\n data.byteOffset,\n data.byteLength >>> 2\n );\n let primaryHash = 2166136261;\n let secondaryHash = 2654435769;\n for (let i2 = 0; i2 < view.length; i2++) {\n primaryHash ^= view[i2];\n primaryHash = Math.imul(primaryHash, 16777619);\n secondaryHash ^= view[i2];\n secondaryHash = Math.imul(secondaryHash, 2246822507);\n }\n return `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n }\n function frameFingerprint(width, height, data) {\n return `${width}x${height}:${hashPixels(data)}`;\n }\n function transparentFingerprint(width, height) {\n const pixelCount = width * height;\n let hash = transparentFingerprintMap.get(pixelCount);\n if (hash === void 0) {\n hash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n transparentFingerprintMap.set(pixelCount, hash);\n }\n return `${width}x${height}:${hash}`;\n }\n const worker = self;\n let reusableCanvas = null;\n let reusableCtx = null;\n worker.onmessage = async function(e) {\n if ("resetFrameDedup" in e.data) {\n lastFingerprintMap.clear();\n return;\n }\n if ("OffscreenCanvas" in globalThis) {\n const {\n id,\n bitmap,\n width,\n height,\n displayWidth,\n displayHeight,\n dataURLOptions,\n maskRegions\n } = e.data;\n try {\n if (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n reusableCanvas = new OffscreenCanvas(width, height);\n reusableCtx = reusableCanvas.getContext("2d", {\n willReadFrequently: true\n });\n }\n const ctx = reusableCtx;\n ctx.clearRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n if (maskRegions) {\n ctx.fillStyle = "black";\n for (const region of maskRegions) {\n ctx.fillRect(region.x, region.y, region.width, region.height);\n }\n }\n const fingerprint = frameFingerprint(\n width,\n height,\n ctx.getImageData(0, 0, width, height).data\n );\n const lastFingerprint = lastFingerprintMap.get(id) ?? transparentFingerprint(width, height);\n if (fingerprint === lastFingerprint) {\n const lastSentAt = lastSentAtMap.get(id);\n const keyframeDue = maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS;\n if (!keyframeDue) {\n return worker.postMessage({ id });\n }\n }\n const blob = await reusableCanvas.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n worker.postMessage({\n id,\n type: blob.type,\n base64: encode(arrayBuffer),\n // cpu intensive\n displayWidth,\n displayHeight\n });\n lastFingerprintMap.set(id, fingerprint);\n lastSentAtMap.set(id, Date.now());\n } catch {\n worker.postMessage({ id });\n }\n } else {\n e.data.bitmap.close();\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n',ah="undefined"!=typeof self&&self.Blob&&new Blob([oh],{type:"text/javascript;charset=utf-8"});function lh(e){var t;try{if(!(t=ah&&(self.URL||self.webkitURL).createObjectURL(ah)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(oh),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class uh{constructor(e){Yl(this,"pendingCanvasMutations",new Map),Yl(this,"rafStamps",{latestId:0,invokeId:null}),Yl(this,"mirror"),Yl(this,"mutationCb"),Yl(this,"resetObservers"),Yl(this,"frozen",!1),Yl(this,"locked",!1),Yl(this,"rafIdTimestamp",null),Yl(this,"rafIdFlush",null),Yl(this,"refCount",0),Yl(this,"torndown",!1),Yl(this,"resetFrameDedup",null),Yl(this,"processMutation",((e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)}));var t=e.sampling,r=void 0===t?"all":t,i=e.win,n=e.blockClass,s=e.blockSelector,o=e.recordCanvas,a=e.dataURLOptions,l=e.resolutionScale,u=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,n,s,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,n,s,{dataURLOptions:a,resolutionScale:l,canvasMasking:u})}onFullSnapshot(){var e;null==(e=this.resetFrameDedup)||e.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){var s=this;if("OffscreenCanvas"in t){var o,a="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,l=th(t,r,i,!0),u=new Map;try{o=new lh}catch(e){return}var c=!1;o.onerror=()=>{var e;c=!0,cancelAnimationFrame(d),null==(e=o.terminate)||e.call(o),this.resetFrameDedup=null},this.resetFrameDedup=()=>{o.postMessage({resetFrameDedup:!0})},o.onmessage=e=>{var t=e.data.id;if(u.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,n=r.displayHeight;this.mutationCb({id:t,type:ru["2D"],commands:[{property:"clearRect",args:[0,0,i,n]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,n]}],displayWidth:i,displayHeight:n})}};var d,h=1e3/e,p=0,v=e=>{var l,g;c||(p&&h>e-p||(p=e,(l=[],g=e=>{try{e.querySelectorAll("canvas").forEach((e=>{ad(e,r,i,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&g(e.shadowRoot)}))}catch(e){}},g(t.document),l).forEach(function(){var e=_((function*(e){var t,r,i=s.mirror.getId(e);if(!u.get(i)&&0!==e.width&&0!==e.height){u.set(i,!0);try{if(["webgl","webgl2"].includes(e.__context)){var l=e.getContext(e.__context);if(null==(t=null==l?void 0:l.isContextLost)?void 0:t.call(l))return void u.set(i,!1);!1===(null==(r=null==l?void 0:l.getContextAttributes())?void 0:r.preserveDrawingBuffer)&&l.clear(l.COLOR_BUFFER_BIT)}var c=e.clientWidth||e.width,d=e.clientHeight||e.height,h=Math.max(1,Math.round(c*a)),p=Math.max(1,Math.round(d*a)),_=function(e,t,r,i,n,s){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return Wd}if(void 0!==o){if(!Array.isArray(o)||!o.every(zd))return Wd;var a=r/n,l=i/s;return o.filter((e=>e.width>0&&e.height>0)).map((e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}}))}}}(n.canvasMasking,e,h,p,c,d);if(_===Wd)return void u.set(i,!1);var v=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:i,bitmap:v,width:h,height:p,displayWidth:c,displayHeight:d,dataURLOptions:n.dataURLOptions,maskRegions:_},[v])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(v))};d=requestAnimationFrame(v),this.resetObservers=()=>{var e;l(),cancelAnimationFrame(d),null==(e=o.terminate)||e.call(o),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var n=th(e,t,r,!1),s=function(e,t,r,i,n){var s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=vu(t.CanvasRenderingContext2D.prototype,o,(function(s){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return ad(this.canvas,r,i,!0)||setTimeout((()=>{var r=Yd(l,t,this,n);e(this.canvas,{type:ru["2D"],property:o,args:r})}),0),s.apply(this,l)}}));s.push(a)}catch(n){var l=td(t.CanvasRenderingContext2D.prototype,o,{set(t){ad(this.canvas,r,i,!0)||e(this.canvas,{type:ru["2D"],property:o,args:[t],setter:!0})}});s.push(l)}};for(var l of o)a(l);return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,n){var s=[];return void 0!==t.WebGLRenderingContext&&s.push(...rh(t.WebGLRenderingContext.prototype,ru.WebGL,e,r,i,t,n)),void 0!==t.WebGL2RenderingContext&&s.push(...rh(t.WebGL2RenderingContext.prototype,ru.WebGL2,e,r,i,t,n)),()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{n(),s(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)})),this.rafIdFlush=requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(!this.frozen&&!this.locked){var r=this.pendingCanvasMutations.get(e);if(r&&-1!==t){var i=r.map((e=>g(e,Kl)));this.mutationCb({id:t,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(e)}}}}class ch{constructor(e){var t;Yl(this,"trackedLinkElements",new WeakSet),Yl(this,"pendingDeferredSheets",new Set),Yl(this,"mutationCb"),Yl(this,"adoptedStyleSheetCb"),Yl(this,"maskAllElementAttributes"),Yl(this,"maskAttributeFn"),Yl(this,"styleMirror",new _d),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;var r=null,i=null;try{(i=e.sheet)&&(r=sc(i))}catch(e){}if(!r||!i)return zu(),null;var n=r,s=!1,o={sheet:i,invalidate(){s=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,c=mu(),d=wu(),h=!0;try{if(s)return a=!0,zu(),!0;if(!n.advance(r))return h=!1,!1;a=!0;var p=n.text();if(!e.isConnected)return!0;var _=null;try{_=e.sheet}catch(e){}return _!==i?(zu(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(zu(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ku(l=mu()-c,null!=(u=d)?u:yu)||(Au.totalMs+=l,l>Au.slowestSliceMs&&(Au.slowestSliceMs=l))}},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(var t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var r;null==(r=this.beginDeferredLinkInlining(e,t))||r.advance(1/0)}emitCssTextMutation(e,t,r){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:cc({element:e,name:"_cssText",value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var i={id:t,styleIds:[]},n=[],s=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var s=r.styleMirror.add(e);t=s;var o=mu();try{$u((()=>{try{var t=e.rules||e.cssRules;t&&Hu(t)}catch(e){}n.push({styleId:s,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:Xu(t,e.href),index:r})))})}))}finally{Uu(mu()-o)}}i.styleIds.push(t)};for(var o of e)s(o);n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Hc.forEach((e=>e.abort())),Hc.clear()}trackStylesheetInLinkElement(e){}}class dh{constructor(){Yl(this,"nodeMap",new WeakMap),Yl(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}var hh=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var ph=document.createElement("iframe");document.body.appendChild(ph),Array.from=(null==(Ql=ph.contentWindow)?void 0:Ql.Array.from)||Array.from,document.body.removeChild(ph)}}catch(e){console.debug("Unable to override Array.from",e)}var _h=new oc,vh=new Set([Xl.Mutation,Xl.MediaInteraction,Xl.StyleSheetRule,Xl.CanvasMutation,Xl.Font,Xl.Log,Xl.StyleDeclaration,Xl.AdoptedStyleSheet]);function gh(e){var t=window;if("function"==typeof t.requestIdleCallback){var r=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null==(e=t.cancelIdleCallback)?void 0:e.call(t,r)}}}var i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function fh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,n=r.checkoutEveryNms,s=r.checkoutEveryNth,o=r.blockClass,a=void 0===o?"rr-block":o,l=r.blockSelector,u=void 0===l?null:l,c=r.ignoreClass,d=void 0===c?"rr-ignore":c,h=r.ignoreSelector,p=void 0===h?null:h,_=r.maskTextClass,g=void 0===_?"rr-mask":_,f=r.maskTextSelector,m=void 0===f?null:f,y=r.inlineStylesheet,b=void 0===y||y,S=r.inlineStylesheetBudgetRules,w=r.maskAllInputs,k=r.maskInputOptions,C=r.slimDOMOptions,E=r.maskInputFn,T=r.maskTextFn,x=r.maskAllElementAttributes,I=void 0!==x&&x,M=r.maskAttributeFn,R=r.hooks,P=r.packFn,F=r.sampling,L=void 0===F?{}:F,A=r.dataURLOptions,O=void 0===A?{}:A,D=r.canvasResolutionScale,N=r.canvasMasking,B=r.mousemoveWait,q=r.recordDOM,H=void 0===q||q,U=r.recordCanvas,W=void 0!==U&&U,z=r.recordCrossOriginIframes,V=void 0!==z&&z,j=r.recordAfter,G=void 0===j?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":j,Q=r.userTriggeredOnInput,K=void 0!==Q&&Q,Z=r.collectFonts,Y=void 0!==Z&&Z,J=r.inlineImages,X=void 0!==J&&J,ee=r.plugins,te=r.keepIframeSrcFn,re=void 0===te?()=>!1:te,ie=r.ignoreCSSAttributes,ne=void 0===ie?new Set([]):ie,se=r.attributeFilter;yd=r.errorHandler;var oe=v({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),ae=!V||window.parent===window,le=!1;if(!ae)try{window.parent.document&&(le=!1)}catch(e){le=!0}if(ae&&!i)throw new Error("emit function is required");if(!ae&&!le)return()=>{};void 0!==B&&void 0===L.mousemove&&(L.mousemove=B),_h.reset();var ue,ce=!0===w?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==k?k:{password:!0},de=Gc(void 0!==C&&C);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var he,pe,_e=0,ve=new Map,ge=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return P&&!le&&(e=P(e)),e};ih=(e,t)=>{var r,o=e;if(o.timestamp=rd(),!(null==(r=Td[0])?void 0:r.isFrozen())||o.type===Jl.FullSnapshot||o.type===Jl.IncrementalSnapshot&&vh.has(o.data.source)||Td.forEach((e=>e.unfreeze())),ae)null==i||i(ge(o),t);else if(le){var a={type:"rrweb",event:ge(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===Jl.FullSnapshot)ue=o,_e=0;else if(o.type===Jl.IncrementalSnapshot){if(o.data.source===Xl.Mutation&&o.data.isAttachIframe)return;_e++,(s&&_e>=s||n&&o.timestamp-ue.timestamp>n)&&nh(!0)}};var fe=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map((e=>e.node.id))):null,r=new Set;if(e.adds.length>0)for(var i of e.adds){var n=_h.getNode(i.node.id);n&&"IFRAME"===n.nodeName&&r.add(n)}e.removes.forEach((e=>{var i=e.id;if(!t||!t.has(i)){var n=Se.getIframeElementById(i);n&&r.has(n)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}})),null==pe||pe(),Se.cleanupDetachedIframes()}ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.Mutation},e)})},me=e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.Scroll},e)}),ye=e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.CanvasMutation},e)}),be=new ch({mutationCb:fe,adoptedStyleSheetCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.AdoptedStyleSheet},e)}),maskAllElementAttributes:I,maskAttributeFn:M}),Se=new $d({mirror:_h,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:ih});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:_h,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new dh,Ce=null==N?void 0:N.configured;sh=new uh({recordCanvas:W,mutationCb:ye,win:window,blockClass:a,blockSelector:u,mirror:_h,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var Ee=new Ud({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:a,blockSelector:u,maskTextClass:g,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:ce,dataURLOptions:oe,maskTextFn:T,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:M,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:de,iframeManager:Se,stylesheetManager:be,canvasManager:sh,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:se},mirror:_h});nh=function(e){if(void 0===e&&(e=!1),H){Du(S);try{ih({type:Jl.Meta,data:{href:window.location.href,width:sd(),height:nd()}},e),null==t||t.cancel(),t=void 0,be.reset(),Ee.init(),Td.forEach((e=>e.lock()));var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,n=void 0===i?new oc:i,s=r.blockClass,o=void 0===s?"rr-block":s,a=r.blockSelector,l=void 0===a?null:a,u=r.maskTextClass,c=void 0===u?"rr-mask":u,d=r.maskTextSelector,h=void 0===d?null:d,p=r.inlineStylesheet,_=void 0===p||p,v=r.inlineImages,g=void 0!==v&&v,f=r.recordCanvas,m=void 0!==f&&f,y=r.canvasMaskingConfigured,b=r.maskAllInputs,S=void 0!==b&&b,w=r.maskTextFn,k=r.maskInputFn,C=r.maskAllElementAttributes,E=void 0!==C&&C,T=r.maskAttributeFn,x=r.slimDOM,I=r.dataURLOptions,M=r.preserveWhiteSpace,R=r.onSerialize,P=r.onIframeLoad,F=r.iframeLoadTimeout,L=r.onIframeListenerRegistered,A=r.onStylesheetLoad,O=r.stylesheetLoadTimeout,D=r.keepIframeSrcFn,N=void 0===D?()=>!1:D,B=r.maxDepth,q=r.inlineStylesheetBudgetRules,H=!0===S?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===S?{password:!0}:S,U=Gc(void 0!==x&&x);Du(q);try{return jc(e,{doc:e,mirror:n,blockClass:o,blockSelector:l,maskTextClass:c,maskTextSelector:h,skipChild:!1,inlineStylesheet:_,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:E,maskAttributeFn:T,slimDOMOptions:U,dataURLOptions:I,inlineImages:g,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:R,onIframeLoad:P,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{Nu()}}(document,{mirror:_h,blockClass:a,blockSelector:u,maskTextClass:g,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:ce,inlineStylesheetBudgetRules:S,maskTextFn:T,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:M,slimDOM:de,dataURLOptions:oe,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){dd(e,_h)&&Se.addIframe(e),hd(e,_h)&&be.trackLinkElement(e),pd(e)&&Ee.addShadowRoot(gu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),Ee.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{s=Ru,Ru=[],r=s}if(!i)return console.warn("Failed to snapshot the document");if(ih({type:Jl.FullSnapshot,data:{node:i,initialOffset:id(window)}},e),Td.forEach((e=>e.unlock())),sh.onFullSnapshot(),r.length){var n=function(e,t,r){var i=!1,n=null,s=0,o=null,a=()=>null!==o||e.length>s,l=()=>{var r=e[s];e[s]=null,s+=1,r&&Yc((()=>{o=t.beginDeferredLinkInlining(r,_h.getId(r))}))},u=()=>{if(o){var e=o,t=!0;Yc((()=>{t=e.advance(200)})),t&&(o=null)}},c=e=>{if(n=null,!i){var t=0;do{try{o||l(),u()}catch(e){null==o||o.discard(),o=null,Vu(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?n=gh(c):r())}};return n=gh(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(!i){i=!0,null==n||n.cancel(),n=null;for(var t=0,c=0;a()&&50>t;){o||l();var d=o;if(d)if(Math.floor(d.remainingRules()/200)+1>50-t)d.discard(),o=null,c+=1;else{try{u()}catch(e){null==o||o.discard(),o=null,c+=1}t+=1}}if(a()||c>0){for(var h=c+(null!==o?1:0),p=s;e.length>p;p++)null!==e[p]&&(h+=1);Vu(h),null==o||o.discard(),o=null}r()}}}}(r,be,(()=>{t===n&&(t=void 0)}));t=n}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,_h.getId(document))}finally{Nu()}var s}};try{var Te=[];for(var xe of(Te.push(Kc("pagehide",(()=>{try{null==t||t.flush()}catch(e){}t=void 0}),window)),["visibilitychange","freeze","resume"]))Te.push(Kc(xe,Su,document));he=e=>{var t=ve.get(e);t&&(t.forEach((e=>{Yc(e);var t=Te.indexOf(e);-1!==t&&Te.splice(t,1)})),ve.delete(e))},pe=()=>{for(var e of ve){var t=e[0],r=_h.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==he||he(t)}catch(e){null==he||he(t)}else null==he||he(t)}};var Ie=e=>{var t;return Ed(Nd)({mutationCb:fe,mousemoveCb:(e,t)=>ih({type:Jl.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.ViewportResize},e)}),inputCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.Input},e)}),mediaInteractionCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.MediaInteraction},e)}),styleSheetRuleCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.StyleSheetRule},e)}),styleDeclarationCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.Font},e)}),selectionCb(e){ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.Selection},e)})},customElementCb(e){ih({type:Jl.IncrementalSnapshot,data:v({source:Xl.CustomElement},e)})},blockClass:a,ignoreClass:d,ignoreSelector:p,maskTextClass:g,maskTextSelector:m,maskInputOptions:ce,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:E,maskTextFn:T,maskAllElementAttributes:I,maskAttributeFn:M,keepIframeSrcFn:re,blockSelector:u,slimDOMOptions:de,dataURLOptions:oe,mirror:_h,iframeManager:Se,stylesheetManager:be,shadowDomManager:Ee,processedNodeManager:ke,canvasManager:sh,ignoreCSSAttributes:ne,attributeFilter:se,plugins:(null==(t=null==ee?void 0:ee.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>ih({type:Jl.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},R)};Se.addLoadListener((e=>{try{var t=_h.getId(e),r=Ie(e.contentDocument);if("function"==typeof r&&(Te.push(r),-1!==t)){var i=ve.get(t);i||ve.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Se.addPageHideListener((e=>{var t=_h.getId(e);null==he||he(t),Rd(e)}));var Me=-1,Re=e=>ih({type:Jl.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Pe=()=>{var e,t,r,i,n=document,s=null!==(e=null!==(t=null!==(r=null!==(i=n.fullscreenElement)&&void 0!==i?i:n.webkitFullscreenElement)&&void 0!==r?r:n.mozFullScreenElement)&&void 0!==t?t:n.msFullscreenElement)&&void 0!==e?e:null,o=s?_h.getId(s):-1;o!==Me&&(-1!==Me&&Re({id:Me,enter:!1}),Me=o,-1!==o&&Re({id:o,enter:!0}))},Fe=()=>{nh();var e=Ie(document);"function"==typeof e&&Te.push(e),Te.push(Kc("fullscreenchange",Pe)),Te.push(Kc("webkitfullscreenchange",Pe)),Te.push(Kc("mozfullscreenchange",Pe)),Te.push(Kc("MSFullscreenChange",Pe)),hh=!0};return["interactive","complete"].includes(document.readyState)?Fe():(Te.push(Kc("DOMContentLoaded",(()=>{ih({type:Jl.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()}))),Te.push(Kc("load",(()=>{ih({type:Jl.Load,data:{}}),"load"===G&&Fe()}),window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Te.forEach((e=>Yc(e))),ke.destroy(),Se.removeLoadListener(),Se.destroy(),ve.clear(),Ee.reset(),_h.reset(),hh=!1,yd=void 0}}catch(e){console.warn(e)}}fh.addCustomEvent=(e,t)=>{if(!hh)throw new Error("please add custom event after start recording");ih({type:Jl.Custom,data:{tag:e,payload:t}})},fh.freezePage=()=>{Td.forEach((e=>e.freeze()))},fh.takeFullSnapshot=e=>{if(!hh)throw new Error("please take full snapshot after start recording");nh(e)},fh.mirror=_h;var mh=Object.defineProperty,yh=(e,t,r)=>((e,t,r)=>t in e?mh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class bh{constructor(e){yh(this,"fileName"),yh(this,"functionName"),yh(this,"lineNumber"),yh(this,"columnNumber"),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}}var Sh=/(^|@)\S+:\d+/,wh=/^\s*at .*(\S+:\d+|\(native\))/m,kh=/^(eval@)?(\[native code])?$/,Ch={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(wh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter((function(e){return!!e.match(wh)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),n=this.extractLocation(r?r[1]:i.pop()),s=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0];return new bh({functionName:s,fileName:o,lineNumber:n[1],columnNumber:n[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(kh)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new bh({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,n=this.extractLocation(e.replace(t,""));return new bh({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],n=2,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new bh({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],n=0,s=r.length;s>n;n+=2){var o=t.exec(r[n]);o&&i.push(new bh({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter((function(e){return!!e.match(Sh)&&!e.match(/^Error created at/)}),this).map((function(e){var t=e.split("@"),r=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new bh({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Eh(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,n=[];if(i.children&&i.children.length>0)for(var s=0;i.children.length>s;s++){var o=i.children[s];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&n.push(o)}n.length>1&&(r+=":eq("+n.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Th(e){return Array.isArray(e)}function xh(e){return"object"==typeof e&&null!==e&&!Th(e)}function Ih(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(xh(e[i])&&Ih(e[i],t-1))return!0;return!1}function Mh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],n=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var s=i.indexOf(this);~s?i.splice(s+1):i.push(this),~s?n.splice(s,1/0,e):n.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(xh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||xh(o)&&Ih(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=Th(u)?Eh(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var Rh={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Ph(e,t,r){var i,n=r?Object.assign({},Rh,r):Rh,s=n.logger;if(!s)return()=>{};i="string"==typeof s?t[s]:s;var o=0,a=!1,l=[];if(n.level.includes("error")){var u=t=>{var r=t.message,i=Ch.parse(t.error).map((e=>e.toString())),s=[Mh(r,n.stringifyOptions)];e({level:"error",trace:i,payload:s})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[Mh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,n.stringifyOptions)]:(r=new Error,i=[Mh("Uncaught (in promise)",n.stringifyOptions),Mh(t.reason,n.stringifyOptions)]);var s=Ch.parse(r).map((e=>e.toString()));e({level:"error",trace:s,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of n.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,s,l){try{if(!(s in t))return()=>{};var u=t[s],c={next:u},d=(t=>function(){for(var s=arguments.length,l=new Array(s),u=0;s>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=Ch.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Mh(e,n.stringifyOptions)));o++,n.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===n.lengthThreshold&&e({level:"warn",trace:[],payload:[Mh("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return c.next.apply(this,t)}));return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:c}})),t[s]=d,()=>{if(t[s]!==d)for(var e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},r=t[s],i=e(r);i;){if(i.next===d)return void(i.next=c.next);i=e(r=i.next)}else t[s]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Fh=e=>({name:"rrweb/console@1",observer:Ph,options:e}),Lh=e=>"undefined"!=typeof Document&&e instanceof Document,Ah=()=>{},Oh=e=>{var t;if(Q(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function Dh(e,t,r){try{if(!(t in e))return Ah;var i={next:e[t]},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)}));return Q(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e[t],s=Oh(r);s;){if(s.next===n)return void(s.next=i.next);s=Oh(r=s.next)}else e[t]=i.next}}catch(e){return Ah}}function Nh(e,t){var r,i=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),n={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return n;for(var s of t.payloadHostDenyList)if(i.endsWith(s))return{hostname:i,isHostDenied:!0};return n}var Bh=Ur("[Recorder]"),qh=e=>"navigation"===e.entryType,Hh=e=>"resource"===e.entryType;function $h(e,t){return!!t&&(ne(t)||t[e])}function Uh(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var Wh=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function zh(e){var t=e.type,r=e.recordBody,i=e.headers;function n(e){var t=Object.keys(i).find((e=>"content-type"===e.toLowerCase())),r=t&&i[t];return e.some((e=>null==r?void 0:r.toLowerCase().includes(e)))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!Uh(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(n(Wh))return!1;if(ne(r))return!0;if(G(r))return n(r);var s=r[t];return ne(s)?s:n(s)}function Vh(e,t,r,i,n,s){return jh.apply(this,arguments)}function jh(){return jh=_((function*(e,t,r,i,n,s){if(void 0===s&&(s=0),s>10)return Bh.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var s=e.length-1;s>=0;s-=1)if(Hh(o=e[s])&&o.initiatorType===t&&(Y(i)||o.startTime>=i)&&(Y(n)||n>=o.startTime))return e[s];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*s))),Vh(e,t,r,i,n,s+1))})),jh.apply(this,arguments)}function Gh(e){var t=e.body,r=e.options,i=e.url;if(te(t))return null;var n=Nh(i,r);if(n.isHostDenied)return n.hostname+" is in deny list";if(J(t))return t;if(Lh(t))return t.textContent;if(se(t))return ii(t);if(K(t))try{return JSON.stringify(t)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}var Qh=e=>!ee(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Kh(e){var t=e.entry,r=e.method,i=e.status,n=e.networkRequest,s=e.isInitial,o=e.start,a=e.end,l=e.url,u=e.initiatorType;o=t?t.startTime:o,a=t?t.responseEnd:a;var c=Math.floor(Date.now()-performance.now()),d=Math.floor(c+(o||0)),h=[v({},t?t.toJSON():{name:l},{startTime:Y(o)?void 0:Math.round(o),endTime:Y(a)?void 0:Math.round(a),timeOrigin:c,timestamp:d,method:r,initiatorType:u||(t?t.initiatorType:void 0),status:i,requestHeaders:n.requestHeaders,requestBody:n.requestBody,responseHeaders:n.responseHeaders,responseBody:n.responseBody,isInitial:s})];if(Qh(t))for(var p of t.serverTiming||[])h.push({timeOrigin:c,timestamp:d,startTime:Math.round(t.startTime),name:p.name,duration:p.duration,entryType:"serverTiming"});return h}var Zh=["video/","audio/"];function Yh(e){return K(e)&&Q(e.getReader)&&Q(e.tee)}var Jh=500,Xh="[SessionReplay] Timeout while trying to read body",ep="[SessionReplay] Failed to read body";function tp(e){return ep+": "+e}function rp(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function ip(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(Xh)),Jh);try{e.clone().text().then((e=>t(e)),(e=>t(tp(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(ep)}}))}(e);var r=nn(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var n=parseInt(i,10);return Number.isFinite(n)&&n>t}catch(e){return!1}}(e,r)?Promise.resolve(rp(r)):function(e,t){return new Promise((r=>{var i,n=!1;function s(){try{var e;null==(e=i)||e.cancel()}catch(e){}}function o(e){n||(n=!0,clearTimeout(l),s(),r(e))}var a,l=setTimeout((()=>o(Xh)),Jh);try{a=e.clone()}catch(e){return void o(ep)}var u=a.body;if(Yh(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(ep)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(n)s();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var n of e)r.set(n,i),i+=n.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(rp(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(tp(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(tp(e))))}catch(e){o(ep)}}))}(e,r)}function np(){return np=_((function*(e){var t=e.r,r=e.options,i=Nh(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):ip(t,r)})),np.apply(this,arguments)}function sp(){return sp=_((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,n=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var s=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=Zh.some((e=>null==s?void 0:s.startsWith(e)));if(s&&o)return"Content-Type "+s+" is not supported";var a=Nh(n,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return ee(i)?ip(t,r):Promise.resolve(i)})),sp.apply(this,arguments)}var op=null;function ap(e,t,r){if(!("performance"in t))return()=>{};if(op)return Bh.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},sn,r):sn,n=t=>{var r=[],n=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!n){var s=i.maskRequestFn(e);t||(n=!s||(e=>!!e&&pn.has(e))(s)),s&&r.push(s)}})),r.length>0&&e(v({},t,{requests:r}))},s=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>qh(e)||Hh(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>Kh({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var n=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>qh(e)||Hh(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>Kh({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),s=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return n.observe({entryTypes:s}),()=>{n.disconnect()}}(n,t,i),o=()=>{},a=()=>{};return(i.recordHeaders||i.recordBody)&&(o=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=$h("request",r.recordHeaders),n=$h("response",r.recordHeaders),s=Dh(t.XMLHttpRequest.prototype,"open",(s=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,_=new Request(a),v={},g={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(g[e]=t,f(e,t)),i&&(v.requestHeaders=g);var m=d.send.bind(d);d.send=e=>(zh({type:"request",headers:g,url:a,recordBody:r.recordBody})&&(v.requestBody=Gh({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{d.removeEventListener("readystatechange",b),d.removeEventListener("error",y),d.removeEventListener("abort",y),d.removeEventListener("timeout",y)},b=()=>{if(d.readyState===d.DONE){y(),p=t.performance.now();var i={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((e=>{var t=e.split(": "),r=t.shift(),n=t.join(": ");r&&(i[r]=n)})),n&&(v.responseHeaders=i),zh({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(v.responseBody=Gh({body:d.response,options:r,url:a})),Vh(t,"xmlhttprequest",_.url,h,p).then((t=>{var r=Kh({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:v,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"});e({requests:r})})).catch((()=>{}))}};d.addEventListener("readystatechange",b),d.addEventListener("error",y),d.addEventListener("abort",y),d.addEventListener("timeout",y)}catch(e){Bh.error("Failed to instrument XHR for network capture",e)}s.call(d,o,a.toString(),l,u,c)}));return()=>{s()}}(n,t,i),a=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=$h("request",r.recordHeaders),n=$h("response",r.recordHeaders),s=Dh(t,"fetch",(s=>function(){var o=_((function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return Bh.error("Failed to instrument fetch for network capture",e),s(o,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),i&&(h.requestHeaders=p),!Yh(null==a?void 0:a.body)&&zh({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return np.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){Bh.error("Failed to record fetch request for network capture",e)}c=t.performance.now(),u=Uh(o)?yield s(l):yield s(o,a),d=t.performance.now();var _={};return u.headers.forEach(((e,t)=>{_[t]=e})),n&&(h.responseHeaders=_),zh({type:"response",headers:_,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return sp.apply(this,arguments)}({r:u,options:r,url:o})),u}finally{Vh(t,"fetch",l.url,c,d).then((t=>{var r,i=Kh({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"});e({requests:i})})).catch((()=>{}))}}));return function(e,t){return o.apply(this,arguments)}}()));return()=>{s()}}(n,t,i)),op=()=>{s(),o(),a(),op=null}}var lp=e=>({name:"rrweb/network@1",observer:ap,options:e});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Fh,getRecordNetworkPlugin:lp},h.__PosthogExtensions__.rrweb={record:fh,version:"v2",wasMaxDepthReached:()=>Vc,resetMaxDepthState(){Vc=!1,zc=!1},getLastSnapshotCost:()=>Iu,getMutationCost:()=>v({},Lu),resetSnapshotCostState(){Cu=0,Eu=0,Tu=0,yu=0,xu=fu(),Iu=null,Mu=null,Ru=[],Pu=0,Fu=0,Lu={slowestBatchMs:0},Au={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:fh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:Fh},h.getRecordNetworkPlugin=lp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Gl(e,t);var up,cp,dp,hp,pp,_p,vp,gp,fp,mp,yp,bp,Sp,wp,kp,Cp={},Ep=[],Tp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xp=Array.isArray;function Ip(e,t){for(var r in t)e[r]=t[r];return e}function Mp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Rp(e,t,r){var i,n,s,o={};for(s in t)"key"==s?i=t[s]:"ref"==s?n=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?up.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===o[s]&&(o[s]=e.defaultProps[s]);return Pp(e,o,i,n,null)}function Pp(e,t,r,i,n){var s={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++dp:n,__i:-1,__u:0};return null==n&&null!=cp.vnode&&cp.vnode(s),s}function Fp(e){return e.children}function Lp(e,t){this.props=e,this.context=t}function Ap(e,t){if(null==t)return e.__?Ap(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?Ap(e):null}function Op(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],n=[],s=Ip({},t);s.__v=t.__v+1,cp.vnode&&cp.vnode(s),Vp(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?Ap(t):r,!!(32&t.__u),n),s.__v=t.__v,s.__.__k[s.__i]=s,Gp(i,s,n),t.__e=t.__=null,s.__e!=r&&Dp(s)}}function Dp(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some((function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e})),Dp(e)}function Np(e){(!e.__d&&(e.__d=!0)&&hp.push(e)&&!Bp.__r++||pp!=cp.debounceRendering)&&((pp=cp.debounceRendering)||_p)(Bp)}function Bp(){try{for(var e,t=1;hp.length;)hp.length>t&&hp.sort(vp),e=hp.shift(),t=hp.length,Op(e)}finally{hp.length=Bp.__r=0}}function qp(e,t,r,i,n,s,o,a,l,u,c){var d,h,p,_,v,g,f,m=i&&i.__k||Ep,y=t.length;for(l=function(e,t,r,i,n){var s,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(n),s=0;n>s;s++)null!=(o=t[s])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[s]=Pp(null,o,null,null,null):xp(o)?o=e.__k[s]=Pp(Fp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[s]=Pp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[s]=o,l=s+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=$p(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(n>c?h--:c>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[s]=null;if(d)for(s=0;c>s;s++)null!=(a=r[s])&&0==(2&a.__u)&&(a.__e==i&&(i=Ap(a)),Zp(a,a));return i}(r,t,m,l,y),d=0;y>d;d++)null!=(p=r.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Cp,p.__i=d,g=Vp(e,p,h,n,s,o,a,l,u,c),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&Kp(h.ref,null,p),c.push(p.ref,p.__c||_,p)),null==v&&null!=_&&(v=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=Hp(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==g?l=g:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=v,l}function Hp(e,t,r,i){var n,s;if("function"==typeof e.type){for(n=e.__k,s=0;n&&n.length>s;s++)n[s]&&(n[s].__=e,t=Hp(n[s],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=Ap(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function $p(e,t,r,i){var n,s,o,a=e.key,l=e.type,u=t[r],c=null!=u&&0==(2&u.__u);if(null===u&&null==a||c&&a==u.key&&l==u.type)return r;if(i>(c?1:0))for(n=r-1,s=r+1;n>=0||t.length>s;)if(null!=(u=t[o=0>n?s++:n--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Up(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Tp.test(t)?r:r+"px"}function Wp(e,t,r,i,n){var s,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||Up(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Up(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(yp,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?i?r[mp]=i[mp]:(r[mp]=bp,e.addEventListener(t,s?wp:Sp,s)):e.removeEventListener(t,s?wp:Sp,s);else{if("http://www.w3.org/2000/svg"==n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function zp(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[fp])t[fp]=bp++;else if(r[mp]>t[fp])return;return r(cp.event?cp.event(t):t)}}}function Vp(e,t,r,i,n,s,o,a,l,u){var c,d,h,p,_,v,g,f,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(c=cp.__b)&&c(t);e:if("function"==typeof E){d=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(c=E.contextType)&&i[c.__c],b=c?$?$.props.value:c.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new Lp(m,b),h.constructor=E,h.render=Yp),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Ip({},h.__s)),Ip(h.__s,E.getDerivedStateFromProps(m,h.__s))),_=h.props,v=h.state,h.__v=t,p)y&&null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some((function(e){e&&(e.__=t)})),Ep.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push((function(){h.componentDidUpdate(_,v,g)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=cp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),Ep.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Ip(Ip({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(g=h.getSnapshotBeforeUpdate(_,v)),k=null!=c&&c.type===Fp&&null==c.key?Qp(c.props.children):c,a=qp(e,xp(k)?k:[k],t,r,i,n,s,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=s&&(s[s.indexOf(a)]=null),t.__e=a}else{if(null!=s)for(C=s.length;C--;)Mp(s[C]);jp(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||jp(t);cp.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,n,s,o,a,l){var u,c,d,h,p,_,v,g=r.props||Cp,f=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=s)for(u=0;s.length>u;u++)if((p=s[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,s[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(n,m,f.is&&f),a&&(cp.__m&&cp.__m(t,s),a=!1),s=null}if(null==m)g===f||a&&e.data==f||(e.data=f);else{if(s="textarea"==m&&null!=f.defaultValue?null:s&&up.call(e.childNodes),!a&&null!=s)for(g={},u=0;e.attributes.length>u;u++)g[(p=e.attributes[u]).name]=p.value;for(u in g)p=g[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||Wp(e,u,null,p,n);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?_=p:"checked"==u?v=p:a&&"function"!=typeof p||g[u]===p||Wp(e,u,p,g[u],n);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),qp("template"==t.type?e.content:e,xp(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,s,o,s?s[0]:r.__k&&Ap(r,0),a,l),null!=s)for(u=s.length;u--;)Mp(s[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=g[u])&&Wp(e,u,_,g[u],n),u="checked",null!=v&&v!=e[u]&&Wp(e,u,v,g[u],n))}return e}(r.__e,t,r,i,n,s,o,l,u);return(c=cp.diffed)&&c(t),128&t.__u?void 0:a}function jp(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(jp))}function Gp(e,t,r){for(var i=0;r.length>i;i++)Kp(r[i],r[++i],r[++i]);cp.__c&&cp.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){cp.__e(e,t.__v)}}))}function Qp(e){return"object"!=typeof e||null==e||e.__b>0?e:xp(e)?e.map(Qp):void 0!==e.constructor?null:Ip({},e)}function Kp(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){cp.__e(e,r)}}function Zp(e,t,r){var i,n;if(cp.unmount&&cp.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Kp(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){cp.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(n=0;i.length>n;n++)i[n]&&Zp(i[n],t,r||"function"!=typeof e.type);r||Mp(e.__e),e.__c=e.__=e.__e=void 0}function Yp(e,t,r){return this.constructor(e,r)}function Jp(e,t,r){var i,n,s;t==document&&(t=document.documentElement),cp.__&&cp.__(e,t),i=t.__k,n=[],s=[],Vp(t,e=t.__k=Rp(Fp,null,[e]),i||Cp,Cp,t.namespaceURI,i?null:t.firstChild?up.call(t.childNodes):null,n,i?i.__e:t.firstChild,!1,s),Gp(n,e,s),e.props.children=null}up=Ep.slice,cp={__e(e,t,r,i){for(var n,s,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&null!=s.getDerivedStateFromError&&(n.setState(s.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,i||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},dp=0,Lp.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Ip({},this.state),"function"==typeof e&&(e=e(Ip({},r),this.props)),e&&Ip(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Np(this))},Lp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Np(this))},Lp.prototype.render=Fp,hp=[],_p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,vp=function(e,t){return e.__v.__b-t.__v.__b},Bp.__r=0,gp=Math.random().toString(8),fp="__d"+gp,mp="__a"+gp,yp=/(PointerCapture)$|Capture$/i,bp=0,Sp=zp(!1),wp=zp(!0),kp=0;var Xp,e_,t_,r_,i_=0,n_=[],s_=cp,o_=s_.__b,a_=s_.__r,l_=s_.diffed,u_=s_.__c,c_=s_.unmount,d_=s_.__;function h_(e,t){s_.__h&&s_.__h(e_,e,i_||t),i_=0;var r=e_.__H||(e_.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function p_(e){return i_=1,function(e,t,r){var i=h_(Xp++,2);if(i.t=e,!i.__c&&(i.__=[C_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],r=i.t(t,e);t!==r&&(i.__N=[r,i.__[1]],i.__c.setState({}))}],i.__c=e_,!e_.__f)){var n=function(e,t,r){if(!i.__c.__H)return!0;var n=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),s){var a=s.call(this,e,t,r);return n?a||o:a}return!n||o};e_.__f=!0;var s=e_.shouldComponentUpdate,o=e_.componentWillUpdate;e_.componentWillUpdate=function(e,t,r){if(this.__e){var i=s;s=void 0,n(e,t,r),s=i}o&&o.call(this,e,t,r)},e_.shouldComponentUpdate=n}return i.__N||i.__}(C_,e)}function __(e,t){var r=h_(Xp++,3);!s_.__s&&k_(r.__H,t)&&(r.__=e,r.u=t,e_.__H.__h.push(r))}function v_(e){return i_=5,g_((function(){return{current:e}}),[])}function g_(e,t){var r=h_(Xp++,7);return k_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function f_(e){var t=e_.context[e.__c],r=h_(Xp++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(e_)),t.props.value):e.__}function m_(){for(var e;e=n_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(S_),t.__h.some(w_),t.__h=[]}catch(r){t.__h=[],s_.__e(r,e.__v)}}}s_.__b=function(e){e_=null,o_&&o_(e)},s_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),d_&&d_(e,t)},s_.__r=function(e){a_&&a_(e),Xp=0;var t=(e_=e.__c).__H;t&&(t_===e_?(t.__h=[],e_.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&m_(),Xp=0)),t_=e_},s_.diffed=function(e){l_&&l_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==n_.push(t)&&r_===s_.requestAnimationFrame||((r_=s_.requestAnimationFrame)||b_)(m_)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),t_=e_=null},s_.__c=function(e,t){t.some((function(e){try{e.__h.some(S_),e.__h=e.__h.filter((function(e){return!e.__||w_(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],s_.__e(r,e.__v)}})),u_&&u_(e,t)},s_.unmount=function(e){c_&&c_(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{S_(e)}catch(e){t=e}})),r.__H=void 0,t&&s_.__e(t,r.__v))};var y_="function"==typeof requestAnimationFrame;function b_(e){var t,r=function(){clearTimeout(i),y_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);y_&&(t=requestAnimationFrame(r))}function S_(e){var t=e_,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),e_=t}function w_(e){var t=e_;e.__c=e.__(),e_=t}function k_(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function C_(e,t){return"function"==typeof t?t(e):t}function E_(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&Q(r.then)&&r.then(void 0,(()=>{}))}}}}var T_={GZipJS:"gzip-js",Base64:"base64"},x_={Activation:"events",Cancellation:"cancelEvents"},I_={Button:"button",Tab:"tab",Selector:"selector"},M_={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},R_={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},P_={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},F_={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},L_={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},A_={Once:"once",Recurring:"recurring",Always:"always"},O_={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},D_={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"},N_={Popover:"popover",Inline:"inline"},B_=Ur("[Surveys]");function q_(e){return!(!e.start_date||e.end_date)}function H_(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var $_="seenSurvey_",U_="inProgressSurvey_",W_=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),z_=e=>W_($_,e),V_=e=>{try{var t=z_(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){B_.error("Failed to persist survey seen state",e)}},j_=[P_.Popover,P_.Widget,P_.API],G_={ignoreConditions:!1,ignoreDelay:!1,displayType:N_.Popover},Q_="featureFlags",K_="logs";Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return re(e)&&isFinite(e)&&Math.floor(e)===e});class Z_{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new Z_(n)}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 new Error("Invalid UUIDv7 was generated");return e}clone(){return new Z_(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class Y_{generate(){var e=this.generateOrAbort();if(!Y(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Y(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Z_.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new ev}}var J_,X_=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};e&&!Y(e.crypto)&&crypto.getRandomValues&&(X_=e=>crypto.getRandomValues(e));class ev{nextUint32(){return this._buffer.length>this._cursor||(X_(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var tv=()=>rv().toString(),rv=()=>(J_||(J_=new Y_)).generate(),iv="",nv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var sv={_is_supported:()=>!!i,_error(e){$r.error("cookieStore error: "+e)},_get:Aa,_parse(e){var t;try{t=JSON.parse(sv._get(e))||{}}catch(e){}return t},_set(e,t,r,n,s){if(!i)return!1;try{var o="",a="",l=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=i),iv)return iv;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),n=Math.min(r.length,8),s="dmn_chk_"+tv();!iv&&n--;){var o=r.slice(n).join("."),a=s+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(s)&&(t.cookie=a+";max-age=0",iv=o)}return iv}(e);if(!r){var n=(e=>{var t=e.match(nv);return t?t[0]:""})(e);n!==r&&$r.info("Warning: cookie subdomain discovery mismatch",n,r),r=n}return r?"; domain=."+r:""}return""}(i.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),o="; expires="+u.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&$r.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null!=i&&i.cookie)try{sv._set(e,"",-1,t)}catch(e){return}}},ov=null,av={_is_supported(){if(!ee(ov))return ov;var t=!0;if(Y(e))t=!1;else try{var r="__mplssupport__";av._set(r,"xyz"),'"xyz"'!==av._get(r)&&(t=!1),av._remove(r)}catch(e){t=!1}return t||$r.error("localStorage unsupported; falling back to cookie store"),ov=t,t},_error(e){$r.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){av._error(e)}return null},_parse(e){try{return JSON.parse(av._get(e))||{}}catch(e){}return null},_set(t,r){try{return null==e||e.localStorage.setItem(t,JSON.stringify(r)),!0}catch(e){av._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){av._error(e)}}},lv=[ts,Gn,jn,Kn,Zn,Yn,ps,hs,cs],uv=[gn,vn,Dn,Nn,bs,ys,_s],cv=e=>e+"_cpm",dv=["__proto__","constructor","prototype"],hv=e=>{if(!K(e))return{};var t={};return Object.keys(e).forEach((r=>{-1===dv.indexOf(r)&&(t[r]=e[r])})),t},pv=function(e,t){void 0===t&&(t=[]);var r={};return[...uv,...t].forEach((t=>{var i=e[t];Y(i)||ee(i)||""===i||(r[t]=i)})),r},_v=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var n=e.charCodeAt(i);t=33*t^n,r=Math.imul(r^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},vv=(e,t)=>({p:t,f:_v(JSON.stringify(e))}),gv=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=sv._parse(cv(e)),i=(null==r?void 0:r.f)===_v(t)&&G(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},fv=(e,t)=>t+"|"+(sv._get(cv(e))||""),mv={},yv={_is_supported:()=>!0,_error(e){$r.error("memoryStorage error: "+e)},_get:e=>mv[e]||null,_parse:e=>mv[e]||null,_set:(e,t)=>(mv[e]=t,!0),_remove(e){delete mv[e]}},bv=null,Sv={_is_supported(){if(!ee(bv))return bv;if(bv=!0,Y(e))bv=!1;else try{var t="__support__";Sv._set(t,"xyz"),'"xyz"'!==Sv._get(t)&&(bv=!1),Sv._remove(t)}catch(e){bv=!1}return bv},_error(e){$r.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Sv._error(e)}return null},_parse(e){try{return JSON.parse(Sv._get(e))||null}catch(e){}return null},_set(t,r){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(r)),!0}catch(e){Sv._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Sv._error(e)}}},wv=Ur("[Stylesheet Loader]"),kv=e,Cv=i,Ev="#020617",Tv={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:M_.Right,widgetType:I_.Tab,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:Ev,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},xv=[M_.Center,M_.Left,M_.Right];function Iv(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function Mv(e){var t;void 0===e&&(e=Tv.backgroundColor),"#"===e[0]&&(t=Iv(e)),e.startsWith("rgb")&&(t=e);var r={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(r&&(t=Iv(r)),!t)return Ev;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var n=parseInt(i[1]),s=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(n*n*.299+s*s*.587+o*o*.114)>127.5?Ev:"white"}return Ev}var Rv=(e,t,r)=>{var i=Kv(e),n=Cv.querySelector("."+i);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};var s=Cv.createElement("div");((e,t,r)=>{var i=v({},Tv,r),n=e.style,s=!xv.includes(i.position)||t===P_.Widget&&(null==r?void 0:r.widgetType)===I_.Tab;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(i.fontFamily)),n.setProperty("--ph-survey-box-padding",i.boxPadding),n.setProperty("--ph-survey-max-width",i.maxWidth),n.setProperty("--ph-survey-z-index",i.zIndex),n.setProperty("--ph-survey-border-color",i.borderColor),s?(n.setProperty("--ph-survey-border-radius",i.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",i.borderRadius+" "+i.borderRadius+" 0 0")),n.setProperty("--ph-survey-background-color",i.backgroundColor),n.setProperty("--ph-survey-box-shadow",i.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||Mv(i.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",Mv(i.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||Mv(i.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),n.setProperty("--ph-widget-color",i.widgetColor),n.setProperty("--ph-widget-text-color",Mv(i.widgetColor)),n.setProperty("--ph-widget-z-index",i.zIndex);var o=(null==r?void 0:r.inputBackground)||(null==r?void 0:r.inputBackgroundColor),a=o||i.inputBackground;o||"white"!==i.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);var l=(null==r?void 0:r.inputTextColor)||Mv(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",i.outlineColor)})(s,e.type,e.appearance),s.className=i;var o=s.attachShadow({mode:"open"}),a=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var n=(e=>{var t;return Q(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return n&&(i=n(i)),i||(wv.error("prepare_external_dependency_stylesheet returned null"),null)})(Cv,':host{--ph-survey-font-family:-apple-system,BlinkMacSystemFont,"Inter","Segoe UI","Roboto",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:2147483645;--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px rgba(0,0,0,.15);--ph-survey-submit-button-color:#000;--ph-survey-submit-button-text-color:#fff;--ph-survey-rating-bg-color:#fff;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:#000;--ph-survey-rating-active-text-color:#fff;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:#fff;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:rgba(59,130,246,.8);--ph-survey-input-background:#fff;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:0.6}.ph-survey{bottom:0;height:fit-content;margin:0;max-width:85%;min-width:300px;position:fixed;width:var(--ph-survey-max-width);z-index:var(--ph-survey-z-index)}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;color:var(--ph-survey-text-primary-color);font-family:var(--ph-survey-font-family)}.ph-survey .multiple-choice-options label,.ph-survey input[type=text],.ph-survey textarea{background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;color:var(--ph-survey-input-text-color);padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input[type=text],.ph-survey textarea{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus,.ph-survey input[type=radio]:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey textarea:focus,.ph-survey textarea:focus-visible{border-color:var(--ph-survey-rating-active-bg-color);outline:1.5px solid var(--ph-survey-outline-color);outline-offset:2px}.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey textarea:focus:not(:focus-visible){outline:none}.ph-survey input[type=text]:hover:not(:focus),.ph-survey textarea:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey input[type=text],.ph-survey textarea{font-size:1rem}}.ph-survey .form-cancel,.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit,.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey label{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);border:none;border-radius:3px 3px 0 0;color:var(--ph-widget-text-color);cursor:pointer;padding:10px 12px;position:fixed;text-align:center;transition:padding .2s ease-out;z-index:var(--ph-survey-z-index)}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{gap:16px}.bottom-section,.survey-box{display:flex;flex-direction:column}.bottom-section{gap:8px}.intro-screen-header~.bottom-section,.thank-you-message-header~.bottom-section{padding-top:16px}.intro-screen,.question-container,.thank-you-message{display:flex;flex-direction:column;gap:8px}.survey-question{font-size:14px;font-weight:500}.survey-question-description{font-size:13px;opacity:.8;padding-top:4px}.intro-screen-body,.survey-question-description,.thank-you-message-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video{height:auto;max-width:100%}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{height:auto;max-width:100%}.question-textarea-wrapper{display:flex;flex-direction:column}.survey-form{animation:ph-survey-fade-in .3s ease-out forwards}.intro-screen,.survey-form,.thank-you-message{background:var(--ph-survey-background-color);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);margin:0;padding:var(--ph-survey-box-padding);position:relative;text-align:left;width:100%;z-index:var(--ph-survey-z-index)}.survey-form input[type=text],.survey-form textarea{min-width:100%}:is(.survey-form textarea):focus,:is(.survey-form textarea):focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.08)}:is(.survey-form textarea):focus:not(:focus-visible){box-shadow:none}:is(.survey-box .question-header--empty)~.multiple-choice-options,:is(.survey-box .question-header--empty)~textarea{margin-top:0}.multiple-choice-options{border:none;display:flex;flex-direction:column;font-size:14px;gap:8px;margin:0;padding:1px 0}.multiple-choice-options .response-choice,.multiple-choice-options label{align-items:center;color:inherit;display:flex;gap:8px}.multiple-choice-options label{cursor:pointer;font-size:13px}:is(.multiple-choice-options label):hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px rgba(0,0,0,.08)}:is(.multiple-choice-options label):has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px rgba(0,0,0,.05)}.choice-option-open:is(.multiple-choice-options label){flex-wrap:wrap}:is(.multiple-choice-options label) span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--ph-survey-input-background);border-radius:3px;cursor:pointer;flex-shrink:0;height:1rem;position:relative;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;width:1rem;z-index:1}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{animation:ph-survey-checkmark-reveal .2s ease-out .1s forwards;border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;height:8px;left:4px;transform:rotate(45deg) scale(0);width:4px}.multiple-choice-options input[type=radio]:checked:after{animation:ph-survey-radio-reveal .15s ease-out .05s forwards;background:var(--ph-survey-rating-active-text-color);border-radius:50%;height:6px;left:5px;top:5px;transform:scale(0);width:6px}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{box-sizing:content-box;content:"";position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}:is(:is(.multiple-choice-options .choice-option-open) input[type=text])::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{display:flex;justify-content:space-between}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{background-color:transparent;border:none;font-size:16px;opacity:.5;padding:0}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;overflow:hidden}.rating-options-number .ratings-number{border:none;border-right:1px solid var(--ph-survey-border-color);color:var(--ph-survey-rating-text-color);cursor:pointer;font-weight:700;text-align:center}:is(.rating-options-number .ratings-number):last-of-type{border-right:0}.rating-active:is(.rating-options-number .ratings-number){background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb,var(--ph-survey-rating-active-bg-color) 14%,var(--ph-survey-rating-bg-color))}}.rating-text{font-size:11px;justify-content:space-between;opacity:.7}.form-buttons,.rating-text{display:flex;flex-direction:row}.form-buttons{gap:8px;width:100%}.form-buttons-with-back>.form-submit{flex:1 1 auto;min-width:0}.form-submit{background:var(--ph-survey-submit-button-color);border:none;border-radius:6px;box-shadow:0 2px 0 rgba(0,0,0,.045);color:var(--ph-survey-submit-button-text-color);cursor:pointer;font-weight:700;min-width:100%;padding:12px;text-align:center;user-select:none}.form-submit:not([disabled]):hover{box-shadow:0 4px 8px rgba(0,0,0,.1);transform:scale(1.02)}.form-submit:not([disabled]):active{box-shadow:0 1px 2px rgba(0,0,0,.05);transform:scale(.98)}.form-submit[disabled]{cursor:not-allowed;opacity:var(--ph-survey-disabled-button-opacity)}.form-back{background:transparent;border:1.5px solid var(--ph-survey-border-color);border-radius:6px;color:var(--ph-survey-text-primary-color);cursor:pointer;flex:0 0 auto;font-weight:600;padding:12px 16px;text-align:center;user-select:none}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{font-size:12px;margin-top:4px;opacity:.7}.form-cancel{background:#fff;border-radius:100%;cursor:pointer;line-height:0;padding:12px;position:absolute;right:0;top:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%) scale(1.1)}.footer-branding{align-items:center;display:flex;font-size:11px;font-weight:500;gap:4px;justify-content:center;opacity:.6;text-decoration:none}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{font-size:14px;opacity:.8}.intro-screen{animation:ph-survey-fade-in .3s ease-out forwards;text-align:center}.intro-screen-header{margin:10px 0 0}.intro-screen-body{font-size:14px;opacity:.8}.limit-height{max-height:256px;overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);scrollbar-width:thin}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}:is(.limit-height::-webkit-scrollbar-thumb):hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}@media (prefers-reduced-motion:reduce){.ph-survey *{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg) scale(0)}50%{opacity:1;transform:rotate(45deg) scale(1.2)}to{opacity:1;transform:rotate(45deg) scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(a){var l=o.querySelector("style");l&&o.removeChild(l),o.appendChild(a)}return Cv.body.appendChild(s),{shadow:o,isNewlyCreated:!0}},Pv=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,n=e.posthog,s=e.isSurveyCompleted,o=e.properties,a=e.surveyLanguage;n?(V_(r),n.capture(O_.SENT,v({[D_.SURVEY_NAME]:r.name,[D_.SURVEY_ID]:r.id,[D_.SURVEY_ITERATION]:r.current_iteration,[D_.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[D_.SURVEY_SUBMISSION_ID]:i,[D_.SURVEY_COMPLETED]:s},a&&{[D_.SURVEY_LANGUAGE]:a},{sessionRecordingUrl:null==n.get_session_replay_url?void 0:n.get_session_replay_url()},pa(t,r),o,{$set:{[_a(r,"responded")]:!0}})),s&&(kv.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),Qv(r),n.reloadFeatureFlags())):B_.error("[survey sent] event not captured, PostHog instance not found.")},Fv=(e,t,r)=>{return v({[D_.SURVEY_NAME]:e.name,[D_.SURVEY_ID]:e.id,[D_.SURVEY_ITERATION]:e.current_iteration,[D_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[D_.SURVEY_PARTIALLY_COMPLETED]:(i=null==t?void 0:t.responses,void 0===i&&(i={}),Object.values(i).some((e=>!te(e))))},(null==t?void 0:t.surveyLanguage)&&{[D_.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[D_.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},pa(null==t?void 0:t.responses,e));var i},Lv=(e,t,r,i)=>{if(t){if(!r){var n=jv(e);t.capture(O_.DISMISSED,v({},Fv(e,n,t),i&&{[D_.SURVEY_LANGUAGE]:i},{$set:{[_a(e,"dismissed")]:!0}})),Qv(e),V_(e),kv.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else B_.error("[survey dismissed] event not captured, PostHog instance not found.")},Av=(e,t)=>{if(t){var r=(e=>W_("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=jv(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(O_.ABANDONED,Fv(e,i,t),{transport:"sendBeacon"})}}else B_.error("[survey abandoned] event not captured, PostHog instance not found.")},Ov=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),Dv=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Nv=e=>{var t=e.map((e=>e.id));return t.every((e=>!!e))?t:void 0},Bv=(e,t)=>{return(e=>e.questions.some((e=>{var t;return!(null==(t=e.branching)||!t.type)})))(e)?e.questions:t?null!==(r=((e,t)=>{if(!t||t.length!==e.questions.length)return null;var r=new Map(e.questions.map((e=>[e.id,e]))),i=[];for(var n of t){var s=r.get(n);if(!s)return null;i.push(s)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Dv(e.questions,Ov(e.questions)):e.questions;var r},qv=e=>Sa(e)||Gv(e),Hv=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach((function(e){e.__e=!0,Np(e)}))},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+kp++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),$v=()=>f_(Hv),Uv=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,n,s,o,a=Ip({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==s?i=t[s]:"ref"==s?n=t[s]:a[s]=void 0===t[s]&&null!=o?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?up.call(arguments,2):r),Pp(e.type,a,i||e.key,n||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Wv(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var n=ci(t);if(!n)return!1;var s=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return Ca[o](s,[n])}var zv=e=>W_(U_,e),Vv=(e,t)=>{try{localStorage.setItem(zv(e),JSON.stringify(t))}catch(e){B_.error("Error setting in-progress survey state in localStorage",e)}},jv=e=>{try{var t=localStorage.getItem(zv(e));if(t)return JSON.parse(t)}catch(e){B_.error("Error getting in-progress survey state from localStorage",e)}return null},Gv=e=>{var t=jv(e);return!te(null==t?void 0:t.surveySubmissionId)},Qv=e=>{try{localStorage.removeItem(zv(e))}catch(e){B_.error("Error clearing in-progress survey state from localStorage",e)}};function Kv(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function Zv(e,t,r){if(void 0===t&&(t=M_.Right),e===P_.ExternalSurvey)return{};switch(t){case M_.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case M_.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case M_.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case M_.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case M_.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case M_.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case M_.Left:return{left:"30px"};case M_.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===P_.Widget&&r===I_.Tab?"60px":"30px"}}}var Yv=0;function Jv(e,t,r,i,n,s){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Yv,__i:-1,__u:0,__source:n,__self:s};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return cp.vnode&&cp.vnode(u),u}var Xv=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Jv("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),eg=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Jv("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),tg=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Jv("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),rg=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Jv("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),ig=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Jv("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),ng=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Jv("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),sg=Jv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Jv("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),og=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return Jv("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:r,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Jv("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Jv("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:r})]})},ag=Jv("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Jv("g",{"clip-path":"url(#clip0_2415_6911)",children:[Jv("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Jv("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Jv("g",{mask:"url(#mask0_2415_6911)",children:[Jv("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Jv("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Jv("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Jv("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Jv("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Jv("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Jv("defs",{children:Jv("clipPath",{id:"clip0_2415_6911",children:Jv("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function lg(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return Jv("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",ag]})}function ug(t){var r=t.text,i=t.submitDisabled,n=t.appearance,s=t.onSubmit,o=t.link,a=t.onPreviewSubmit,l=t.skipSubmitButton,u=t.canGoBack,c=t.onBack,d=f_(Hv).isPreviewMode,h=!!u&&!!c,p=!l&&Jv("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){o&&(null==e||e.open(o)),d?null==a||a():s()},children:r});return Jv("div",{className:"bottom-section",children:[h?Jv("div",{className:"form-buttons form-buttons-with-back",children:[Jv("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:n.backButtonText||"Back"}),p]}):p,!n.whiteLabel&&Jv(lg,{urlParams:{utm_source:"survey-footer"}})]})}function cg(e){var t=e.question,r=e.forceDisableHtml;return Jv("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Jv(t.type===F_.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&Uv({component:Rp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function dg(e){return Jv("button",{className:"form-cancel",onClick:e.onClick,disabled:f_(Hv).isPreviewMode,"aria-label":"Close survey",type:"button",children:og({fill:"black"})})}Jv("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Jv("path",{d:"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z",fill:"currentColor"})});var hg=e;function pg(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onClose,a=f_(Hv).isPopup;return __((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Jr(hg,"keydown",e),()=>{hg.removeEventListener("keydown",e)}}),[o]),Jv("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==s.hideCancelButton&&Jv(dg,{onClick:()=>o()}),Jv("h3",{className:"thank-you-message-header",children:t}),r&&Uv({component:Rp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!n&&"text"!==i}),a&&Jv(ug,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>o()})]})}function _g(e){var t=e.header,r=e.description,i=e.contentType,n=e.forceDisableHtml,s=e.appearance,o=e.onStart,a=f_(Hv),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return Jv("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==s.hideCancelButton&&Jv(dg,{onClick:()=>u()}),t&&Jv("h3",{className:"intro-screen-header",children:t}),r&&Uv({component:Rp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!n&&"text"!==i}),Jv(ug,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var vg=e=>G(e)&&e.every((e=>J(e)));function gg(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,n=e.onSubmit,s=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=$v().isPreviewMode,d=v_(null),h=p_((()=>J(a)?a:"")),p=h[0],_=h[1],v=null==i?void 0:i.disableAutofocus;__((()=>{v||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,v]);var g="surveyQuestion"+o,f=g_((()=>function(e,t,r){var i,n,s=e.trim();if(!r&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case E:if(void 0!==o.value&&o.value>s.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case T:if(void 0!==o.value&&s.length>o.value)return null!==(n=o.errorMessage)&&void 0!==n?n:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=ir(t.validation,E),y=ir(t.validation,T),b=g_((()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y)),[m,y]),S=()=>{f||n(p.trim())},w=()=>{f||s(p.trim())};return Jv(Fp,{children:[Jv("div",{className:"question-container",children:[Jv(cg,{question:t,forceDisableHtml:r,htmlFor:g}),Jv("textarea",{ref:d,id:g,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){_(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),c?w():S())},value:p}),b&&Jv("div",{className:"validation-hint",children:b})]}),Jv(ug,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function fg(e){var t=e.question,r=e.appearance,i=e.onSubmit,n=e.onPreviewSubmit,s=e.canGoBack,o=e.onBack;return Jv(Fp,{children:[Jv("div",{className:"question-container",children:Jv(cg,{question:t,forceDisableHtml:e.forceDisableHtml})}),Jv(ug,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:s,onBack:o})]})}function mg(e){var t,r=e.question,i=e.forceDisableHtml,n=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,c=e.onBack,d=r.scale,h=10===r.scale?0:1,p=p_((()=>re(l)?l:G(l)&&l.length>0&&re(parseInt(l[0]))?parseInt(l[0]):J(l)&&re(parseInt(l))?parseInt(l):null)),_=p[0],v=p[1],g="emoji"===r.display&&2===r.scale,f=$v().isPreviewMode,m=e=>f?a(e):o(e);return Jv(Fp,{children:[Jv("div",{className:"question-container",children:[Jv(cg,{question:r,forceDisableHtml:i}),Jv("div",{className:"rating-section",children:[Jv("div",{className:"rating-options",children:["emoji"===r.display&&Jv("div",{className:"rating-options-emoji"+(g?" rating-options-emoji-2":""),children:null==(t=Cg[r.scale])?void 0:t.map(((e,t)=>Jv("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+n+"-rating-"+t+" "+(t+1===_?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;v(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&Jv("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:Eg(r.scale).map(((e,t)=>Jv(yg,{displayQuestionIndex:n,active:_===e,appearance:s,num:e,setActiveNumber(e){v(e),r.skipSubmitButton&&m(e)}},t)))})]}),!g&&Jv("div",{className:"rating-text",children:[Jv("div",{children:r.lowerBoundLabel}),Jv("div",{children:r.upperBoundLabel})]})]})]}),Jv(ug,{text:r.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:ee(_)&&!r.optional,appearance:s,onSubmit:()=>o(_),onPreviewSubmit:()=>a(_),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function yg(e){var t=e.num,r=e.setActiveNumber;return Jv("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function bg(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,n=e.appearance,s=e.onSubmit,o=e.onPreviewSubmit,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=v_(null),d=g_((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Dv(t,Ov(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),h=p_((()=>((e,t)=>J(e)||vg(e)?e:t===F_.SingleChoice?null:[])(a,t.type))),p=h[0],_=h[1],g=p_((()=>((e,t)=>{if(J(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(vg(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(a,d))),f=g[0],m=g[1],y=$v().isPreviewMode,b=t.type===F_.SingleChoice,S=t.type===F_.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m((e=>v({},e,{isSelected:r,inputValue:r?e.inputValue:""}))),b&&_(""),void(r&&setTimeout((()=>{var e;return null==(e=c.current)?void 0:e.focus()}),75))}if(b)return _(e),m((e=>v({},e,{isSelected:!1,inputValue:""}))),void(w&&(s(e),y&&o(e)));S&&G(p)&&(p.includes(e)?_(p.filter((t=>t!==e))):_([...p,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>v({},e,{inputValue:t}))),b&&_(t)},E=e=>{e.stopPropagation(),"Enter"!==e.key||T()||(e.preventDefault(),x()),"Escape"===e.key&&(e.preventDefault(),m((e=>v({},e,{isSelected:!1,inputValue:""}))),b&&_(null))},T=()=>!(t.optional||!ee(p)&&(!G(p)||f.isSelected||0!==p.length)&&(!f.isSelected||""!==f.inputValue.trim())),x=()=>{f.isSelected&&S?G(p)&&(y?o([...p,f.inputValue]):s([...p,f.inputValue])):y?o(p):s(p)};return Jv(Fp,{children:[Jv("div",{className:"question-container",children:[Jv(cg,{question:t,forceDisableHtml:r}),Jv("fieldset",{className:"multiple-choice-options limit-height",children:[Jv("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),d.map(((e,r)=>{var n=!!t.hasOpenChoice&&r===t.choices.length-1,s="surveyQuestion"+i+"Choice"+r,o=s+"Open",a=n?f.isSelected:b?p===e:G(p)&&p.includes(e);return Jv("label",{className:n?"choice-option-open":"",children:[Jv("div",{className:"response-choice",children:[Jv("input",{type:b?"radio":"checkbox",name:s,checked:a,onChange:()=>k(e,n),id:s,"aria-controls":o}),Jv("span",{children:n?e+":":e})]}),n&&Jv("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:E,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),Jv(ug,{text:t.buttonText||"Submit",submitDisabled:T(),appearance:n,onSubmit:x,onPreviewSubmit:x,skipSubmitButton:w,canGoBack:l,onBack:u})]})}var Sg=[1,2,3,4,5],wg=[1,2,3,4,5,6,7],kg=[0,1,2,3,4,5,6,7,8,9,10],Cg={2:[ng,sg],3:[tg,eg,Xv],5:[rg,tg,eg,Xv,ig]};function Eg(e){switch(e){case 5:default:return Sg;case 7:return wg;case 10:return kg}}var Tg=Ur("[Surveys]");function xg(e,t,r){var i,n=e.questions[t],s=t+1;if(null==(i=n.branching)||!i.type)return t===e.questions.length-1?L_.End:s;if(n.branching.type===L_.End)return L_.End;if(n.branching.type===L_.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===L_.ResponseBased){if(n.type===F_.SingleChoice){var o,a=n.choices.indexOf(""+r);if(-1===a&&n.hasOpenChoice&&(a=n.choices.length-1),null!=(o=n.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=n.branching.responseValues[a];return Number.isInteger(l)?l:l===L_.End?L_.End:s}}else if(n.type===F_.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var c=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,n.scale);if(null!=(u=n.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=n.branching.responseValues[c];return Number.isInteger(d)?d:d===L_.End?L_.End:s}}return s}return Tg.warn("Falling back to next question index due to unexpected branching type"),s}var Ig=Ur("[SurveyTranslations]");function Mg(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,n=va(e.overrideLanguage);if(n)return null==t||t.info("Using override display language: "+n),n;var s=function(e){return e&&"object"==typeof e&&"language"in e?va(e.language):null}(r);if(s)return null==t||t.info("Using person property language: "+s),s;var o=va(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:Q(e.get_property)?e.get_property(ts):void 0,locale:Wa()},Ig)}(t);if(!r)return Ig.info("No user language detected"),{survey:e,language:null};var i=ya(e,r,Ig);return{survey:i.survey,language:i.matchedKey}}var Rg=-1,Pg=e,Fg=i,Lg="ph:show_survey_widget",Ag="PHWidgetSurveyClickListener";function Og(e,t){try{var r=e.getBoundingClientRect(),i=Pg.innerHeight,n=Pg.innerWidth,s=r.left+r.width/2-t/2;s+t>n-20&&(s=n-t-20),20>s&&(s=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:s+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:Tv.zIndex}}catch(e){return B_.warn("Failed to calculate trigger position:",e),null}}class Dg{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this.handlePageUnload=()=>{var e=this._posthog.get_property(ns);if(e)for(var t of e)Gv(t)&&Av(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var n,s,o,a,l,u=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==u&&u,d=t._translateSurveyForRendering(e),h=d.survey,p=d.language,_=null!=r&&r.position||null!=r&&r.selector?v({},h,{appearance:v({},h.appearance,r.position&&{position:r.position},r.selector&&{widgetSelector:r.selector})}):h;t._clearSurveyTimeout(_.id);var g=null!=r?r:{},f=g.properties,m=g.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(_,m,f,p);if(!y||null!=(n=_.appearance)&&n.displayThankYouMessage){t._addSurveyToFocus(_);var b={};if((null==(s=_.appearance)?void 0:s.position)===M_.NextToTrigger&&null!=(o=_.appearance)&&o.widgetSelector){var S,w=Fg.querySelector(_.appearance.widgetSelector);w&&(b=Og(w,parseInt((null==(S=_.appearance)?void 0:S.maxWidth)||Tv.maxWidth))||{})}var k=(null==(a=_.appearance)?void 0:a.surveyPopupDelaySeconds)||0,C=Rv(_,t._posthog).shadow;t._renderedTargets.set(C,C.host);var E={posthog:t._posthog,survey:_,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:p};if(0>=k)return Jp(Jv($g,v({},E)),C);var T=()=>{if(!t._shouldDisplaySurvey(_))return B_.info("Survey "+_.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(_);Jp(Jv($g,v({},E,{survey:v({},_,{appearance:v({},_.appearance,{surveyPopupDelaySeconds:0})})})),C)},x=c?null==(l=t._posthog.surveys)||null==(l=l._surveyEventReceiver)||null==l.getActivationTimestamp?void 0:l.getActivationTimestamp(_.id):void 0,I=re(x)?Math.max(0,Date.now()-x):0,M=Math.max(0,1e3*k-I);if(0>=M)return T();var R=Pg.setTimeout((()=>{t._surveyTimeouts.delete(_.id),T()}),M);t._surveyTimeouts.set(_.id,R)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=Rv(r,this._posthog),s=n.shadow,o=n.isNewlyCreated;this._renderedTargets.set(s,s.host),o&&Jp(Jv(Wg,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),s)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Ag),this._widgetSelectorListeners.delete(e),B_.info("Removed click listener for survey "+e))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._isWidgetSurveyOpen=e=>{try{var t,r=Fg.querySelector(Kv(e,!0));return!(null==r||null==(t=r.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=Fg.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;B_.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(Ag)){var n=t=>{var r,i;t.stopPropagation();var n=(null==(r=e.appearance)?void 0:r.position)===M_.NextToTrigger?Og(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||Tv.maxWidth)):{};Pg.dispatchEvent(new CustomEvent(Lg,{detail:{surveyId:e.id,position:n}}))};Jr(r,"click",n),r.setAttribute(Ag,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:n,survey:e}),B_.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,n=Rv(r,this._posthog).shadow;this._renderedTargets.set(n,n.host),Jp(Jv($g,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),n)},this.renderSurvey=(e,t,r)=>{var i,n=this._translateSurveyForRendering(e),s=n.survey,o=n.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(s,o,r)),Jp(Jv($g,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys((r=>{var i=r.filter((e=>t._shouldDisplaySurvey(e)));e(i)}),r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys((e=>{var r=e.filter((e=>e.type===P_.Popover||e.type===P_.Widget)),i=new Set(r.map((e=>e.id)));for(var n of Array.from(t._surveyTimeouts.keys()))i.has(n)||t.cancelSurvey(n);var s=t._sortSurveysByAppearanceDelay(r),o=new Set;s.forEach((e=>{if(e.type===P_.Widget){var r,i,n,s;if((null==(r=e.appearance)?void 0:r.widgetType)===I_.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===I_.Selector&&null!=(n=e.appearance)&&n.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(s=e.appearance)?void 0:s.widgetSelector))}ee(t._surveyInFocus)&&e.type===P_.Popover&&t.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})})),t._widgetSelectorListeners.forEach((e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)}))}),e)},this._addSurveyToFocus=e=>{ee(this._surveyInFocus)||B_.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&B_.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,Q_))&&void 0!==e?e:this._posthog.featureFlags}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(B_.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._surveyTimeouts.forEach(((e,t)=>this._clearSurveyTimeout(t))),this._widgetSelectorListeners.forEach(((e,t)=>this._detachWidgetSelectorListener(t))),this._renderedTargets.forEach(((e,t)=>{Jp(null,t),null==e||e.remove()})),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,n=Gv(e),s=Gv(t);if(n&&!s)return-1;if(!n&&s)return 1;var o=e.schedule===A_.Always,a=t.schedule===A_.Always;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)}))}_translateSurveyForRendering(e){return Mg(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=Pg.location.search.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var n=i.split("&");for(var s of n){var o=s.split("="),a=o[0],l=o[1];if(a&&!Y(l)){var u=decodeURIComponent(a),c=decodeURIComponent(l);if("auto_submit"!==u||"true"!==c){var d=u.match(/^q(\d+)$/);if(d){var h=parseInt(d[1],10);t[h]||(t[h]=[]),t[h].push(c)}}else r=!0}}return{params:t,autoSubmit:r}}(),n=i.params;if(0===Object.keys(n).length)return!1;B_.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,n,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,r,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var n=t.responses,s=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Pv({responses:o?n:a,survey:e,surveySubmissionId:s,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var n={};for(var s of Object.entries(t)){var o=s[1];n[parseInt(s[0])]=G(o)?o.map(String):[String(o)]}B_.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,n,i);return!!a&&(this._autoSubmitPrefilledResponses(e,a,r,i),a.isSurveyCompleted)}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach(((e,i)=>{if(t[i]&&e.id){var n=t[i],s=da(e.id);try{switch(e.type){case F_.SingleChoice:if(!e.choices||0===e.choices.length)return void $r.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(n[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void $r.warn("[Survey Prefill] Invalid choice index for q"+i+": "+n[0]);r[s]=e.choices[o];break;case F_.MultipleChoice:if(!e.choices||0===e.choices.length)return void $r.warn("[Survey Prefill] Question "+i+" has no choices");var a=n.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void $r.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&$r.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[s]=l;break;case F_.Rating:var u=parseInt(n[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void $r.warn("[Survey Prefill] Invalid rating for q"+i+": "+n[0]+" (scale: 0-"+c+")");r[s]=u;break;default:$r.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){$r.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return B_.warn("[Survey Prefill] No valid responses after conversion"),null;var n=tv(),s=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,n={},s=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=da(l.id);Y(r[u])||(n[u]=r[u])}s.push(i);var c=xg(e,i,l.id?r[da(l.id)]:null);if(c===L_.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:s};i=c}return{startQuestionIndex:i,skippedResponses:n,skippedIndices:s}}(e,s,i),a=o.startQuestionIndex,l=o.skippedResponses,u=o.skippedIndices,c=a>=e.questions.length;return Vv(e,{surveySubmissionId:n,responses:i,lastQuestionIndex:a,questionOrder:Nv(e.questions),visitedIndices:u,surveyLanguage:r}),B_.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:n,startQuestionIndex:a,isSurveyCompleted:c,skippedResponses:l}}catch(e){return B_.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){if(void 0===t&&(t=void 0),!e)return!0;var r=this._featureFlags,i=!(null==r||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),n=!0;return t&&(n=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&n}_isSurveyConditionMatched(t){return!t.conditions||Wv(t,this._posthog)&&function(t){var i,n;return function(t,i){var n,s,o;if(!t||0===t.length)return!0;if(!u)return!1;var a=wt(u,{userAgentDataPlatform:null==r||null==(n=r.userAgentData)?void 0:n.platform,maxTouchPoints:null==r?void 0:r.maxTouchPoints,screenWidth:null==e||null==(s=e.screen)?void 0:s.width,screenHeight:null==e||null==(o=e.screen)?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return Ca[null!=i?i:"icontains"](t,[a])}(null==(i=t.conditions)?void 0:i.deviceTypes,null==(n=t.conditions)?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==Cv||!Cv.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return qv(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!q_(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!j_.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var n=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return i.eligible=!1,i.reason=n?"Survey linked feature flag is not enabled for variant "+n:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var s,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=new Date,n=Math.abs(i.getTime()-r.getTime());return Math.ceil(n/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,av._get("lastSeenSurveyDate"))?(e=>!!av._get(z_(e))&&!qv(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(s=o.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!ba(e)&&!H_(e))return!0;var r=null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)?void 0:t.getSurveys();return!(null==r||!r.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every((e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)}))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=Fg.querySelector(Kv(e,!0));null!=t&&t.shadowRoot&&(Jp(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){B_.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this)}}}function Ng(e,t){if(Fg&&Pg){var r,i=new Dg(e);if(e.config.disable_surveys_automatic_display)return B_.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return B_.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var n=()=>{Y(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))},s=()=>{Y(r)||(clearInterval(r),r=void 0)};n();var o=()=>{Fg.hidden?s():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return Jr(Fg,"visibilitychange",o),i.setAutomaticDisplayDispose((()=>{s(),Fg.removeEventListener("visibilitychange",o)})),i}}function Bg(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,n=e.setSurveyVisible,s=e.isPreviewMode,o=void 0!==s&&s,a=e.posthog;__((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===P_.Widget,s=Wv(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===I_.Tab&&r;if(!s)return B_.info("Hiding survey "+t.id+" because URL does not match"),n(!1),i(t);o&&(B_.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),n(!0))};Jr(Pg,"popstate",r),Jr(Pg,"hashchange",r);var s=Pg.history.pushState,l=Pg.history.replaceState;return Pg.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s.apply(this,t),r()},Pg.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{Pg.removeEventListener("popstate",r),Pg.removeEventListener("hashchange",r),Pg.history.pushState=s,Pg.history.replaceState=l}}}),[o,t,i,n,a])}var qg=200;function Hg(e){switch(void 0===e&&(e=R_.Right),e){case R_.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case R_.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case R_.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function $g(e){var t,r,i,n,s,o,a,l,u,c,d,h,p=e.survey,_=e.forceDisableHtml,g=e.posthog,f=e.style,m=void 0===f?{}:f,y=e.previewPageIndex,b=e.removeSurveyFromFocus,S=void 0===b?()=>{}:b,w=e.isPopup,k=void 0===w||w,C=e.onPreviewSubmit,E=void 0===C?()=>{}:C,T=e.onPreviewBack,x=void 0===T?()=>{}:T,I=e.onPopupSurveyDismissed,M=void 0===I?()=>{}:I,R=e.onCloseConfirmationMessage,P=void 0===R?()=>{}:R,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=v_(null),N=Number.isInteger(y),B=null!=(t=p.appearance)&&t.surveyPopupDelaySeconds?1e3*p.appearance.surveyPopupDelaySeconds:0,q=function(e,t,r,i,n,s,o,a,l){var u=p_(i||0===r||e.type===P_.ExternalSurvey),c=u[0],d=u[1],h=p_(!1),p=h[0],_=h[1],g=v_(!1),f=()=>{var t=()=>{s&&n(e),d(!1)};if(!g.current){var r=null==o?void 0:o.current;r?(g.current=!0,r.style.transition="opacity "+qg+"ms ease-out",r.style.opacity="0",setTimeout((()=>{g.current=!1,t()}),qg+50)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return __((()=>{if(t){if(!i){var n,s=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();_(!0),null!=(i=e.appearance)&&i.autoDisappear&&(n&&clearTimeout(n),n=setTimeout(f,5e3))}},o=()=>{if(Wv(e,t)){d(!0),Pg.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(O_.SHOWN,v({[D_.SURVEY_NAME]:e.name,[D_.SURVEY_ID]:e.id,[D_.SURVEY_ITERATION]:e.current_iteration,[D_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[D_.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};Jr(Pg,"PHSurveyClosed",m),Jr(Pg,"PHSurveySent",s);var u=r>0?setTimeout(o,r):void 0;return Y(u)&&o(),()=>{Y(u)||clearTimeout(u),Y(n)||clearTimeout(n),Pg.removeEventListener("PHSurveyClosed",m),Pg.removeEventListener("PHSurveySent",s)}}}else B_.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Bg({survey:e,removeSurveyFromFocus:n,setSurveyVisible:d,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:p,setIsPopupVisible:d,hidePopupWithAnimation:f}}(p,g,B,N,S,k,D,A,O),H=q.isPopupVisible,U=q.hidePopupWithAnimation,W=q.isSurveySent||y===p.questions.length||!0===L,z=p_(!1),V=z[0],j=z[1],G=g_((()=>!!jv(p)),[p]),Q=!!(null!=(r=p.appearance)&&r.introScreenHeader||null!=(i=p.appearance)&&i.introScreenDescription),K=N?y===Rg:!(null==(n=p.appearance)||!n.displayIntroScreen)&&Q&&!V&&!G,Z=g_((()=>{var e=jv(p),t=(null==e?void 0:e.surveySubmissionId)||tv();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?Lv(p,g,N,O):Lv(p,g,N),M()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:E,onPreviewBack:x,posthog:g,properties:F,surveyLanguage:O}}),[N,y,k,g,p,M,E,x,F,O]);return H?Jv(Hv.Provider,{value:Z,children:Jv("div",{className:"ph-survey",style:v({},Zv(p.type,null==(s=p.appearance)?void 0:s.position,null==(o=p.appearance)?void 0:o.widgetType),m),ref:D,children:W?Jv(pg,{header:(null==(a=p.appearance)?void 0:a.thankYouMessageHeader)||"Thank you!",description:(null==(l=p.appearance)?void 0:l.thankYouMessageDescription)||"",forceDisableHtml:!!_,contentType:null==(u=p.appearance)?void 0:u.thankYouMessageDescriptionContentType,appearance:p.appearance||Tv,onClose(){U(),P()}}):K?Jv(_g,{header:(null==(c=p.appearance)?void 0:c.introScreenHeader)||"",description:(null==(d=p.appearance)?void 0:d.introScreenDescription)||"",forceDisableHtml:!!_,contentType:null==(h=p.appearance)?void 0:h.introScreenDescriptionContentType,appearance:p.appearance||Tv,onStart:()=>j(!0)}):Jv(Ug,{survey:p,forceDisableHtml:!!_,posthog:g})})}):null}function Ug(e){var t,r,i=e.survey,n=e.forceDisableHtml,s=e.posthog,o=g_((()=>{var e=jv(i);if(!e)return null;var t=re(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(Qv(i),null)}),[i]),a=p_((()=>(null!=o&&o.responses&&B_.info("Survey is already in progress, filling in initial responses"),(null==o?void 0:o.responses)||{}))),l=a[0],u=a[1],c=f_(Hv),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,_=c.onPreviewSubmit,g=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=p_((()=>{var e=null==o?void 0:o.lastQuestionIndex,t=re(e)&&e>=0&&i.questions.length>e?e:0;return re(d)&&d>=0?d:t})),w=S[0],k=S[1],C=p_((()=>{var e;return(null!==(e=null==o?void 0:o.visitedIndices)&&void 0!==e?e:[]).filter((e=>e>=0&&i.questions.length>e))})),E=C[0],T=C[1],x=g_((()=>Bv(i,o)),[i,o]);__((()=>{!m||Y(d)||0>d||k(d)}),[d,m]);var I=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=d?d:0)>0:E.length>0),M=x.at(w);return M?Jv("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&Jv(dg,{onClick(){h()}}),Jv("div",{className:"survey-box","data-question-index":w,children:zg({question:M,forceDisableHtml:n,displayQuestionIndex:w,appearance:i.appearance||Tv,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,n=e.questionId;if(s)if(n){var o=da(n),a=v({},l,{[o]:t});u(a);var c=xg(i,r,t),d=c===L_.End,h=[...E,r];if(d||(T(h),k(c),Vv(i,{surveySubmissionId:f,responses:a,lastQuestionIndex:c,questionOrder:Nv(x),visitedIndices:h,surveyLanguage:b})),i.enable_partial_responses||d){var p=new Set(h.map((e=>{var t;return null==(t=x[e])?void 0:t.id})).filter((e=>!!e)).map((e=>da(e)))),_=Object.fromEntries(Object.entries(a).filter((e=>p.has(e[0]))));Pv({responses:_,survey:i,surveySubmissionId:f,isSurveyCompleted:d,posthog:s,properties:y,surveyLanguage:b})}}else B_.error("onNextButtonClick called without a questionId.");else B_.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:M.id}),onPreviewSubmit:_,initialValue:M.id?l[da(M.id)]:void 0,canGoBack:I,onBack(){if(m)g();else if(0!==E.length){var e=E[E.length-1],t=E.slice(0,-1);T(t),k(e),Vv(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:e,questionOrder:Nv(x),visitedIndices:t,surveyLanguage:b})}}})})]}):null}function Wg(e){var t,r,i,n,s,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=p_(!0),_=p[0],v=p[1],g=p_(!1),f=g[0],m=g[1],y=p_({}),b=y[0],S=y[1],w=v_(void 0),k=()=>{m(!f)};if(__((()=>{var e;if(c){if(!d){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(B_.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return Jr(Pg,Lg,t),()=>{Y(w.current)||(clearTimeout(w.current),w.current=void 0),Pg.removeEventListener(Lg,t)}}}else B_.error("FeedbackWidget called without a PostHog instance.")}),[c,d,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),Bg({survey:l,setSurveyVisible:v,posthog:c}),!_)return null;var C=()=>{l.schedule!==A_.Always&&v(!1),Y(w.current)||clearTimeout(w.current),w.current=setTimeout((()=>{w.current=void 0,m(!1)}),200)};return Jv(Fp,{children:["tab"===(null==(n=l.appearance)?void 0:n.widgetType)&&Jv("button",{className:"ph-survey-widget-tab "+((null==(s=l.appearance)?void 0:s.tabPosition)===R_.Top?"widget-tab-top":""),onClick:k,disabled:d,style:Hg(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Jv($g,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var zg=e=>{var t=e.question,r=e.onSubmit,i=e.onPreviewSubmit,n={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){i(e)},onSubmit(e){r(e)},initialValue:e.initialValue,displayQuestionIndex:e.displayQuestionIndex,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case F_.Open:return Rp(gg,v({},n,{question:t,key:t.id}));case F_.Link:return Rp(fg,v({},n,{question:t,key:t.id}));case F_.Rating:return Rp(mg,v({},n,{question:t,key:t.id}));case F_.SingleChoice:case F_.MultipleChoice:return Rp(bg,v({},n,{question:t,key:t.id}));default:return B_.error("Unsupported question type: "+t.type),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Ng,h.extendPostHogWithSurveys=Ng;var Vg=e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e},jg=1e4,Gg=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),Qg=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return Gg(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var n=0,s=Math.min(e.length,r.remaining-2);s>n;){var o=Math.ceil((n+s)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?s=o-1:n=o}return Gg(t,JSON.stringify(e.slice(0,n)),r)},Kg=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Zg=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},Yg=(e,t,r)=>{if(!r.truncated)if(K(e)){if(r.seen.has(e))return void Zg(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(Yg(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else Zg(t,e,r)},Jg=function(e,t,r,i,n,s){if(void 0===n&&(n=!1),!Kg(e))return!n||Gg(t,"null",r);if(ee(e)||(e=>{try{return re(e)||ne(e)}catch(e){return!1}})(e))return Gg(t,JSON.stringify(e),r);if("string"==typeof e)return Qg(e,t,r);if(!K(e)&&!G(e))return Gg(t,JSON.stringify(e),r);if(i.has(e))return Qg("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Q(o))return Jg(o.call(e),t,r,i,n)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return Qg(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return Gg(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return Jg(l,t,r,i,n,s)}if(G(e)){if(!Gg(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!Gg(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!Jg(d,t,r,i,!0))return!1}return Gg(t,"]",r)}if(!Gg(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var _=void 0;try{_=e[p]}catch(e){continue}if(s)try{Yg(_,p,s)}catch(e){}if(Kg(_)){var v=(h?"":",")+JSON.stringify(p)+":";if(v.length>=r.remaining)return r.truncated=!0,!1;var g=t.length,f=r.remaining,m=r.truncated;if(!Gg(t,v,r))return!1;var y=t.length,b=Jg(_,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=g,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return Gg(t,"}",r)},Xg=(e,t)=>{for(var r=[],i={remaining:t,truncated:!1},n=K(e[0])?{result:{},keysRemaining:50,sizeRemaining:jg,truncated:!1,seen:new WeakSet([e[0]])}:void 0,s=0;e.length>s&&(0>=s||Gg(r," ",i))&&Jg(e[s],r,i,new WeakSet,!1,0===s?n:void 0);s++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==n?void 0:n.result)||{}}},ef={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},tf=e=>"canCapture"in e,rf=e=>tf(e)?e.canCapture?e.getExtension(K_):void 0:e.is_capturing()?e.logs:void 0;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){var t=e,r=[],i={host:h.location.host},n=!1,s=function(e){var s=h.console[e];r.push(Dh(h.console,e,(r=>{var o=(r=>function(){for(var s=!1,o=arguments.length,a=new Array(o),l=0;o>l;l++)a[l]=arguments[l];try{var u=t;if(a.length>0&&!n&&u){var c=rf(u);if(c){n=!0,s=!0;var d=Xg(a,jg),p=d.body,_=d.attributes,g=v({},i,d.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(tf(e))t.captureConsoleLog(r);else{var i=(e=>{var t=/^1\.(\d+)\.(\d+)$/.exec(e);if(t){var r=Number(t[1]),i=Number(t[2]);if(r>=392&&419>=r)return 410===r?i>4?i>10?void 0:"de":"le":418===r?i>3?i>10?i>14?i>17?void 0:"vi":"ci":"ui":"he":419===r?i>2?void 0:"vi":410>r?"le":"he"}})(e.version),n=i?t[i]:void 0;Q(n)&&n.call(t,r)}})(u,c,{level:ef[e],body:p,attributes:v({"log.source":"console."+e},g,_)})}}}catch(e){}finally{s&&(n=!1),r.apply(h.console,a)}})(r);return o.__rrweb_original__=Vg(s),o})))};for(var o of Object.keys(ef))s(o);return()=>{t=void 0,r.forEach((e=>e()))}},replayConsoleBuffer(e,t){var r=rf(e);if(r)for(var i of t)try{var n=Xg(i.args,jg);null==r.captureBufferedConsoleLog||r.captureBufferedConsoleLog({level:ef[i.level],body:n.body,attributes:v({"log.source":"console."+i.level,host:h.location.host},n.truncated?{body_truncated:"true"}:{},n.attributes)},i.context,i.occurredAtMs)}catch(e){}}};var nf=Ur("[Error tracking]"),sf=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],of=["__firefox__","__gCrWeb"];function af(){return new lr([new Sr,new Pr,new kr,new wr,new Mr,new Ir,new Er,new Rr],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var n=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var l=yr.test(a)?a.replace(yr,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){n.push(c);break}}if(n.length>=br)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,br).map((e=>{return v({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||ur});var r}))}(n)}}("web:javascript",vr,mr))}var lf=Ur("[ExceptionAutocapture]"),uf=af(),cf=t=>{var r=e;r||lf.info("window not available, cannot wrap onerror");var i=r.onerror;return r.onerror=function(){for(var e,r=arguments.length,n=new Array(r),s=0;r>s;s++)n[s]=arguments[s];var o=uf.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],n=e[3],s=e[4];if(null!=s)return s;if(J(t)&&J(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:n})}catch(e){return t}return t})(n),{mechanism:{handled:!1}});return t(o),!!Q(i)&&null!==(e=i(...n))&&void 0!==e&&e},r.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=r.onerror)||delete e.__POSTHOG_INSTRUMENTED__,r.onerror=i}},df=function(t,r){void 0===r&&(r=!1);var i=e;i||lf.info("window not available, cannot wrap onUnhandledRejection");var n=i.onunhandledrejection;return i.onunhandledrejection=function(e){var i,s=uf.buildFromUnknown(e,{mechanism:{handled:!1}});return t(s),Q(n)?null!==(i=n(e))&&void 0!==i&&i:r},i.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=i.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,i.onunhandledrejection=n}},hf={wrapOnError:cf,wrapUnhandledRejection:df,wrapConsoleError(e){var t=console;t||lf.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,n=new Array(i),s=0;i>s;s++)n[s]=arguments[s];t=1==n.length?n[0]:n.join(" ");var o=n.find((e=>e instanceof Error)),a=uf.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),Q(r)&&r(...n)},t.error.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=t.error)||delete e.__POSTHOG_INSTRUMENTED__,t.error=r}}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=hf,h.posthogErrorWrappingFunctions=hf;var pf=(e,t)=>{if(Q(null==e?void 0:e.capture)){var r=null==t?void 0:t.autocaptureExceptions,i=!ee(r)&&"object"==typeof r&&G(r.errors_to_ignore)?r.errors_to_ignore.reduce(((e,t)=>{try{e.push(new RegExp(t))}catch(e){lf.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e}),[]):[],n=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){lf.error("Failed to capture exception for a legacy client",e)}};cf((e=>{i.some((t=>e.$exception_list.some((e=>t.test(e.value||"")))))||n(e)})),df(n,!0)}};h.extendPostHogWithExceptionAutoCapture=pf,h.extendPostHogWithExceptionAutocapture=pf;var _f="X-POSTHOG-SESSION-ID",vf="X-POSTHOG-WINDOW-ID",gf="X-POSTHOG-DISTINCT-ID",ff=[_f,vf,gf],mf=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],yf=(e,t)=>({}.hasOwnProperty.call(e,t)),bf=e=>"object"==typeof e&&!ee(e)||Q(e),Sf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),wf=t=>{try{var r;return Sf(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null==(r=e.location)?void 0:r.href).toString()}catch(e){return}},kf=(e,t,r,i,n)=>{var s;try{s=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(G(e)&&!e.includes(s))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;n.set(_f,a.sessionId),n.set(vf,l),o=!0}var u=(e=>Q(e)?e():e)(t);return u&&u!==Ss&&(n.set(gf,u),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};var Cf={_patchFetch:(t,r,i)=>Dh(e,"fetch",(e=>function(n,s){var o=arguments.length>1?[n,s]:[n],a=o;try{var l=wf(n);if(l)if(Sf(n)){var u=new Request(n,s);kf(t,r,i,u.url,u.headers),a=[u]}else{var c=new Headers(bf(s)?s.headers:void 0);if(kf(t,r,i,l,c)){var d=((e,t)=>{if(Y(e)||ee(e))return{headers:t};if(bf(e)){var r=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var i=Object.create(r);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),i}return new Proxy({headers:t},{get:(e,t)=>yf(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>yf(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach((e=>t.add(e))),mf.forEach((e=>{e in r&&t.add(e)})),Array.from(t)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i)return i;if("string"==typeof t&&mf.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var n=Reflect.getOwnPropertyDescriptor(r,t);return n?v({},n,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(s,c);d&&(a=[n,d])}}}catch(e){a=o}return e.apply(this,a)})),_patchXHR:(t,r,i)=>Dh(e.XMLHttpRequest.prototype,"open",(e=>function(n,s,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=wf(s);d&&kf(t,r,i,d,c);var h=e.call(u,n,s,o,a,l);return ff.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};h.__PosthogExtensions__.tracingHeadersPatchFns=Cf,h.postHogTracingHeadersPatchFns=Cf,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0});let Ef=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}};var Tf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},xf=e=>{if("loading"===document.readyState)return"loading";var t=Tf();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},If=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Mf=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,n=e,s=n.id?"#"+n.id:[If(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+s.length>99)return t||s;if(t=t?s+">"+t:s,n.id)break;e=n.parentNode}}catch(e){}return t},Rf=new WeakMap;function Pf(e,t){var r=Rf.get(t);return r||(r=new WeakMap,Rf.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var Ff=-1,Lf=()=>Ff,Af=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Ff=t.timeStamp,e(t))}),!0)},Of=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Df=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},Nf=()=>{var e,t;return null!==(e=null==(t=Tf())?void 0:t.activationStart)&&void 0!==e?e:0},Bf=-1,qf=new Set,Hf=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,$f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of qf)t();isFinite(Bf)||(Bf="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",$f,!0))}},Uf=function(e){if(void 0===e&&(e=!1),e&&(Bf=1/0),0>Bf){var t,r=Nf(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Bf=null!=i?i:Hf(),addEventListener("visibilitychange",$f,!0),addEventListener("prerenderingchange",$f,!0),Af((()=>{setTimeout((()=>{Bf=Hf()}))}))}return{get firstHiddenTime(){return Bf},onHidden(e){qf.add(e)}}},Wf=function(e,t,r,i,n,s,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Tf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Lf()?a&&(document.prerendering||Nf()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:n,navigationURL:s||(null==a?void 0:a.name),navigationStartTime:o||0}},zf=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{var r=e.getEntries();i.length>1&&r.sort(((e,t)=>e.startTime+e.duration-(t.startTime+t.duration))),t(r)}))}));for(var s of i)n.observe(v({type:s,buffered:!0},r));return n}}catch(e){}},Vf=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&"function"==typeof(null==(t=globalThis.PerformanceSoftNavigation)||null==(t=t.prototype)?void 0:t.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},jf=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Gf=e=>{var t=!1;return()=>{t||(e(),t=!0)}};let Qf=class{constructor(){this.u=void 0}};var Kf,Zf=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Yf=[1800,3e3],Jf=function(e,t){void 0===t&&(t={});var r=Vf(t);Zf((()=>{var i,n=Pf(t,Qf),s=Uf(),o=Wf("FCP"),a=zf(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Nf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=Of(e,o,Yf,t.reportAllChanges),Af((r=>{o=Wf("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Lf()),i=Of(e,o,Yf,t.reportAllChanges),Df((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&zf(["soft-navigation"],(r=>{r.forEach((r=>{n.u&&r.navigationId&&jf(n.u,r);var s=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=Wf("FCP",s,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Of(e,o,Yf,t.reportAllChanges))(!0)}))}),t)}))},Xf=[.1,.25],em=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],tm=0,rm=1/0,im=0,nm=e=>{for(var t of e)t.interactionId&&(rm=Math.min(rm,t.interactionId),im=Math.max(im,t.interactionId),tm=im?(im-rm)/7+1:0)},sm=()=>{var e;return Kf?tm:null!==(e=performance.interactionCount)&&void 0!==e?e:0},om=0;let am=class{constructor(){this.h=[],this.v=new Map,this.p=void 0,this.m=void 0}M(){om=sm(),this.h.length=0,this.v.clear()}T(e){var t=sm()-om,r=Math.min(this.h.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.h[r]:{D:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.h.at(-1),i=this.v.get(e.interactionId);if(i||10>this.h.length||e.duration>r.D){var n;if(i?e.duration>i.D?(i.entries=[e],i.D=e.duration):e.duration===i.D&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.v.set((i={id:e.interactionId,entries:[e],D:e.duration}).id,i),this.h.push(i)),this.h.sort(((e,t)=>t.D-e.D)),this.h.length>10){var s=this.h.splice(10);for(var o of s)this.v.delete(o.id)}null==(n=this.m)||n.call(this,i)}}}};var lm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var n=Gf(e),s=-1,o=()=>{i(s),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),s=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()}),{timeout:t})}},um=[200,500];let cm=class{constructor(){this.p=void 0,this.u=void 0}l(e){var t;null==(t=this.p)||t.call(this,e)}};var dm=[2500,4e3],hm=-1,pm=()=>hm,_m=e=>{addEventListener("pageshow",(t=>{t.persisted&&(hm=t.timeStamp,e(t))}),!0)},vm=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},gm=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},fm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},mm=()=>{var e,t;return null!==(e=null==(t=fm())?void 0:t.activationStart)&&void 0!==e?e:0},ym=-1,bm=new Set,Sm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,wm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of bm)t();isFinite(ym)||(ym="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",wm,!0))}},km=function(e){if(void 0===e&&(e=!1),e&&(ym=1/0),0>ym){var t,r=mm(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;ym=null!=i?i:Sm(),addEventListener("visibilitychange",wm,!0),addEventListener("prerenderingchange",wm,!0),_m((()=>{setTimeout((()=>{ym=Sm()}))}))}return{get firstHiddenTime(){return ym},onHidden(e){bm.add(e)}}},Cm=function(e,t,r,i,n,s,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=fm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>pm()?a&&(document.prerendering||mm()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:n,navigationURL:s||(null==a?void 0:a.name),navigationStartTime:o||0}},Em=new WeakMap;function Tm(e,t){var r=Em.get(t);return r||(r=new WeakMap,Em.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}let xm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}};var Im=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var n=new PerformanceObserver((e=>{queueMicrotask((()=>{var r=e.getEntries();i.length>1&&r.sort(((e,t)=>e.startTime+e.duration-(t.startTime+t.duration))),t(r)}))}));for(var s of i)n.observe(v({type:s,buffered:!0},r));return n}}catch(e){}},Mm=e=>{var t;return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&"function"==typeof(null==(t=globalThis.PerformanceSoftNavigation)||null==(t=t.prototype)?void 0:t.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Rm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Pm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};let Fm=class{constructor(){this.l=void 0}};var Lm,Am=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Om=[1800,3e3],Dm=function(e,t){void 0===t&&(t={});var r=Mm(t);Am((()=>{var i,n=Tm(t,Fm),s=km(),o=Cm("FCP"),a=Im(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),s.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-mm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=vm(e,o,Om,t.reportAllChanges),_m((r=>{o=Cm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pm()),i=vm(e,o,Om,t.reportAllChanges),gm((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&Im(["soft-navigation"],(r=>{r.forEach((r=>{n.l&&r.navigationId&&Rm(n.l,r);var s=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=Cm("FCP",s,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=vm(e,o,Om,t.reportAllChanges))(!0)}))}),t)}))},Nm=[.1,.25],Bm=function(e,t){void 0===t&&(t={});var r=km();Dm(Pm((()=>{var i,n=Cm("CLS",0),s=Tm(t,xm),o=(r,o,a,l,u)=>{n=Cm("CLS",0,r,o,a,l,u),s.i=0,i=vm(e,n,Nm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),s.i>n.value&&(n.value=s.i,n.entries=s.o),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?s.h(t):l(t);a()},c=["layout-shift"];Mm(t)&&c.push("soft-navigation");var d=Im(c,u);d&&(i=vm(e,n,Nm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),_m((()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,pm()),gm(i)})),setTimeout(i))})))},qm=0,Hm=1/0,$m=0,Um=e=>{for(var t of e)t.interactionId&&(Hm=Math.min(Hm,t.interactionId),$m=Math.max($m,t.interactionId),qm=$m?($m-Hm)/7+1:0)},Wm=()=>{var e;return Lm?qm:null!==(e=performance.interactionCount)&&void 0!==e?e:0},zm=0;let Vm=class{constructor(){this.u=[],this.v=new Map,this.m=void 0,this.p=void 0}T(){zm=Wm(),this.u.length=0,this.v.clear()}M(e){var t=Wm()-zm,r=Math.min(this.u.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.u[r]:{_:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.u.at(-1),i=this.v.get(e.interactionId);if(i||10>this.u.length||e.duration>r._){var n;if(i?e.duration>i._?(i.entries=[e],i._=e.duration):e.duration===i._&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.v.set((i={id:e.interactionId,entries:[e],_:e.duration}).id,i),this.u.push(i)),this.u.sort(((e,t)=>t._-e._)),this.u.length>10){var s=this.u.splice(10);for(var o of s)this.v.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}};var jm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var n=Pm(e),s=-1,o=()=>{i(s),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),s=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()}),{timeout:t})}},Gm=[200,500],Qm=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=km();Am((()=>{var i;"interactionCount"in performance||Lm||(Lm=Im(["event"],Um,{durationThreshold:0}));var n,s=Cm("INP"),o=Tm(t,Vm),a=(r,i,a,l,u)=>{o.T(),s=Cm("INP",-1,r,i,a,l,u),n=vm(e,s,Gm,t.reportAllChanges)},l=()=>{var e=o.M(s.navigationType);e&&e._!==s.value&&(s.value=e._,s.entries=e.entries,n())},u=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),jm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.h(r):u(r);l(),t&&n(!0)}))},d=["event","first-input"];Mm(t)&&d.push("soft-navigation");var h=Im(d,c,v({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));n=vm(e,s,Gm,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),_m((()=>{a("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,pm())})))}))}};let Km=class{constructor(){this.m=void 0,this.l=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}};var Zm=[2500,4e3],Ym=function(e,t){void 0===t&&(t={});var r=!1,i=Mm(t);Am((()=>{var n,s=km(),o=Cm("LCP"),a=Tm(t,Km),l=(i,a,l,u,c)=>{o=Cm("LCP",-1,i,a,l,u,c),n=vm(e,o,Zm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(s=km(!0))},u=e=>{a.l&&e.navigationId&&Rm(a.l,e),r||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&c([t])},c=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,c=[],d=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-mm(),0),a.h(r),c=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;d=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(d-r.startTime,0),p.largestContentfulPaint&&(a.h(p.largestContentfulPaint),c=[p.largestContentfulPaint])}s.firstHiddenTime>d&&(o.value=l,o.entries=c,n())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=Im(d,c);if(h){n=vm(e,o,Zm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;jm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,n(!0))}}))}};for(var v of p)addEventListener(v,_,{capture:!0});_m((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,pm()),n=vm(e,o,Zm,t.reportAllChanges),gm((()=>{o.value=performance.now()-i.timeStamp,r=!0,n(!0)}))}))}}))},Jm={onLCP(e,t){void 0===t&&(t={});var r=Pf(t=Object.assign({},t),cm),i=new WeakMap;Vf(t)&&(r.u=new Map),r.p=e=>{var r=e.element;if(r){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==n?n:Mf(r);i.set(e,s)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=Vf(t);Zf((()=>{var n,s=Uf(),o=Wf("LCP"),a=Pf(t,cm),l=(i,a,l,u,c)=>{o=Wf("LCP",-1,i,a,l,u,c),n=Of(e,o,dm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(s=Uf(!0))},u=e=>{a.u&&e.navigationId&&jf(a.u,e),r||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&c([t])},c=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,c=[],d=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-Nf(),0),a.l(r),c=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;d=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(d-r.startTime,0),p.largestContentfulPaint&&(a.l(p.largestContentfulPaint),c=[p.largestContentfulPaint])}s.firstHiddenTime>d&&(o.value=l,o.entries=c,n())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=zf(d,c);if(h){n=Of(e,o,dm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;lm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,n(!0))}}))}};for(var v of p)addEventListener(v,_,{capture:!0});Af((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Lf()),n=Of(e,o,dm,t.reportAllChanges),Df((()=>{o.value=performance.now()-i.timeStamp,r=!0,n(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,s,o,a,l,u,c=e.entries.at(-1),d=c.url&&performance.getEntriesByType("resource").find((e=>e.name===c.url));t.target=i.get(c),t.lcpEntry=c,c.url&&(t.url=c.url),d&&(t.lcpResourceEntry=d);var h=0,p=0;if("soft-navigation"!==e.navigationType?(h=null!==(n=null==(s=u=Tf())?void 0:s.activationStart)&&void 0!==n?n:0,p=null!==(o=null==(a=u)?void 0:a.responseStart)&&void 0!==o?o:0):(h=e.navigationStartTime||0,u=null==(l=r.u)?void 0:l.get(e.navigationId)),u){var _=Math.max(0,p-h),g=Math.max(_,d?(d.requestStart||d.startTime)-h:0),f=Math.min(e.value,Math.max(g,d?d.responseEnd-h:0));t=v({},t,{timeToFirstByte:_,resourceLoadDelay:g-_,resourceLoadDuration:f-g,elementRenderDelay:e.value-f,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))}),t)},onCLS(e,t){void 0===t&&(t={});var r=Pf(t=Object.assign({},t),Ef),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var n=em(e.sources),s=null==n?void 0:n.node;if(s){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(s))&&void 0!==o?o:Mf(s);i.set(n,a)}}},function(e,t){void 0===t&&(t={});var r=Uf();Jf(Gf((()=>{var i,n=Wf("CLS",0),s=Pf(t,Ef),o=(r,o,a,l,u)=>{n=Wf("CLS",0,r,o,a,l,u),s.o=0,i=Of(e,n,Xf,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),s.o>n.value&&(n.value=s.o,n.entries=s.i),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?s.l(t):l(t);a()},c=["layout-shift"];Vf(t)&&c.push("soft-navigation");var d=zf(c,u);d&&(i=Of(e,n,Xf,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),Af((()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Lf()),Df(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,n=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=n&&null!=(r=n.sources)&&r.length){var s=em(n.sources);s&&(t={largestShiftTarget:i.get(s),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:s,largestShiftEntry:n,loadState:xf(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},onFCP(e,t){void 0===t&&(t={});var r=Pf(t=Object.assign({},t),Qf);Vf(t)&&(r.u=new Map),Jf((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:xf(Lf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=Tf(),n=e.entries.at(-1);if(i){var s=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:s,firstByteToFCP:e.value-s,loadState:xf(e.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var o,a=null==(o=r.u)?void 0:o.get(e.navigationId);a&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:a})}return Object.assign(e,{attribution:t})})(t))}),t)},onINP(e,t){void 0===t&&(t={});var r=Pf(t=Object.assign({},t),am),i=[],n=[],s=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(lm(c),l=!0)},c=()=>{var e=new Set(r.h.map((e=>o.get(e.entries[0])))),t=n.length-10;n=n.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of n){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>s||a.has(e))),l=!1};r.p=e=>{var r,i=e.startTime+e.duration;s=Math.max(s,e.processingEnd);for(var a=n.length-1;a>=0;a--){var l=n[a];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||n.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),(e.interactionId||"first-input"===e.entryType)&&o.set(e,r),u()},r.m=e=>{if(!a.get(e)){var r,i=null==(r=e.entries.find((e=>e.target)))?void 0:r.target;if(i){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==n?n:Mf(i);a.set(e,s)}else{var o,l=null==(o=e.entries.find((e=>e.targetSelector)))?void 0:o.targetSelector;l&&a.set(e,l)}}};var d=(e,t)=>{var r=[];for(var n of i)if(n.startTime+n.duration>=e){if(n.startTime>t)break;r.push(n)}return r};zf(["long-animation-frame"],(e=>{i=i.concat(e),u()}),t),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Uf();Zf((()=>{var i;"interactionCount"in performance||Kf||(Kf=zf(["event"],nm,{durationThreshold:0}));var n,s=Wf("INP"),o=Pf(t,am),a=(r,i,a,l,u)=>{o.M(),s=Wf("INP",-1,r,i,a,l,u),n=Of(e,s,um,t.reportAllChanges)},l=()=>{var e=o.T(s.navigationType);e&&e.D!==s.value&&(s.value=e.D,s.entries=e.entries,n())},u=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),lm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.l(r):u(r);l(),t&&n(!0)}))},d=["event","first-input"];Vf(t)&&d.push("soft-navigation");var h=zf(d,c,v({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));n=Of(e,s,um,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),Af((()=>{a("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Lf())})))}))}}((t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:xf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],n=o.get(i),s=n.processingStart,l=Math.max(i.startTime+i.duration,s),u=Math.min(n.processingEnd,l),c=n.entries.sort(((e,t)=>e.processingStart-t.processingStart)),h=d(i.startTime,u),p=r.v.get(i.interactionId),_={interactionTarget:a.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:h,inputDelay:s-i.startTime,processingDuration:u-s,presentationDelay:l-u,loadState:xf(i.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{var r=e.interactionTime,i=e.nextPaintTime;if(null!=(t=e.longAnimationFrameEntries)&&t.length&&r&&i){var n,s,o=e.inputDelay,a=e.processingDuration,l=0,u=0,c=0,d=0;for(var h of e.longAnimationFrameEntries)for(var p of(u=u+h.startTime+h.duration-h.styleAndLayoutStart,h.scripts)){var _=p.startTime+p.duration;if(_>=r){var v=_-Math.max(r,p.startTime),g=p.duration?v/p.duration*p.forcedStyleAndLayoutDuration:0;l+=v-g,u+=g,v>d&&(s=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",n=p,d=v)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(c=i-m),n&&s&&(e.longestScript={entry:n,subpart:s,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=c,e.totalUnattributedDuration=i-r-l-u-c}})(_),Object.assign(e,{attribution:_})})(t))}),t)},withoutAttribution:{onLCP:Ym,onCLS:Bm,onFCP:Dm,onINP:Qm}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Jm,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Jm,h.postHogWebVitalsCallbacks=Jm;var Xm={onLCP:Ym,onCLS:Bm,onFCP:Dm,onINP:Qm};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Xm,h.__PosthogExtensions__.postHogWebVitalsCallbacks=Xm,h.postHogWebVitalsCallbacks=Xm,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Xm;let ey=class{constructor(){this.t=void 0,this.o=0,this.i=[]}u(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}};var ty=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ry=e=>{if("loading"===document.readyState)return"loading";var t=ty();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},iy=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},ny=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i=e,n=i.id?"#"+i.id:[iy(i),...Array.from(i.classList).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,i.id)break;e=i.parentNode}}catch(e){}return t},sy=new WeakMap;function oy(e,t){var r=sy.get(t);return r||(r=new WeakMap,sy.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var ay,ly=-1,uy=()=>ly,cy=e=>{addEventListener("pageshow",(t=>{t.persisted&&(ly=t.timeStamp,e(t))}),!0)},dy=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},hy=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},py=()=>{var e,t;return null!==(e=null==(t=ty())?void 0:t.activationStart)&&void 0!==e?e:0},_y=function(e,t){void 0===t&&(t=-1);var r=ty(),i="navigate";return 0>uy()?r&&(document.prerendering||py()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},vy=function(e,t,r){void 0===r&&(r={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return i.observe(v({type:e,buffered:!0},r)),i}}catch(e){}},gy=e=>{var t=!1;return()=>{t||(e(),t=!0)}},fy=-1,my=new Set,yy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,by=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of my)t();isFinite(fy)||(fy="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",by,!0))}},Sy=()=>{if(0>fy){var e,t=py(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;fy=null!=r?r:yy(),addEventListener("visibilitychange",by,!0),addEventListener("prerenderingchange",by,!0),cy((()=>{setTimeout((()=>{fy=yy()}))}))}return{get firstHiddenTime(){return fy},onHidden(e){my.add(e)}}},wy=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ky=[1800,3e3],Cy=function(e,t){void 0===t&&(t={}),wy((()=>{var r,i=Sy(),n=_y("FCP"),s=vy("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-py(),0),n.entries.push(t),r(!0)))}));s&&(r=dy(e,n,ky,t.reportAllChanges),cy((i=>{n=_y("FCP"),r=dy(e,n,ky,t.reportAllChanges),hy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},Ey=[.1,.25],Ty=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],xy=0,Iy=1/0,My=0,Ry=e=>{for(var t of e)t.interactionId&&(Iy=Math.min(Iy,t.interactionId),My=Math.max(My,t.interactionId),xy=My?(My-Iy)/7+1:0)},Py=()=>{var e;return ay?xy:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Fy=0;let Ly=class{constructor(){this.l=[],this.h=new Map,this.m=void 0,this.p=void 0}v(){Fy=Py(),this.l.length=0,this.h.clear()}M(){var e=Math.min(this.l.length-1,Math.floor((Py()-Fy)/50));return this.l[e]}u(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.h.get(e.interactionId);if(i||10>this.l.length||e.duration>r.T){var n;if(i?e.duration>i.T?(i.entries=[e],i.T=e.duration):e.duration===i.T&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.h.set((i={id:e.interactionId,entries:[e],T:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.T-e.T)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.h.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}};var Ay=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=gy(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},Oy=[200,500];let Dy=class{constructor(){this.m=void 0}u(e){var t;null==(t=this.m)||t.call(this,e)}};var $=[2500,4e3],Ny=-1,By=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Ny=t.timeStamp,e(t))}),!0)},qy=(e,t,r,i)=>{var n,s;return o=>{t.value>=0&&(o||i)&&((s=t.value-(null!=n?n:0))||void 0===n)&&(n=t.value,t.delta=s,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Hy=e=>{requestAnimationFrame((()=>requestAnimationFrame(e)))},$y=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Uy=()=>{var e,t;return null!==(e=null==(t=$y())?void 0:t.activationStart)&&void 0!==e?e:0},Wy=function(e,t){void 0===t&&(t=-1);var r=$y(),i="navigate";return 0>Ny?r&&(document.prerendering||Uy()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))):i="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v5-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},zy=new WeakMap;function Vy(e,t){var r=zy.get(t);return r||(r=new WeakMap,zy.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class jy{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}}var Gy,Qy=function(e,t,r){void 0===r&&(r={});try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((e=>{queueMicrotask((()=>{t(e.getEntries())}))}));return i.observe(v({type:e,buffered:!0},r)),i}}catch(e){}},Ky=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Zy=-1,Yy=new Set,Jy=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Xy=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Yy)t();isFinite(Zy)||(Zy="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Xy,!0))}},eb=()=>{if(0>Zy){var e,t=Uy(),r=document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=t)))?void 0:e.startTime;Zy=null!=r?r:Jy(),addEventListener("visibilitychange",Xy,!0),addEventListener("prerenderingchange",Xy,!0),By((()=>{setTimeout((()=>{Zy=Jy()}))}))}return{get firstHiddenTime(){return Zy},onHidden(e){Yy.add(e)}}},tb=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},rb=[1800,3e3],ib=function(e,t){void 0===t&&(t={}),tb((()=>{var r,i=eb(),n=Wy("FCP"),s=Qy("paint",(e=>{for(var t of e)"first-contentful-paint"===t.name&&(s.disconnect(),i.firstHiddenTime>t.startTime&&(n.value=Math.max(t.startTime-Uy(),0),n.entries.push(t),r(!0)))}));s&&(r=qy(e,n,rb,t.reportAllChanges),By((i=>{n=Wy("FCP"),r=qy(e,n,rb,t.reportAllChanges),Hy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))})))}))},nb=[.1,.25],sb=function(e,t){void 0===t&&(t={});var r=eb();ib(Ky((()=>{var i,n=Wy("CLS",0),s=Vy(t,jy),o=e=>{for(var t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=Qy("layout-shift",o);a&&(i=qy(e,n,nb,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),By((()=>{s.i=0,n=Wy("CLS",0),i=qy(e,n,nb,t.reportAllChanges),Hy(i)})),setTimeout(i))})))},ob=0,ab=1/0,lb=0,ub=e=>{for(var t of e)t.interactionId&&(ab=Math.min(ab,t.interactionId),lb=Math.max(lb,t.interactionId),ob=lb?(lb-ab)/7+1:0)},cb=()=>{var e;return Gy?ob:null!==(e=performance.interactionCount)&&void 0!==e?e:0},db=0;class hb{constructor(){this.l=[],this.u=new Map,this.m=void 0,this.p=void 0}v(){db=cb(),this.l.length=0,this.u.clear()}T(){var e=Math.min(this.l.length-1,Math.floor((cb()-db)/50));return this.l[e]}h(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId||"first-input"===e.entryType){var r=this.l.at(-1),i=this.u.get(e.interactionId);if(i||10>this.l.length||e.duration>r.L){var n;if(i?e.duration>i.L?(i.entries=[e],i.L=e.duration):e.duration===i.L&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.u.set((i={id:e.interactionId,entries:[e],L:e.duration}).id,i),this.l.push(i)),this.l.sort(((e,t)=>t.L-e.L)),this.l.length>10){var s=this.l.splice(10);for(var o of s)this.u.delete(o.id)}null==(n=this.p)||n.call(this,i)}}}}var pb=e=>{var t=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var i=Ky(e),n=-1,s=()=>{r(n),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),n=t((()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()}))}},_b=[200,500],vb=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=eb();tb((()=>{var i;"interactionCount"in performance||Gy||(Gy=Qy("event",ub,{durationThreshold:0}));var n,s=Wy("INP"),o=Vy(t,hb),a=e=>{pb((()=>{for(var t of e)o.h(t);var r=o.T();r&&r.L!==s.value&&(s.value=r.L,s.entries=r.entries,n())}))},l=Qy("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=qy(e,s,_b,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),By((()=>{o.v(),s=Wy("INP"),n=qy(e,s,_b,t.reportAllChanges)})))}))}};class gb{constructor(){this.m=void 0}h(e){var t;null==(t=this.m)||t.call(this,e)}}var fb=[2500,4e3],mb=function(e,t){void 0===t&&(t={}),tb((()=>{var r,i=eb(),n=Wy("LCP"),s=Vy(t,gb),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.h(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-Uy(),0),n.entries=[o],r())},a=Qy("largest-contentful-paint",o);if(a){r=qy(e,n,fb,t.reportAllChanges);var l=Ky((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(pb(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});By((i=>{n=Wy("LCP"),r=qy(e,n,fb,t.reportAllChanges),Hy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))},yb={onLCP(e,t){void 0===t&&(t={});var r=oy(t=Object.assign({},t),Dy),i=new WeakMap;r.m=e=>{var r=e.element;if(r){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==n?n:ny(r);i.set(e,s)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={}),wy((()=>{var r,i=Sy(),n=_y("LCP"),s=oy(t,Dy),o=e=>{for(var o of(t.reportAllChanges||(e=e.slice(-1)),e))s.u(o),i.firstHiddenTime>o.startTime&&(n.value=Math.max(o.startTime-py(),0),n.entries=[o],r())},a=vy("largest-contentful-paint",o);if(a){r=dy(e,n,$,t.reportAllChanges);var l=gy((()=>{o(a.takeRecords()),a.disconnect(),r(!0)})),u=e=>{e.isTrusted&&(Ay(l),removeEventListener(e.type,u,{capture:!0}))};for(var c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});cy((i=>{n=_y("LCP"),r=dy(e,n,$,t.reportAllChanges),hy((()=>{n.value=performance.now()-i.timeStamp,r(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var r=e.entries.at(-1),n=r.url&&performance.getEntriesByType("resource").find((e=>e.name===r.url));t.target=i.get(r),t.lcpEntry=r,r.url&&(t.url=r.url),n&&(t.lcpResourceEntry=n);var s=ty();if(s){var o=s.activationStart||0,a=Math.max(0,s.responseStart-o),l=Math.max(a,n?(n.requestStart||n.startTime)-o:0),u=Math.min(e.value,Math.max(l,n?n.responseEnd-o:0));t=v({},t,{timeToFirstByte:a,resourceLoadDelay:l-a,resourceLoadDuration:u-l,elementRenderDelay:e.value-u,navigationEntry:s})}}return Object.assign(e,{attribution:t})})(t))}),t)},onCLS(e,t){void 0===t&&(t={});var r=oy(t=Object.assign({},t),ey),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var n=Ty(e.sources),s=null==n?void 0:n.node;if(s){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(s))&&void 0!==o?o:ny(s);i.set(n,a)}}},function(e,t){void 0===t&&(t={});var r=Sy();Cy(gy((()=>{var i,n=_y("CLS",0),s=oy(t,ey),o=e=>{for(var t of e)s.u(t);s.o>n.value&&(n.value=s.o,n.entries=s.i,i())},a=vy("layout-shift",o);a&&(i=dy(e,n,Ey,t.reportAllChanges),r.onHidden((()=>{o(a.takeRecords()),i(!0)})),cy((()=>{s.o=0,n=_y("CLS",0),i=dy(e,n,Ey,t.reportAllChanges),hy(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,n=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=n&&null!=(r=n.sources)&&r.length){var s=Ty(n.sources);s&&(t={largestShiftTarget:i.get(s),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:s,largestShiftEntry:n,loadState:ry(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},onFCP(e,t){void 0===t&&(t={}),Cy((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:ry(uy())};if(e.entries.length){var r=ty(),i=e.entries.at(-1);if(r){var n=Math.max(0,r.responseStart-(r.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:ry(e.entries[0].startTime),navigationEntry:r,fcpEntry:i}}}return Object.assign(e,{attribution:t})})(t))}),t)},onINP(e,t){void 0===t&&(t={});var r=oy(t=Object.assign({},t),Ly),i=[],n=[],s=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(Ay(c),l=!0)},c=()=>{var e=new Set(r.l.map((e=>o.get(e.entries[0])))),t=n.length-10;n=n.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of n){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>s||a.has(e))),l=!1};r.m=e=>{var r,i=e.startTime+e.duration;s=Math.max(s,e.processingEnd);for(var a=n.length-1;a>=0;a--){var l=n[a];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),!1!==t.includeProcessedEventEntries&&r.entries.push(e);break}}r||n.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:!1!==t.includeProcessedEventEntries?[e]:[]}),(e.interactionId||"first-input"===e.entryType)&&o.set(e,r),u()},r.p=e=>{if(!a.get(e)){var r,i=null==(r=e.entries.find((e=>e.target)))?void 0:r.target;if(i){var n,s=null!==(n=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==n?n:ny(i);a.set(e,s)}else{var o,l=null==(o=e.entries.find((e=>e.targetSelector)))?void 0:o.targetSelector;l&&a.set(e,l)}}};var d=(e,t)=>{var r=[];for(var n of i)if(n.startTime+n.duration>=e){if(n.startTime>t)break;r.push(n)}return r};vy("long-animation-frame",(e=>{i=i.concat(e),u()})),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Sy();wy((()=>{var i;"interactionCount"in performance||ay||(ay=vy("event",Ry,{durationThreshold:0}));var n,s=_y("INP"),o=oy(t,Ly),a=e=>{Ay((()=>{for(var t of e)o.u(t);var r=o.M();r&&r.T!==s.value&&(s.value=r.T,s.entries=r.entries,n())}))},l=vy("event",a,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40});n=dy(e,s,Oy,t.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(l.takeRecords()),n(!0)})),cy((()=>{o.v(),s=_y("INP"),n=dy(e,s,Oy,t.reportAllChanges)})))}))}}((t=>{e((e=>{var t=e.entries[0],i=o.get(t),n=t.processingStart,s=Math.max(t.startTime+t.duration,n),l=Math.min(i.processingEnd,s),u=i.entries.sort(((e,t)=>e.processingStart-t.processingStart)),c=d(t.startTime,l),h=r.h.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:s,processedEventEntries:u,longAnimationFrameEntries:c,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:s-l,loadState:ry(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{if(null!=(t=e.longAnimationFrameEntries)&&t.length){var r,i,n=e.interactionTime,s=e.inputDelay,o=e.processingDuration,a=0,l=0,u=0,c=0;for(var d of e.longAnimationFrameEntries)for(var h of(l=l+d.startTime+d.duration-d.styleAndLayoutStart,d.scripts)){var p=h.startTime+h.duration;if(p>=n){var _=p-Math.max(n,h.startTime),v=h.duration?_/h.duration*h.forcedStyleAndLayoutDuration:0;a+=_-v,l+=v,_>c&&(i=n+s>h.startTime?"input-delay":n+s+o>h.startTime?"processing-duration":"presentation-delay",r=h,c=_)}}var g=e.longAnimationFrameEntries.at(-1),f=g?g.startTime+g.duration:0;f>=n+s+o&&(u=e.nextPaintTime-f),r&&i&&(e.longestScript={entry:r,subpart:i,intersectingDuration:c}),e.totalScriptDuration=a,e.totalStyleAndLayoutDuration=l,e.totalPaintDuration=u,e.totalUnattributedDuration=e.nextPaintTime-n-a-l-u}})(p),Object.assign(e,{attribution:p})})(t))}),t)},withoutAttribution:{onLCP:mb,onCLS:sb,onFCP:ib,onINP:vb}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=yb,h.__PosthogExtensions__.postHogWebVitalsCallbacks=yb,h.postHogWebVitalsCallbacks=yb;var bb={onLCP:mb,onCLS:sb,onFCP:ib,onINP:vb};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=bb,h.__PosthogExtensions__.postHogWebVitalsCallbacks=bb,h.postHogWebVitalsCallbacks=bb,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>bb;class Sb{constructor(e){this.disabled=!1===e;var t=K(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,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var wb="$copy_autocapture",kb=Ur("[AutoCapture]");function Cb(e,t){return t.length>e?t.slice(0,e)+"...":t}function Eb(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!gi(t));return t}function Tb(t,r){var i,n,s=r.e,o=r.maskAllElementAttributes,a=r.maskAllText,l=r.elementAttributeIgnoreList,u=r.elementsChainAsString,c=r.disableCaptureUrlHashes;if(!gi(t))return{props:{}};for(var d=[t],h=new Set([t]),p=t;p.parentNode&&!fi(p,"body")&&bi>d.length;)if(yi(p.parentNode)){var _=p.parentNode.host;if(h.has(_))break;h.add(_),d.push(_),p=_}else{if(!gi(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var g,f,m=[],y={},b=!1,S=!1;if(zr(d,(e=>{var t=Hi(e);if(fi(e,"a")){var r=e.getAttribute("href");b=!!(t&&r&&Ki(r))&&(c?Tt(r):r)}q(ki(e),"ph-no-capture")&&(S=!0),m.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};xi.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Cb(1024,Zi(e)):Cb(1024,Ei(e)));var a=ki(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),zr(e.attributes,(function(r){var s;if((!$i(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Ki(r.value)&&(!J(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=Si(a).join(" ")),o["attr__"+r.name]=Cb(1024,"href"===r.name&&n?Tt(a):a)}}));for(var l=1,u=1,c=e;c=Eb(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,l,c));var i=function(e){if(!Hi(e))return{};var t={};return zr(e.attributes,(function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Ki(i)&&(t[r]=i)}})),t}(e);Vr(y,i)})),S)return{props:{},explicitNoCapture:S};if(a||(m[0].$el_text=fi(t,"a")||fi(t,"button")?Zi(t):Ei(t)),b){var w,k;m[0].attr__href=b;var C=null==(w=ri(b))?void 0:w.host,E=null==e||null==(k=e.location)?void 0:k.host;C&&E&&C!==E&&(g=b)}return{props:Vr({$event_type:s.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(f=m,function(e){return e.map((e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))i+="."+n.replace(/"/g,"");var s=v({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return jr(s).sort(((e,t)=>e[0].localeCompare(t[0]))).forEach((e=>{var t=e[1];return o[Ji(e[0].toString())]=Ji(t.toString())})),(i+=":")+jr(o).map((e=>e[0]+'="'+e[1]+'"')).join("")})).join(";")}(function(e){return e.map((e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Xi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return jr(e).filter((e=>0===e[0].indexOf("attr__"))).forEach((e=>i.attributes[e[0]]=e[1])),i}))}(f)))},null!=(i=m[0])&&i.$el_text?{$el_text:null==(n=m[0])?void 0:n.$el_text}:{},g&&"click"===s.type?{$external_click_url:g}:{},y)}}class xb{constructor(e){this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource=e,this._configSource.refresh(this._config),this.rageclicks=new Sb(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null==(e=this._config.url_allowlist)?void 0:e.map((e=>new RegExp(e))),this._config.url_ignorelist=null==(t=this._config.url_ignorelist)?void 0:t.map((e=>new RegExp(e))),this._config}_addDomEventHandlers(){if(this.isBrowserSupported()){if(e&&i){var t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t)}catch(e){kb.error("Failed to capture event",e)}};if(Jr(i,"submit",t,{capture:!0}),Jr(i,"change",t,{capture:!0}),Jr(i,"click",t,{capture:!0}),this._refreshConfig().capture_copied_text){var r=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,wb)}catch(e){kb.error("Failed to capture clipboard event",e)}};Jr(i,"copy",r,{capture:!0}),Jr(i,"cut",r,{capture:!0}),Jr(i,"paste",r,{capture:!0})}}}else kb.info("Disabling Automatic Event Collection because this browser is not supported")}_removeDomEventHandlers(){this._domEventHandler&&(null==i||i.removeEventListener("submit",this._domEventHandler,!0),null==i||i.removeEventListener("change",this._domEventHandler,!0),null==i||i.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==i||i.removeEventListener("copy",this._copiedTextHandler,!0),null==i||i.removeEventListener("cut",this._copiedTextHandler,!0),null==i||i.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(!this._disposed)if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r,i=t.autocapture_opt_out;ne(i)&&(null==(r=this._client)||r.kv.set(bn,i),this._isDisabledServerSide=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var n=null==i?void 0:i.querySelectorAll(t);null==n||n.forEach((i=>{e===i&&r.push(t)}))})),r}get isEnabled(){var e,t;if(this._disposed)return!1;var r=null==(e=this._client)?void 0:e.kv.get(bn),i=this._isDisabledServerSide,n=this._refreshConfig(),s=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(ee(i)&&!ne(r)&&!s)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!n.enabled&&!o}_captureEvent(t,r){if(void 0===r&&(r="$autocapture"),this.isEnabled){var i=Ti(t);mi(i)&&(i=i.parentNode||null);var n,s=this._compileUrlPatterns();"$autocapture"===r&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Ni(i,s.rageclick)&&this._captureEvent(t,"$rageclick");var o=r===wb,a=o?v({},s,{dom_event_allowlist:void 0}):s;if(i&&function(t,r,i,n,s,o){var a;if(!e||Bi(t))return!1;if(null!=i&&i.url_allowlist&&!wi(i.url_allowlist,o))return!1;if(null!=i&&i.url_ignorelist&&wi(i.url_ignorelist,o))return!1;if(null!=i&&i.dom_event_allowlist){var l=i.dom_event_allowlist;if(l&&!l.some((e=>r.type===e)))return!1}var u=qi(t,n),c=u.parentIsUsefulElement,d=u.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(Y(r))return!0;var i,n=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var s of e)if(i=n(s))return i.v;return!1}(d,i))return!1;if(!Ii(d,null==i?void 0:i.css_selector_allowlist))return!1;if(Ii(d,null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:Ri))return!1;try{var h=e.getComputedStyle(t);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===r.type)return!0}catch(e){}var p=t.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(r.type)>=0;default:return c?(s||["click"]).indexOf(r.type)>=0:(s||["click"]).indexOf(r.type)>=0&&(xi.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var l,u=Tb(i,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),c=u.props;if(u.explicitNoCapture)return!1;var d=this.getElementSelectors(i);if(d&&d.length>0&&(c.$element_selectors=d),r===wb){var h=t.type||"clipboard";if("paste"!==h){var p,_,g=null==e||null==(p=e.getSelection())?void 0:p.toString(),f=Ci(g);if(!f)return!1;c.$selected_content=f,c.$clipboard_text_length=null!==(_=null==g?void 0:g.length)&&void 0!==_?_:0}c.$copy_type=h}return null==(l=this._client)||l.capture(r,c).catch((e=>kb.error("Failed to capture event",e))),!0}}}isBrowserSupported(){return Q(null==i?void 0:i.querySelectorAll)}}var Ib={};function Mb(t,r){var i=Ib[t];if(i)return i;var n=r[t];if((e=>Q(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&(null==e||!e.Zone))return Ib[t]=n.bind(r);var s=r.document;if(s&&Q(s.createElement)){var o,a=!1;try{(o=s.createElement("iframe")).hidden=!0,s.head.appendChild(o);var l,u,c=o.contentWindow;c&&c[t]&&(n=c[t],"MutationObserver"===t&&function(e){return q(e,"AppleWebKit")&&!q(e,"Chrome")}(null!==(l=null==(u=r.navigator)?void 0:u.userAgent)&&void 0!==l?l:"")&&(o.classList.add("rr-block","ph-no-capture"),a=!0))}catch(e){$r.warn("Could not create sandbox iframe for "+t+" check, bailing to assignableWindow."+t+": ",e)}finally{var d;!a&&null!=(d=o)&&d.parentNode&&o.parentNode.removeChild(o)}}return n&&Q(n)?Ib[t]=n.bind(r):n}function Rb(e,t){var r=Ti(e);return r?v({node:r,originalEvent:e,timestamp:Date.now()},t):null}function Pb(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Fb(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var Lb="canvas,video,audio,embed,object",Ab=1e3;function Ob(e,t){return re(e)&&e>=t}function Db(e){return e>=0&&Ab>e?e:void 0}function Nb(e,t){return t?Db(e-t):void 0}class Bb{_asRequiredConfig(e){var t,r,i,n,s,o,a,l,u=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(s=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==s?s:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:e}),this._onClick=e=>{var t=Rb(e,{type:"click"});ee(t)||this._ignore(t)||this._queueCandidate(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach((t=>{Y(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)}))},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{var e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{var e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!Y(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var n=e,s=null==(t=n.changedTouches)?void 0:t[0];if(s){var o=s.clientX-r.x,a=s.clientY-r.y,l=o*o+a*a,u=this._config.swipe_threshold_px;if(l>=u*u&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some((e=>re(e)&&e>=r.timestamp))){var c;if(this._pageHasUnobservableSurfaces()&&(null!==(c=null==i||null==i.elementsFromPoint?void 0:i.elementsFromPoint(r.x,r.y))&&void 0!==c?c:[]).some((e=>null==e.matches?void 0:e.matches(Lb))))return;var d=Rb(n,{type:"swipe",swipeDirection:Pb(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});ee(d)||this._ignore(d)||this._queueCandidate(d),this._scheduleCheck()}}}},this.instance=e,this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return Mb("MutationObserver",e)}(h);this._mutationObserver=new t((e=>{this._onMutation(e)})),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null==(e=this._mutationObserver)||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick),h.removeEventListener("scroll",this._onScroll,{capture:!0}),h.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==i||i.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Jr(h,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=Nb(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Nb(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Y(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){Jr(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Jr(h,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Jr(i,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Jr(h,"blur",this._onFocusChange),Jr(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach((r=>{var i=Db(t-r.timestamp);re(i)&&(Y(r[e])||r[e]>i)&&(r[e]=i)}))}_startSwipeObserver(){Jr(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Jr(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Jr(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=Y(this._surfacesCheckedAt)||re(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Y(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==i||!i.querySelector(Lb))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){if(vi(t.node))return!0;var r=this._clicks.some((e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp)));return!(!r&&!fi(t.node,"html")&&gi(t.node)&&function(t,r){var i;if(!e||Bi(t))return!1;var n=ne(r)?Ai:null!==(i=null==r?void 0:r.css_selector_ignorelist)&&void 0!==i?i:Ai;return!Ii(qi(t,!1).targetElementList,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(r=t.originalEvent,!(r.ctrlKey||r.metaKey||r.altKey||r.shiftKey)))||!!this._ignoreCommon(t)||(i=t.node,!(!e||Bi(i))&&qi(i,!1).targetElementList.some((e=>fi(e,"a"))));var r,i}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0;var i=Ob(t.scrollDelayMs,this._config.scroll_threshold_ms),n=Ob(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),s=Ob(t.mutationDelayMs,this._config.mutation_threshold_ms),o=Ob(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=re(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=re(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=re(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,c=re(t.visibilityChangedDelayMs),d=re(t.focusChangedDelayMs);if(!(a||l||u||c||d))if(i||s||o||n){var h=Fb(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:s,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:n,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=Fb(e);this.instance.capture(r,v({},t,Tb(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[r+"_scroll_delay_ms"]:e.scrollDelayMs,[r+"_mutation_delay_ms"]:e.mutationDelayMs,[r+"_absolute_delay_ms"]:e.absoluteDelayMs,[r+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[r+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,[r+"_focus_changed_delay_ms"]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}}h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new Bb(e,t);class qb{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===Ds||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Os}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return _e(e)?1:q(ve,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?av:sv;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var r="localStorage"===e?sv:av;r._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(_e(r._get(this._storageKey))),r._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,h.doNotTrack].some((e=>_e(e)))}}var Hb=Ur("[Dead Clicks]"),$b=()=>!0,Ub=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Tn)),i=e.instance.config.capture_dead_clicks;return ne(i)?i:!!K(i)||r};class Wb{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Tn]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Hb.error("failed to load script",t):e()}))}_start(){var e;if(i){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=K(this.instance.config.capture_dead_clicks)?v({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(i),Hb.info("starting...")}}else Hb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Hb.info("stopping..."))}}var zb=Ur("[SegmentIntegration]");var Vb="posthog-js";function jb(e,t){var r=void 0===t?{}:t,i=r.organization,n=r.projectId,s=r.prefix,o=r.severityAllowList,a=void 0===o?["error"]:o,l=r.sendExceptionsToPostHog,u=void 0===l||l;return t=>{var r,o,l,c,d;if("*"!==a&&!a.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,_=(null==(r=t.exception)?void 0:r.values)||[],g=_.map((e=>v({},e,{stacktrace:e.stacktrace?v({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>v({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(o=_[0])?void 0:o.value)||t.message,$exception_type:null==(l=_[0])?void 0:l.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=_[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:t.tags};return i&&n&&(f.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Gb{constructor(e,t,r,i,n,s){this.name=Vb,this.setupOnce=function(o){o(jb(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class Qb{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&($r.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,r){var i,n=this._previousPageViewProperties(t,r);return this._currentPageview={pathname:null!==(i=null==e?void 0:e.location.pathname)&&void 0!==i?i:"",pageViewId:r,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var s=n.maxScrollHeight,o=n.lastScrollY,a=n.maxScrollY,l=n.maxContentHeight,u=n.lastContentY,c=n.maxContentY;if(!(Y(s)||Y(o)||Y(a)||Y(l)||Y(u)||Y(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s>1?ge(o/s,0,1,$r):1,h=s>1?ge(a/s,0,1,$r):1,p=l>1?ge(u/l,0,1,$r):1,_=l>1?ge(c/l,0,1,$r):1;i=Vr(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Kb=["flags","surveys"],Zb={[_n]:{exposure:"hidden"},[mn]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[yn]:{exposure:"hidden"},[bn]:{exposure:"event"},[Sn]:{exposure:"hidden"},[In]:{exposure:"hidden"},[wn]:{exposure:"event"},[kn]:{exposure:"hidden"},[Cn]:{exposure:"event"},[En]:{exposure:"event"},[Tn]:{exposure:"event"},[xn]:{exposure:"hidden"},[Mn]:{exposure:"event"},[Rn]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Dn]:{exposure:"hidden"},[Nn]:{exposure:"event"},[Pn]:{exposure:"event",shouldSkipFromEventProperties:e=>ee(e)},[Bn]:{exposure:"event"},[qn]:{exposure:"event"},[Hn]:{exposure:"event"},[zn]:{exposure:"event"},[Vn]:{exposure:"hidden"},[jn]:{exposure:"hidden",storageGroup:"flags"},[Gn]:{exposure:"hidden",storageGroup:"flags"},[Qn]:{exposure:"hidden"},[Kn]:{exposure:"hidden",storageGroup:"flags"},[Zn]:{exposure:"hidden",storageGroup:"flags"},[Yn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Jn]:{exposure:"hidden",storageGroup:"flags"},[Xn]:{exposure:"hidden"},[es]:{exposure:"hidden"},[ts]:{exposure:"hidden"},[rs]:{exposure:"hidden"},[ns]:{exposure:"hidden",storageGroup:"surveys"},[ss]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[os]:{exposure:"event"},[as]:{exposure:"hidden"},[ls]:{exposure:"hidden"},[us]:{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"},[cs]:{exposure:"hidden"},[ds]:{exposure:"hidden"},[is]:{exposure:"event"},[hs]:{exposure:"hidden"},[ps]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_s]:{exposure:"hidden"},[vs]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[fs]:{exposure:"hidden"},[ms]:{exposure:"hidden"},[ys]:{exposure:"hidden"},[bs]:{exposure:"hidden"},[Fn]:{exposure:"event"},[Ln]:{exposure:"event"},[An]:{exposure:"event"},[On]:{exposure:"event"},[ks]:{exposure:"event"},[Cs]:{exposure:"event"},[Es]:{exposure:"event"},[Ts]:{exposure:"event"},[xs]:{exposure:"event"},[Is]:{exposure:"event"},[Ms]:{exposure:"event"},[Rs]:{exposure:"event"},[Ps]:{exposure:"event"},[Fs]:{exposure:"event"},[Ls]:{exposure:"event"}},Yb=[[$n,{exposure:"hidden"}],[Un,{exposure:"hidden"}],[Wn,{exposure:"hidden"}]],Jb=e=>{var t=Zb[e];if(t)return t;for(var r of Yb){var i=r[1];if(0===e.indexOf(r[0]))return i}},Xb={flags:ps,surveys:ss},eS=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],tS=e=>e+"_cookie_identity_change_pending",rS="main",iS=(e,t)=>{zr(e,((r,i)=>{var n=Jb(i);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]}))};class nS{constructor(t,r,i){if(void 0===i&&(i=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._config=t,this._ownsSplitStorage=i,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),t.debug&&$r.info("Persistence loaded",t.persistence,v({},this.props)),this.update_config(t,t,r),this.save(),e){var n=()=>this.flush();Jr(e,"beforeunload",n,{capture:!1}),Jr(e,"pagehide",n,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return re(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=pv(e,this._config.cookie_persisted_properties||[]),r=vv(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),n=sv._get(this._name)||void 0;n&&fv(this._name,n)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=n)}catch(e){}else try{var s=sv._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=s?fv(this._name,s):void 0,this._lastSeenMainCookieValue=s}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var r;try{r=sv._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,n=fv(this._name,r);try{i=hv(JSON.parse(r))}catch(e){return!1}if((sv._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=n,this._lastSeenMainCookieValue=r;var s=gv(this._name,r),o=[...uv,...s.properties],a={};if(Object.keys(i).forEach((e=>{var t=i[e];(Y(t)||ee(t)||""===t||e===_s&&t!==Ns&&t!==Bs)&&(a[e]=!0,delete i[e])})),Z(i))return!1;var l=vn in i||i[_s]===Ns||i[_s]===Bs,u=this.props[vn],c=this.props[_s],d=Vr({},this.props);[...uv,...e.cookie_persisted_properties||[]].forEach((e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||e!==vn&&e!==_s)){var t=d[e];!s.isValid&&-1!==uv.indexOf(e)&&(!1===t||0===t)||delete d[e]}})),this.props=Vr(d,i),!l||_s in i||_s in this.props||this._setProp(_s,Ns);var h=this.props[vn],p=this.props[_s];return!l||h===u&&p===c||(this._cookieIdentityChangePending=!0,Sv._set(tS(this._name),!0),this._deleteProp(ts),this._deleteProp(Gn),this._deleteProp(jn),this._deleteProp(Kn),this._deleteProp(Zn),this._deleteProp(Yn),this._deleteProp(ps),this._deleteProp(hs),this._deleteProp(cs),p===Ns&&(c===Bs||i[_s]===Ns||!Y(u)&&h!==u)&&(iS(this.props,i),this._deleteProp(rs)),p===Bs?this.props.$user_id=h:delete this.props.$user_id,this._deleteProp(mn)),!0}consumeCookieIdentityChange(){var e=tS(this._name),t=this._cookieIdentityChangePending||!!Sv._get(e);return this._cookieIdentityChangePending=!1,t&&Sv._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Y(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[rS],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Y(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===eS.indexOf(t.persistence.toLowerCase())&&($r.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var r,i=function(t,r){void 0===t&&(t=[]),void 0===r&&(r=!1);var i=[...uv,...t];return v({},av,{_parse(e){try{var t,n={};try{t=sv._get(e)||void 0,n=t?hv(JSON.parse(t)):{}}catch(e){}var s,o=JSON.parse(av._get(e)||"{}");if(r){var a=gv(e,t),l=[...uv,...a.properties],u={};Object.keys(n).forEach((e=>{var t=n[e];ee(t)||""===t||e===_s&&t!==Ns&&t!==Bs||(u[e]=t)}));var c=vn in u||u[_s]===Ns||u[_s]===Bs;if(Object.keys(u).length>0){var d,h=o[vn],p=null!==(d=o[_s])&&void 0!==d?d:Ns;i.forEach((e=>{if(-1!==l.indexOf(e)&&!(e in n)&&(c||e!==vn&&e!==_s)){var t=o[e];!a.isValid&&-1!==uv.indexOf(e)&&(!1===t||0===t)||delete o[e]}})),!c||_s in n||_s in o||(o[_s]=Ns),!c||(vn in u?u[vn]:o[vn])===h&&(_s in u?u[_s]:o[_s])===p||(lv.forEach((e=>delete o[e])),u[_s]===Bs&&vn in u?o.$user_id=u[vn]:delete o.$user_id,u[_s]!==Bs&&(delete o[is],delete o[rs]),delete o.__alias)}s=Vr(o,u)}else s=Vr(n,o);return av._set(e,s),s}catch(e){}return null},_set(e,i,n,s,o,a){var l=av._set(e,i,void 0,void 0,a);try{var u=pv(i,t);if(Object.keys(u).length){if(r){var c=cv(e),d=vv(u,t);if(sv._set(c,d,n,s,o,a),sv._get(c)!==JSON.stringify(d)){sv._remove(c,s);var h=pv(i);return sv._set(e,h,n,s,o,a),l}}sv._set(e,u,n,s,o,a)}}catch(e){av._error(e)}return l},_remove(t,r){try{null==e||e.localStorage.removeItem(t),sv._remove(t,r),sv._remove(cv(t),r)}catch(e){av._error(e)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),n=!1,s=t.persistence.toLowerCase();return"localstorage"===s&&av._is_supported()?(r=av,n=!0):"localstorage+cookie"===s&&i._is_supported()?(r=i,n=!0):"sessionstorage"===s&&Sv._is_supported()?r=Sv:"memory"===s?r=yv:"cookie"===s?r=sv:i._is_supported()?(r=i,n=!0):r=sv,this._splitStorageEligible=n,r}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return zr(this.props,((t,r)=>{var i=Jb(r);if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t))return;e[r]=t}})),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),r=t?av._parse(this._name):null,i={};if(t)try{zr(i=hv(sv._parse(this._name)),((e,t)=>{(Y(e)||ee(e)||""===e)&&delete i[t]}))}catch(e){}var n=this._storage._parse(this._name);if(n&&(this.props=Vr({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var s,o,a=null==r?void 0:r[vn],l=null!==(s=null==r?void 0:r[_s])&&void 0!==s?s:Ns,u=n[vn],c=null!==(o=n[_s])&&void 0!==o?o:Ns;if(u!==a||c!==l){this._cookieIdentityChangePending=!0,Sv._set(tS(this._name),!0);var d=Vr({},this.props);lv.forEach((e=>delete d[e])),c===Ns&&(l===Bs||i[_s]===Ns||!Y(a)&&u!==a)&&(iS(d,i),delete d[rs]),this.props=d;var h=new Set;lv.forEach((e=>{var t,r=null==(t=Jb(e))?void 0:t.storageGroup;r&&h.add(r)})),h.forEach((e=>{var t={};zr(this.props,((r,i)=>{var n;(null==(n=Jb(i))?void 0:n.storageGroup)===e&&(t[i]=r)})),Z(t)?(av._remove(this._groupEntryName(e)),this._slotState[e]={}):av._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}))}}Sv._get(tS(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Kb){var t=av._parse(this._groupEntryName(e));if(t&&!Z(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Vr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Jb(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=Xb[e];if(!r)return!1;var i=t[r],n=this.props[r];return re(i)&&re(n)&&n>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Jb(e))?void 0:t.storageGroup:void 0,i=r?av._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var n=this._storage._parse(this._name);if(n&&e in n)return void this._setProp(e,n[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Y(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){Y(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){void 0===e&&(e=!1),this._disabled||this._cookieSyncSuppressed&&!e||(e||this.syncCookieProperties(),this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,rS)&&this._rememberCurrentCookieProperties(this.props))}_writeNowSplit(){var e=this._partitionProps(),t=e.main,r=e.groups;for(var i of(this._writeEntry(this._storage,this._name,t,rS)&&this._rememberCurrentCookieProperties(t),Kb)){var n,s=r[i];(!Z(s)||null!=(n=this._slotState[i])&&n.persisted)&&this._writeEntry(av,this._groupEntryName(i),s,i)}}_partitionProps(){var e={},t={flags:{},surveys:{}};return zr(this.props,((r,i)=>{var n,s=null==(n=Jb(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===rS)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return zr(e,((e,t)=>{var i;r[t]=null!=(i=Jb(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var n,s=this._slotWriteState(i);if(i!==rS&&!s.dirty&&!Y(s.fingerprint))return!1;try{if((n=this._entryFingerprint(r,i))===s.fingerprint)return s.dirty=!1,!1}catch(e){n=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(s.dirty=!1,i!==rS&&(s.persisted=!0),Y(n)||(s.fingerprint=n),!0):(this._config.debug&&$r.warn('failed to persist storage entry "'+t+'"; will retry on next save'),!1)}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(Y(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of Kb)av._remove(this._groupEntryName(i));r?delete this._slotState[rS]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(K(e)){this.syncCookieProperties(),Y(t)&&(t="None"),this._expire_days=Y(r)?this._default_expiry:r;var i=!1;if(zr(e,((e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)})),i)return this.save(),!0}return!1}register(e,t){if(K(e)){this.syncCookieProperties(),this._expire_days=Y(t)?this._default_expiry:t;var r=!1;if(zr(e,((t,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==t||K(t)||G(t))&&(this._setProp(i,t),r=!0)})),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,r=!1;for(var i of t)i in this.props&&(this._deleteProp(i),r=!0);r&&this.save()}update_campaign_params(){var e=null==i?void 0:i.URL;if(e!==this._campaign_params_url){var t=Ha(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Z(Kr(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==i?void 0:i.referrer)?Ua(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Va(),$referring_domain:null!=i&&i.referrer&&(null==(e=ri(i.referrer))?void 0:e.host)||za},void 0)}set_initial_person_info(){this.props[fs]||this.props[ms]||this.register_once({[ys]:ja(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes)},void 0)}get_initial_props(){var e={};zr([ms,fs],(t=>{var r=this.props[t];r&&zr(r,(function(t,r){e["$initial_"+U(r)]=t}))}));var t=this.props[ys];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=Ga(e,t),i={};return zr(r,(function(e,t){i["$initial_"+U(t)]=e})),i}(t,this._config.disable_capture_url_hashes);Vr(e,r)}return e}safe_merge(e){return zr(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){var i=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every(((e,t)=>e===i[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),s=i||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(i||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(v({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),l));var u=s||o?this._buildStorage(e):this._storage,c=this._resolveSplitStorage(e),d=s||c!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){var p=this.props;this.clear(),this._storage=u,this._splitStorage=c,this.props=p,this.save()}else o&&(this._storage=u,a||(delete this._slotState[rS],this._writeNow()))}finally{h&&this._endCookieSyncSuppression()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[yn]||{};r[e]=t,this._setProp(yn,r),this.save()}remove_event_timer(e){var t=this.props[yn]||{},r=t[e];return Y(r)||(delete t[e],this._setProp(yn,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var r;this.props[e]=t,null!=(r=Jb(e))&&r.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,r=null==(t=Jb(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var sS={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},oS={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"},aS={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"},lS=Ur("[RateLimiter]");class uS{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{lS.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void lS.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.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){var t,r,i;void 0===e&&(e=!1);var n=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(gs))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>n&&(a.tokens=n);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var u=(re(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this._captureWarning(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(gs,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!G(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=n&&n.pathname)return""+(null!==(e=n.origin)&&void 0!==e?e:"")+n.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,s=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(r=this.instance).get_session_id)?void 0:t.call(r):void 0,a=[e+" event(s) dropped since the last warning",s?"triggered on "+s:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+n+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var cS=Ur("[RemoteConfig]");class dS{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return cS.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void cS.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return cS.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e.json,e)}));this._onRemoteConfig(e)}))}catch(e){cS.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||cS.warn("Failed to fetch remote config from PostHog."):cS.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){cS.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;null==(r=this._instance.featureFlags)||r.ensureFlagsLoaded()}catch(e){cS.error("Error loading feature flags",e)}}}var hS=["fatal","error","warning","log","info","debug"],pS=!!o||!!s,_S="text/plain",vS=!1,gS=(e,t)=>{var r=e.split("#"),i=r[1],n=r[0].split("?"),s=n[0],o=n[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return s+(a?"?"+a:"")+(i?"#"+i:"")},fS=function(e,t,r){var i;void 0===r&&(r=!0);var n=e.split("?"),s=n[0],o=n[1],a=v({},t),l=null!==(i=null==o?void 0:o.split("&").map((e=>{var t,i=e.split("="),n=i[0],s=r&&null!==(t=a[n])&&void 0!==t?t:i[1];return delete a[n],n+"="+s})))&&void 0!==i?i:[],u=ii(a);return u&&l.push(u),l.length>0?s+"?"+l.join("&"):s},mS=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===T_.GZipJS){var i=sa(oa(ti(t)),{mtime:0});return{contentType:_S,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===T_.Base64){var n=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(ti(t)),s=(e=>"data="+encodeURIComponent("string"==typeof e?e:ti(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=ti(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},yS=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:fS(e.url,{compression:T_.Base64}),encodedBody:mS(v({},e,{compression:T_.Base64,_encodedBody:void 0}))}:{url:gS(e.url,"compression"),encodedBody:mS(v({},e,{compression:void 0,_encodedBody:void 0}))};try{t=mS(e)}catch(t){if(Lt(e.compression,ni(e.url,"compression")))return $r.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&Lt(e.compression,ni(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?Ft(new Uint8Array(r)):ArrayBuffer.isView(r)&&Ft(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(vS=!0,i()):{url:e.url,encodedBody:t}},bS=e=>{try{return yS(e)}catch(t){return $r.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},SS=function(){var e=_((function*(e){var t=ti(e.data),r=yield Bt(t,qr.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return v({},e,{_encodedBody:{contentType:_S,body:i,estimatedSize:i.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),wS=/Failed to fetch|NetworkError|Load failed/i,kS=e=>"TypeError"===(null==e?void 0:e.name)&&wS.test((null==e?void 0:e.message)||""),CS=e=>{var t=bS(e);if(t){var r=t.url,i=t.encodedBody,n=null!=i?i:{},o=n.contentType,l=n.body,u=n.estimatedSize,c=new Headers;zr(e.headers,(function(e,t){c.append(t,e)})),o&&c.append("Content-Type",o);var d=null,h=!1;if(a){var p=new a;d={signal:p.signal,timeout:setTimeout((()=>{var t;h=!0,p.abort(Et("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))}),e.timeout)}}var _=t=>{h&&"AbortError"===(null==t?void 0:t.name)||kS(t)?$r.warn(t):$r.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var g;s(r,v({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(u||0),body:l,signal:null==(g=d)?void 0:g.signal},e.fetchOptions)).then((t=>t.text().then((r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){$r.error(e)}null==e.callback||e.callback(i)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(e){d&&clearTimeout(d.timeout),_(e)}}},ES=e=>{try{var t,i=yS(e),n=i.url,s=i.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(r.sendBeacon(n,u))return;var c=G(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(G(c)&&c.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(c.length/2),h=t=>G(e.data)?t:v({},e.data,{batch:t});return ES(v({},e,{data:h(c.slice(0,d))})),void ES(v({},e,{data:h(c.slice(d))}))}$r.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),CS(v({},e,{_keepaliveDisabled:!0}))}catch(e){$r.warn("Beacon send failed",e)}},TS=(e,t,r,i)=>{var n="query"===i?"POST"===t?"sent_at":"_":void 0;return fS(r===T_.GZipJS?gS(e,"compression"):e,v({},n?{[n]:Date.now().toString()}:{},r===T_.GZipJS?{}:{compression:r}))},xS=[];s&&xS.push({transport:"fetch",method:CS}),o&&xS.push({transport:"XHR",method(e){var t=bS(e);if(t){var r=new o,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var n=null!=i?i:{},s=n.contentType,a=n.body;zr(e.headers,(function(e,t){r.setRequestHeader(t,e)})),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(a)}}}),null!=r&&r.sendBeacon&&xS.push({transport:"sendBeacon",method:ES});var IS=3e3;class MS{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ge((null==t?void 0:t.flush_interval_ms)||IS,250,5e3,$r.createLogger("flush interval"),IS),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e),r=[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))];r.map((e=>{this._sendRequestSafely(v({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),r=function(){var r=t[i],n=(new Date).getTime();r.data&&G(r.data)&&zr(r.data,(e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){$r.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return zr(this._queue,(t=>{var r,i=t,n=(i?i.batchKey:null)||i.url;Y(e[n])&&(e[n]=v({},i,{data:[]})),null==(r=e[n].data)||r.push(i.data)})),this._queue=[],e}}var RS=["retriesPerformedSoFar"];class PS{constructor(t){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=t,this._queue=[],this._areWeOnline=!0,!Y(e)&&"onLine"in e.navigator&&(this._areWeOnline=e.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Jr(e,"online",this._onlineListener),Jr(e,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,r=g(e,RS);ie(t)&&(r.url=fS(r.url,{retry_count:t})),this._instance._send_request(v({},r,{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._enqueue(v({retriesPerformedSoFar:t},r));0===e.statusCode&&$r.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==r.callback||r.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),n=Math.random()-.5;return Math.ceil(i+n*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),$r.warn(n),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter((r=>e>r.retryAt||(t.push(r),!1)));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var t of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Y(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var r=t.requestOptions;try{this._instance._send_request(v({},r,{transport:"sendBeacon"}))}catch(e){$r.error(e)}}this._queue=[]}}class FS{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(s),this._context.maxScrollY=Math.max(s,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Jr(e,"scroll",this._updateScrollData,{capture:!0}),Jr(e,"scrollend",this._updateScrollData,{capture:!0}),Jr(e,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==e?void 0:e.document.documentElement;var t=G(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var r of t){var i=null==e?void 0:e.document.querySelector(r);if(i)return i}}_scrollPosition(t){var r="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[r]||0}return e?"y"===t?e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop||0:e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var LS=e=>ja(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);class AS{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[vs]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||LS,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[vs]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Ga(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 zr(Kr(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+U(r)]=t})),e}}class OS{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}}var DS=Ur("[SessionId]"),NS=864e5;class BS{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new OS,this._sessionHasBeenIdleTooLong=(e,t)=>!(!ie(e)||!ie(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Ds)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||tv,this._windowIdGenerator=r||tv;var n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ge(this._config.session_idle_timeout_seconds||1800,60,36e3,DS.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var s=Sv._parse(this._window_id_storage_key),o=Sv._parse(this._primary_window_exists_storage_key);s&&!o?this._windowId=s:Sv._remove(this._window_id_storage_key),Sv._set(this._primary_window_exists_storage_key,!0)}null!=(i=this._config.bootstrap)&&i.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Y(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Sv._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Sv._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Sv._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!ee(t)&&!ee(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!i||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Dn]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return ie(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Dn):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!ee(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Dn]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=ie(e)?e:0,r=ie(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[Dn];return G(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var r=function(e,t){void 0===t&&(t=(new Date).getTime());try{var r=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return r>t+6e4?void DS.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void DS.error("Invalid sessionID in bootstrap",e)}}(e);return!Y(r)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:r}:this._setSessionId(e,(new Date).getTime(),r),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener($s,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Sv._remove(this._primary_window_exists_storage_key)},Jr(e,$s,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,r){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===r&&(r=!1),this._config.cookieless_mode===Ds)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),n=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(ee(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var s,o;null==(s=(o=this._persistence).syncCookieProperties)||s.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],c=!Y(n)&&l!==n,d=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,_=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>NS),v=p?_:ie(u)&&Math.abs(i-u)>NS,g=!1,f=c,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,d);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||DS.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||v){f=!1;var w=p&&!_;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),DS.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:v}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,g=!0}else h||(h=this._windowIdGenerator(),g=!0),(f=f||l!==y)&&(DS.info("adopted cross-tab session id",{sessionId:l,windowId:h}),g=!0);var k=ie(d)&&e&&!v?d:i,C=ie(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:v,crossTabAdoption:f};return g&&this._sessionIdChangedHandlers.forEach((e=>e(l,h,E))),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:g?E:void 0,lastActivityTimestamp:d}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}var qS=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&B(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some((e=>B(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver};function HS(){return HS=_((function*(){var e=null==r?void 0:r.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return J(i)&&i.length>0?i:void 0}catch(e){return void $r.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),HS.apply(this,arguments)}var $S="custom",US="i.posthog.com",WS=/^\/static\//,zS=["/s/","/e/","/i/"];class VS{constructor(e){this._regionCache={},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("."+US,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":$S),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(WS.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=ri(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,n=this.instance.config.rewriteRequestPath;if(n){var s,o=(null==(s=ri(r))?void 0:s.href)||r;i=n(new URL(o)).toString()}if(n&&"api"===e&&zS.some((e=>0===t.indexOf(e)))){var a=this._urlKey(i);if(a){var l,u=this.apiHost,c=this._ingestionEndpoints;(null==(l=c)?void 0:l.apiHost)===u&&c.rewriteRequestPath===n||(c={apiHost:u,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){var t=this._ingestionEndpoints,r=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return this._prepareEndpoint(e,t,""+r+t)}if(this.region===$S)return this._prepareEndpoint(e,t,this.apiHost+t);var i=US+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+i);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+i)}}}var jS=Ur("[PostHog ExternalIntegrations]"),GS={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class QS{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,(e=>{if(e)return jS.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,n,s=r[0],o=r[1];!o||null!=(t=h.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[s]||e._loadScript(GS[s],(()=>{var t;null==(t=h.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[s])||t.start(e._instance)})),!o&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[s]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[s])||n.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class KS{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return _((function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var r=e.setup(t._client);r&&(yield r)}catch(r){var i=t._extensions.get(e.name)===e;i&&t._extensions.delete(e.name),t._logger.error('Failed to set up browser extension "'+e.name+'"',r),i&&t._disposeExtension(e)}}))()}getExtension(e){return this._extensions.get(e)}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&Q(t.then)&&t.then(void 0,(t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}))}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class ZS{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var r={};for(var i of e){var n=null==t?void 0:t.get_property(i);Y(n)||(r[i]=n)}return r}set(e,t){var r;null==(r=this._instance.persistence)||r.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var YS="extensionsRemoteConfig";class JS{constructor(e){this._disposed=!1,this.instance=e,this._logger=$r,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new ZS(e),this.onEvent=e=>E_(this.instance.on("eventCaptured",(t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}}))),this.onRemoteConfig=e=>{if(this._disposed)return E_((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(YS,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),E_(r)},this._runtime=new KS($r.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property(gn))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(gn);return"string"==typeof e?e:void 0}get library(){return{name:qr.LIB_NAME,version:qr.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,n=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==n?void 0:n.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==n?void 0:n.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,r){var i=this;return _((function*(){r?i.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(e,t)}))()}registerDynamicEventProperties(e){return E_(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(YS,e))}sendRequest(e,t){var r=this;return _((function*(){var i;void 0===t&&(t={});var n=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),s={method:t.method,url:t.query?fS(n,t.query):n,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?C.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(r.instance._send_request(s),{statusCode:202}):new Promise((e=>{s.callback=e,r.instance._send_request(s)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var XS={},ew=0,tw=()=>{},rw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',iw="Surveys module not available",nw="sanitize_properties is deprecated. Use before_send instead",sw="Invalid value for property_denylist config: ",ow=["token","distinct_id",ws],aw="posthog",lw=!pS&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),uw=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},cw=t=>{var r;return v({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Yr(null==i?void 0:i.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:tw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&J(null==n?void 0:n.search)&&-1!==n.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==e||null==(r=e.location)?void 0:r.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){$r.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:qs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:IS},error_tracking:{},_onCapture:tw},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Fi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:uw(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(t))},dw=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],hw=e=>{var t={};for(var r of dw){var i=r[0],n=r[1];Y(e[i])||(t[n]=e[i])}var s=Vr({},t,e),o=e.__preview_external_dependency_versioned_paths;return Y(o)||(Y(e.strict_script_versioning)&&(s.strict_script_versioning=!!o),J(o)&&Y(e.asset_host)&&(s.asset_host=o)),G(e.property_blacklist)&&(Y(e.property_denylist)?s.property_denylist=e.property_blacklist:G(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:$r.error(sw+e.property_denylist)),s};class pw{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){$r.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class _w{_replaceExtension(e,t){if(e){var r=this._extensions.indexOf(e);-1!==r&&this._extensions.splice(r,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===Ds||this.config.cookieless_mode===Os&&this.consent.isRejected()}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&this.get_distinct_id()===Ss){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===Ss){var r=this.config.get_device_id(tv());this.register({distinct_id:r,$device_id:r}),e.set_property(_s,Ns)}this._sync_opt_out_with_persistence()}}}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(){var e;this.webPerformance=new pw,this._personProcessingSetOncePropertiesSent=!1,this.version=qr.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new OS,this._extensions=[],this._extensionEventPropertyProducers=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=cw(),this.SentryIntegration=Gb,this.sentryIntegration=e=>function(e,t){var r=jb(e,t);return{name:Vb,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new FS(this),this.pageViewManager=new Qb(this),this.rateLimiter=new uS(this),this.requestRouter=new VS(this),this.consent=new qb(this),this.externalIntegrations=new QS(this);var t=null!==(e=_w.__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,r)=>{var i=J(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=J(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",(e=>$r.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==aw){var i,n=null!==(i=XS[r])&&void 0!==i?i:new _w;return n._init(e,t,r),XS[r]=n,XS[aw][r]=n,n}return this._init(e,t,r)}_init(t,r,i){var n,s;void 0===r&&(r={});var o,a=J(t)?t.trim():"";if(!a)return $r.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=cw(r.defaults),r.debug=this._checkLocalStorageForDebug(r.debug),this._originalUserConfig=r,this._triggered_notifs=[],r.person_profiles?this._initialPersonProfilesConfig=r.person_profiles:r.process_person&&(this._initialPersonProfilesConfig=r.process_person);var l=cw(r.defaults),u=hw(r),c=Vr({},l,u,{name:i,token:a});K(l.rageclick)&&K(u.rageclick)&&(c.rageclick=Vr({},l.rageclick,u.rageclick)),K(l.session_recording)&&K(u.session_recording)&&(c.session_recording=Vr({},l.session_recording,u.session_recording)),this.set_config(c),this.config.on_xhr_error&&$r.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:T_.GZipJS;var d=this._is_persistence_disabled();if(this.persistence=new nS(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nS(v({},this.config,{persistence:"sessionStorage"}),d,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Sv._is_supported()){var h=Sv._parse(this._sessionRegisteredPropertiesStorageKey);G(h)&&h.forEach((e=>{J(e)&&this._sessionRegisteredPropKeys.add(e)}))}else Sv._remove(this._sessionRegisteredPropertiesStorageKey);var p=v({},this.persistence.props),_=v({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new MS((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new PS(this),this.__request_queue=[];var g=this._inCookielessMode();if(g||(this.sessionManager=new BS(this),this.sessionPropsManager=new AS(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((e,t,r)=>{(null!=r&&r.activityTimeout||null!=r&&r.sessionPastMaximumLength||null!=r&&r.crossTabAdoption)&&this._clearSessionRegisteredProps()}))),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?($r.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(g)}),0)):($r.info("Initializing extensions synchronously"),this._initExtensions(g)),qr.DEBUG=qr.DEBUG||this.config.debug,qr.DEBUG&&$r.info("Starting in debug mode",{this:this,config:r,thisC:v({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(n=r.bootstrap)&&n.distinctID||(r.bootstrap=v({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(s=r.bootstrap)?void 0:s.distinctID)){var f=r.bootstrap.distinctID,m=this.get_distinct_id(),y=this.persistence.get_property(_s);if(r.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===Ns)this.identify(f);else if(r.bootstrap.isIdentifiedID&&null!=m&&m!==f&&y===Bs)$r.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(tv()),S=r.bootstrap.isIdentifiedID?b:f;this.persistence.set_property(_s,r.bootstrap.isIdentifiedID?Bs:Ns),this.register({distinct_id:f,$device_id:S})}}if(g)this.register_once({distinct_id:Ss,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(tv());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(_s,Ns)}return Jr(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),r.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||tv();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(_s,Bs)),t()},n=r.user();"then"in n&&Q(n.then)?n.then(i):i(n)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||zb.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(zb.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(zb.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(r,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,Us),identify:e=>t(e,zs),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Q(this.config._onCapture)&&this.config._onCapture!==tw&&($r.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&$r.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 HS.apply(this,arguments)}().then((e=>{e&&this.register({[fn]:e})})).catch(tw),this}_isSharedExtension(e){var t=e;return J(t.name)&&Q(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push((()=>{this._getBrowserClientAdapter().add(e).catch((()=>null==e.dispose?void 0:e.dispose())).catch((t=>{$r.error('Failed to dispose browser extension "'+e.name+'"',t)}))})):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,r,i,n,s,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(r=_w.__defaultExtensionClasses)?void 0:r.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(i=this._featureFlagsReloadingUnsubscribe)||i.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new o(this)),Q(this.featureFlags.onReloading)&&Q(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading((()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)})),this._getBrowserClientAdapter().add(this.featureFlags)):null==(n=(s=this.featureFlags).initialize)||n.call(s))}_initExtensions(e){var t,r,i,n,s,o,a,l=performance.now(),u=v({},_w.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.exceptions&&this._extensions.push(this.exceptions=null!==(t=this.exceptions)&&void 0!==t?t:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._enrollExtension(this.autocapture=new u.autocapture(this),c),u.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),c),u.logs&&this._enrollExtension(this.logs=null!==(i=this.logs)&&void 0!==i?i:new u.logs(this),c),u.metrics&&this._extensions.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(s=this.conversations)&&void 0!==s?s:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ub)),u.toolbar&&this._extensions.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&c.push((()=>{null==e.initialize||e.initialize()}))})),c.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}})),this._processInitTaskQueue(c,l)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var r=e.shift();if(r)try{r()}catch(e){$r.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[ks]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Cs]:i}),this.config.__preview_deferred_init_extensions&&$r.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!i||!i.body)return $r.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,n=e.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=q(n.supportedCompression,T_.GZipJS)?T_.GZipJS:q(n.supportedCompression,T_.Base64)?T_.Base64:void 0),null!=(r=n.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:qs}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){$r.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=n&&n.hostname){var e=n.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new dS(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Wr(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Ws),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(n=this._retryQueue)||n.unload()):this._shouldCapturePageleave()&&this.capture(Ws,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?lw?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=v({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(Y(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,r,i,n=v({},e);n.timeout=n.timeout||6e4;var s,o,a,u,c,d=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Y(n.compression)&&n.data&&(n.compression=T_.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(o=null==(c=(u=(G(s=n.data)?s:[s]).map((e=>v({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{}))))[0])||null==(a=c.properties)?void 0:a.token)&&void 0!==o?o:null==c?void 0:c.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),G(e)?e.map((e=>v({},e,{sent_at:t}))):v({},e,{sent_at:t})}(n.data))),n.url=TS(n.url,n.method,n.compression,n.timestampMode);var h=xS.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),p=null!==(r=null==(i=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,(e=>e.transport===d)))?void 0:i.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var _=e=>{try{p(e)}catch(e){kS(e)?$r.warn(e):$r.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==d&&n.data&&n.compression===T_.GZipJS&&l&&"undefined"!=typeof Promise&&!vS?SS(n).then((e=>{_(e)})).catch((t=>{if(At(t))return vS=!0,void _(v({},n,{compression:void 0,url:TS(e.url,e.method,void 0,e.timestampMode)}));Ot(t)&&(vS=!0),_(n)})):p(n)})(v({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){ew++;try{var t,r=[],i=[],n=[];Wr(e,(e=>{if(e)if(G(t=e[0]))n.push(e);else if(Q(e))try{e.call(this)}catch(t){$r.error("Error executing queued PostHog call",e,t)}else G(e)&&"alias"===t?r.push(e):G(e)&&-1!==t.indexOf("capture")&&Q(this[t])?n.push(e):i.push(e)}));var s=function(e,t){Wr(e,(function(e){try{if(G(e[0])){var r=t;zr(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){$r.error("Error executing queued PostHog call",e,t)}}))};s(r,this),s(i,this),s(n,this)}finally{ew--}}push(e){if(ew>0&&G(e)&&J(e[0])){var t=_w.prototype[e[0]];Q(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,n,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Y(e)&&J(e)){this._healCookielessSentinelDistinctId();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!J(null==t?void 0:t.$current_url)&&($r.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!=r&&r._originatedFromCaptureException||$r.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 c=new Date,d=(null==r?void 0:r.timestamp)||c,h=Ct(null==r?void 0:r.uuid,tv),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===Us&&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 _="$feature_flag_called"===e&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property(Jn);(null==r?void 0:r.$set)&&!_&&(p.$set=null==r?void 0:r.$set);var g=null==r?void 0:r.$unset;g&&(p.$unset=g);var f=_?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==Vs,e===zs);if(f&&(p.$set_once=f),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,s=p,o=e=>J(e)?e.slice(0,n):e,a=new Set,p=function e(t,r){if(t!==Object(t))return o?o(t):t;if(!a.has(t)){var i;if(a.add(t),G(t))i=[],Wr(t,(t=>{i.push(e(t))}));else{var n={};zr(t,((t,r)=>{a.has(t)||(n[r]=e(t,r))})),i=n}return i}}(s)),p.timestamp=d,Y(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),_&&(p.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return w.forEach(i),t.forEach(i),r}(p.properties,ow)),e===O_.DISMISSED||e===O_.SENT){var m=null==t?void 0:t[D_.SURVEY_ID],y=null==t?void 0:t[D_.SURVEY_ITERATION];V_({id:m,current_iteration:y}),p.$set=v({},p.$set,{[_a({id:m,current_iteration:y},e===O_.SENT?"responded":"dismissed")]:!0})}else e===O_.SHOWN&&(p.$set=v({},p.$set,{[D_.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===oS.SHOWN){var b=null==t?void 0:t[aS.TOUR_TYPE];b&&(p.$set=v({},p.$set,{[aS.TOUR_LAST_SEEN_DATE+"/"+b]:(new Date).toISOString()}))}var S=v({},p.properties.$set,p.$set);if(Z(S)||this.setPersonPropertiesForFlags(S),!te(this.config.before_send)){var k=this._runBeforeSend(p);if(!k)return;(p=k).uuid=Ct(p.uuid,tv)}this._internalEventEmitter.emit("eventCaptured",p);var C=null!==(i=null==r?void 0:r._url)&&void 0!==i?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),E={method:"POST",url:C,data:p,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(C)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}$r.critical("This capture call is ignored due to client rate limiting.")}}else $r.error("No event name provided to posthog.capture")}else $r.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new JS(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}_processCookieIdentityChange(e){var t,r,i;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,this.persistence.get_property(_s)===Ns&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,s,o,a){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return r;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var l=a?void 0:this.persistence.remove_event_timer(t),c=v({},r);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this._inCookielessMode()&&(c[ws]=!0),"$snapshot"===t){var d=v({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=d.distinct_id,(!J(c.distinct_id)&&!re(c.distinct_id)||X(c.distinct_id))&&$r.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=function(t,r,i,s){var o,a,l,c;if(void 0===s&&(s=!1),!u)return{};var d,h=t?[...Da,...r||[]]:[],p=function(e){for(var t=0;bt.length>t;t++){var r=bt[t],i=r[1],n=r[0].exec(e),s=n&&(Q(i)?i(n,e):i);if(s)return s}return["",""]}(u),_=p[0],v=p[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},f={};Y(i)||(f.detectGoogleSearchApp=i);var m={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,S=null==e||null==(l=e.screen)?void 0:l.width,w=null==e||null==(c=e.screen)?void 0:c.height,k=null==e?void 0:e.devicePixelRatio;Y(y)||(m.userAgentDataPlatform=y),Y(b)||(m.maxTouchPoints=b),Y(S)||(m.screenWidth=S),Y(w)||(m.screenHeight=w),Y(k)||(m.devicePixelRatio=k);var C,E=Vr(Kr({$os:_,$os_version:v,$browser:ft(u,navigator.vendor,g,f),$device:St(u),$device_type:wt(u,m),$timezone:Qa(),$timezone_offset:Ka()}),{$current_url:si(s?Tt(null==n?void 0:n.href):null==n?void 0:n.href,h,Ba),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:yt(u,navigator.vendor,g,f),$browser_language:Wa(),$browser_language_prefix:(C=Wa(),"string"==typeof C?C.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:qr.LIB_NAME,$lib_version:qr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return qr.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=qr.SDK_DIST_CHANNEL),E}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var _=this.sessionManager.checkAndGetSessionAndWindowId(a,s.getTime(),!0),g=_.windowId;c.$session_id=_.sessionId,c.$window_id=g}this.sessionPropsManager&&Vr(c,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Vr(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(f=this._retryQueue)?void 0:f.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===$S&&(c.$lib_custom_api_host=this.config.api_host),h=t!==Us||a?t!==Ws||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,o),c=Vr(c,h),t===Us&&i&&(c.title=i.title),!Y(l)){var m=s.getTime()-l;c.$duration=parseFloat((m/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();zr(["$referrer","$referring_domain"],(e=>{e in y&&delete b[e]}));var S={};if(this._extensionEventPropertyProducers.length>0)for(var w of this._extensionEventPropertyProducers.slice())try{Vr(S,w())}catch(e){$r.error("Failed to produce browser extension event properties",e)}(c=Vr({},p,y,b,v({},S,c))).$is_identified=this._isIdentified(),G(this.config.property_denylist)?zr(this.config.property_denylist,(function(e){delete c[e]})):$r.error(sw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&($r.error(nw),c=k(c,t));var C=this._hasPersonProcessing();return c.$process_person_profile=C,C&&!a&&this._requirePersonProcessing("_calculate_event_properties"),c}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var n=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Vr({},n,s||{},e||{}),a=this.config.sanitize_properties;return a&&($r.error(nw),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Z(o)?void 0:o}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t,r;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(r=this.sessionPersistence)||r.register(e),Object.keys(e).forEach((e=>this._sessionRegisteredPropKeys.add(e))),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach((e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)})),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Sv._is_supported())Sv._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach((e=>t.push(e))),t.length>0?Sv._set(this._sessionRegisteredPropertiesStorageKey,t):Sv._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.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 r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.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:iw}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.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:iw})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:iw})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=G_),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:iw}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:iw})}_validateIdentifyId(e){return!e||X(e)?($r.critical("Unique user id has not been set in posthog.identify"),!1):e===Ss?($r.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())||($r.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return $r.uninitializedWarning("posthog.identify");if(re(e)&&(e=e.toString(),$r.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var i=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property(gn)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property(mn)&&(this.unregister(mn),this.register({distinct_id:e}));var u,c=(this.persistence.get_property(_s)||Ns)===Ns,d=e!==l,h=!d&&c;if(d&&c)this.persistence.set_property(_s,Bs),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(zs,{distinct_id:e,$anon_distinct_id:l},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Ta(e,t,r),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(_s,Bs);var p=t||{},_=r||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:_}),this._cachedPersonProperties=Ta(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||n||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(cs)):h&&(t||r)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=Ta(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):$r.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(G(e)?e:[e]).filter((e=>J(e)&&e.length>0));0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,r){var i;if(e&&t){null==(i=this.persistence)||i.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),s=n[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:v({},n,{[e]:t})}),s||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(Vs,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else $r.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=ne(e)?e:null==e?void 0:e.resetDeviceID,r=ne(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,n,s;if(void 0===t&&(t=!1),$r.info("reset"),!this.__loaded)return $r.uninitializedWarning("posthog.reset");var o=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(gn),l=this.get_property(fn),u=this.get_property(Rn),c=this.is_capturing();this.consent.reset(),t||!c||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(s=this.persistence)||null==s._beginCookieSyncSuppression?void 0:s._beginCookieSyncSuppression(),h=!1;try{var p,_,g,f,m,y,b,S,w,k,C,E,T;if(null==(p=this.persistence)||p.clear(),null==(_=this.sessionPersistence)||_.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Y(u)||null==(k=this.persistence)||k.register({[Rn]:u}),null==(g=this.surveys)||g.reset(),null==(f=this.featureFlags)||f.reset(),null==(m=this.conversations)||m.reset(),null==(y=this.logs)||y.reset(),null==(b=this.metrics)||b.reset(),null==(S=this.persistence)||S.set_property(_s,Ns),null==(w=this.sessionManager)||w.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Ds)this.register_once({distinct_id:Ss,$device_id:null},"");else{var x=this.config.get_device_id(tv());this.register_once({distinct_id:x,$device_id:e?x:a},""),e||Y(l)||this.register({[fn]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(T=this.persistence)||T.set_property(_s,r.isIdentifiedID?Bs:Ns),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(Y(o)||null!=(E=this.sessionManager)&&E.setBootstrapSessionId(o,!0))){var I=v({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,h=!0}finally{var M;d&&(null==(M=this.persistence)||null==M._endCookieSyncSuppression||M._endCookieSyncSuppression(h))}this.reloadFeatureFlags()}shutdown(e){var t=this;return _((function*(){var e,r,i,n,s;if(t.__loaded){t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(r=t.logs)||r.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(n=t._requestQueue)||n.unload(),null==(s=t._retryQueue)||s.unload();try{var o;null==(o=t.featureFlags)||o.destroy()}catch(e){$r.error("Error while destroying feature flags",e)}}else $r.uninitializedWarning("posthog.shutdown")}))()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var n,s=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return i}alias(e,t){return e===this.get_property(_n)?($r.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Y(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(mn,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($r.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=v({},this.config);if(K(e)){var r,i,n,s,o,a,l,u,c,d,h,p;Vr(this.config,hw(e));var _=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nS(v({},this.config,{persistence:"sessionStorage"}),_,!1);var g,f=this._checkLocalStorageForDebug(this.config.debug);ne(f)&&(this.config.debug=f),ne(this.config.debug)&&(this.config.debug?(qr.DEBUG=!0,av._is_supported()&&av._set("ph_debug",!0),$r.info("set_config",{config:e,oldConfig:t,newConfig:v({},this.config)})):(qr.DEBUG=!1,av._is_supported()&&av._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){qr.LIB_NAME=e,qr.LIB_VERSION=t}startSessionRecording(e){var t,r,i,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.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 r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(v({},i,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.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:_w._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.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:aw;return t!==aw&&(t=aw+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(_s))===Bs||(null==(t=this.sessionPersistence)?void 0:t.get_property(_s))===Bs}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===qs&&!this._isIdentified()&&Z(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[mn])&&(null==(t=this.persistence)||null==(t=t.props)||!t[bs]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?($r.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(bs,!0),!0)}_is_persistence_disabled(){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!==Os)}_sync_opt_out_with_persistence(){var e,t,r,i,n,s=this._is_persistence_disabled();return this.is_capturing()||null==(r=this.logs)||r._onOptOut(),(null==(e=this.persistence)?void 0:e._disabled)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==s&&(null==(n=this.sessionPersistence)||n.set_disabled(s)),s&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),s}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Ds){if(this._inCookielessMode()){var r,i,n,s,o;this._reset(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=new BS(this),this.pageViewManager=new Qb(this),this.persistence&&(this.sessionPropsManager=new AS(this,this.sessionManager,this.persistence));var a,l=null!==(n=null==(s=this.config.__extensionClasses)?void 0:s.sessionRecording)&&void 0!==n?n:null==(o=_w.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var u,c;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Os&&(null==(u=this.surveys)||u.loadIfEnabled()),(Y(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(c=null==e?void 0:e.captureEventName)&&void 0!==c?c:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else $r.warn(rw)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==Ds?(this.config.cookieless_mode===Os&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Os&&(this.register({distinct_id:Ss,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):$r.warn(rw)}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===Ds||(this.config.cookieless_mode===Os?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return r?qS(r,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){i&&("visible"===i.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Us,{title:i.title},{send_instantly:!0}),this._visibilityStateListener&&(i.removeEventListener(Hs,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Jr(i,Hs,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?($r.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,r,i,n){var s=t in e&&!te(e[t]),o=r in e&&!te(e[r]);return s?e[t]:!!o&&(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,$r)}_runBeforeSend(e){var t;if(te(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(ae),i=G(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i)try{if(n=s(n),te(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return oe(e.event)?$r.warn(o+". This can cause unexpected behavior."):$r.info(o),null}n.properties&&!Z(n.properties)||$r.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return $r.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(n.properties&&te(n.properties[a]))return $r.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 n}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=ne(e)&&!e,r=av._is_supported()&&"true"===av._get("ph_debug");return!t&&(!!r||e)}}_w.__defaultExtensionClasses={},_w._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Qr(e.prototype[t[r]])}(_w,["identify"]);class vw{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,r=K(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==r?void 0:r.url_allowlist,e.url_ignorelist=null==r?void 0:r.url_ignorelist,e.dom_event_allowlist=null==r?void 0:r.dom_event_allowlist,e.element_allowlist=null==r?void 0:r.element_allowlist,e.css_selector_allowlist=null==r?void 0:r.css_selector_allowlist,e.css_selector_ignorelist=null==r?void 0:r.css_selector_ignorelist,e.element_attribute_ignorelist=null==r?void 0:r.element_attribute_ignorelist,e.capture_copied_text=null==r?void 0:r.capture_copied_text}}var gw=Ur("[ExceptionAutocapture]"),fw=Ur("[TracingHeaders]"),mw=Ur("[Web Vitals]"),yw=9e5,bw=["CLS","FCP","INP","LCP"],Sw=["INP","LCP"],ww=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],kw="[SessionRecording]",Cw=Ur(kw),Ew=Ur("[Heatmaps]");function Tw(e){return K(e)&&"clientX"in e&&"clientY"in e&&re(e.clientX)&&re(e.clientY)}var xw=Ur("[Product Tours]"),Iw=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(xn))},Mw=["$set_once","$set"],Rw=Ur("[SiteApps]"),Pw="Error while initializing PostHog app with config id ",Fw=(e,t)=>null!=e&&e.then?e.then(t):t(e),Lw="SDK is not enabled or survey functionality is not yet loaded",Aw="Disabled. Not loading surveys.";class Ow{constructor(e,t){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(!this._disposed&&!this._config.disableSurveys){if(!e.ok)return B_.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(te(t))return B_.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=ne(t)?t:t.length>0,B_.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}},this._configSource=e,this._initialClientState=t}setup(e){if(!this._disposed)return this._initializingClient=e,Fw(e.kv.initialize(),(()=>{if(this._initializingClient===e&&!this._disposed){this._initializingClient=void 0,this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())}}))}dispose(){var e,t,r;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(r=this._surveyManager)||null==r.dispose||r.dispose(),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach((e=>clearTimeout(e))),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith($_)||null!=i&&i.startsWith(U_))&&t.push(i)}t.forEach((e=>localStorage.removeItem(e)))}catch(e){}}loadIfEnabled(){if(!this._disposed&&this._client){var e=this._config;if(!this._surveyManager)if(this._isInitializingSurveys)B_.info("Already initializing surveys, skipping...");else if(e.disableSurveys)B_.info(Aw);else if(e.cookielessMode&&this._configSource.isOptedOut())B_.info("Not loading surveys in cookieless mode without consent.");else{var t=this._configSource.getExtensions();if(t){if(!Y(this._isSurveysEnabled)||e.advancedEnableSurveys){var r=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{var i=t.generateSurveys;if(i)return this._completeSurveyInitialization(i,r),void(this._isInitializingSurveys=!1);var n=t.loadExternalDependency;if(!n)return this._handleSurveyLoadError(As),void(this._isInitializingSurveys=!1);n((e=>{try{if(this._disposed)return;var t=this._configSource.getExtensions();e||null==t||!t.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,r)}finally{this._isInitializingSurveys=!1}}))}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}}else B_.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),B_.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){B_.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){var r;void 0===t&&(t=!1);var i=null!==(r=this._client)&&void 0!==r?r:this._initialClientState;if(i&&!this._disposed){if(this._config.disableSurveys)return B_.info(Aw),e([]);var n=i.kv.get(ns);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then((t=>{this._disposed||e(t.surveys,t.context)})).catch((e=>B_.error("Error in survey callback",e)));else{var s=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then((e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return B_.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}}),(e=>this._handleSurveyResponse(i,{statusCode:0,error:e})));this._getSurveysInFlightPromise=s;var o=()=>{this._getSurveysInFlightPromise===s&&(this._getSurveysInFlightPromise=null)};s.then((t=>{o(),this._disposed||e(t.surveys,t.context)}),o).catch((e=>B_.error("Error in survey callback",e)))}}}_sendSurveysRequest(e,t){var r=this._client;return r?r.sendRequest(e,t):new Promise((e=>e({statusCode:0,error:new Error(Lw)})))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:Lw}};var r=t.statusCode;if(200!==r||!t.json){var i="Surveys API could not be loaded, status: "+r;return 0!==r?B_.error(i):t.error||B_.warn(i),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this._lastSurveyRefreshFailedAt=null;var n,s=t.json.surveys||[],o=s.filter((e=>q_(e)&&(ba(e)||H_(e))));return o.length>0&&(null==(n=this._surveyEventReceiver)||n.register(o)),e.kv.set({[ns]:s,[ss]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t,r=null==(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)?void 0:e.kv.get(ss);return re(r)&&Date.now()-r>3e5}_isSurveyRefreshBackingOff(){return re(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r,i={id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null};V_(i);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){B_.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);B_.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((r=>{var i;t=null!==(i=r.find((t=>t.id===e)))&&void 0!==i?i:null})),t}_checkSurveyEligibility(e){if(te(this._surveyManager))return{eligible:!1,reason:Lw};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(te(this._surveyManager))return{eligible:!1,reason:Lw};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(te(this._surveyManager))return B_.warn("init was not called"),{visible:!1,disabledReason:Lw};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return te(this._surveyManager)?(B_.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Lw})):new Promise((r=>{this.getSurveys((t=>{var i,n=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(n){var s=this._checkSurveyRenderability(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var n;if(te(this._surveyManager))B_.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(j_.includes(s.type)){var o=null==i?void 0:i.querySelector(t);if(o)if(null!=(n=s.appearance)&&n.surveyPopupDelaySeconds){B_.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var e,t;this._renderTimeouts.delete(a),this._disposed||(B_.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,o,r),B_.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(a)}else this._surveyManager.renderSurvey(s,o,r);else B_.warn("Survey element not found")}else B_.warn("Surveys of type "+s.type+" cannot be rendered in the app");else B_.warn("Survey not found")}}displaySurvey(e,t){var r;if(te(this._surveyManager))B_.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var n=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=v({},i,{appearance:v({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==N_.Popover&&t.initialResponses&&B_.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this._checkSurveyEligibility(i);if(!s.eligible)return void B_.warn("Survey is not eligible to be displayed: ",s.reason)}t.displayType!==N_.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else B_.warn("Survey not found")}}cancelPendingSurvey(e){te(this._surveyManager)?B_.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}function Dw(e,t,r){if(te(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class Nw{constructor(e){this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new OS,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e}init(){var e,t;Y(null==(e=this._instance)?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null==(t=this._instance)?void 0:t._addCaptureHook(((e,t)=>{this.on(e,t)})))}dispose(){var e;null==(e=this._captureHookUnsubscribe)||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new OS}register(e){var t,r;if(!Y(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t;this._actionRegistry.add(e),null==(t=e.steps)||t.forEach((e=>{this._actionEvents.add((null==e?void 0:e.event)||"")}))})),null!=(r=this._instance)&&r.autocapture)){var i=new Set;this._actionRegistry.forEach((e=>{var t;null==(t=e.steps)||t.forEach((e=>{null!=e&&e.selector&&i.add(e.selector)}))})),this._instance.autocapture.setElementSelectors(i)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!Dw(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>Dw(e.href,t.href,t.href_matching||"exact")));var n,s=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!s&&Dw((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some((e=>Dw(e.text,t.text,t.text_matching||"exact")||Dw(e.$el_text,t.text,t.text_matching||"exact")));var n,s,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(n=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!te(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),s=t.text,o=t.text_matching||"exact",n.some((e=>Dw(e,s,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var n=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||Ea(t.properties.reduce(((e,t)=>{var r=G(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e}),{}),null==e?void 0:e.properties)}}class Bw{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null==(t=this._instance)||null==t.onSessionId?void 0:t.onSessionId((e=>this._onSessionIdChanged(e)))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&Ea(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach((e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach((t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}}))})),r}_getMatchingItems(e,t,r){var i=(r===x_.Activation?this._eventToItems:this._cancelEventToItems).get(e),n=[];return this._getItems((e=>{n=e.filter((e=>null==i?void 0:i.includes(e.id)))})),n.filter((i=>{var n,s=null==(n=i.conditions)||null==(n=n[r])||null==(n=n.values)?void 0:n.find((t=>t.name===e));return this._doesEventMatchFilter(s,t)}))}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var r;Y(null==(r=this._instance)?void 0:r._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){var r=e.filter((e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length}));if(t&&this._actionToItems.clear(),0!==r.length){this._actionMatcher||(this._actionMatcher=new Nw(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((e=>this.onAction(e))));var i=[];r.forEach((e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach((t=>{if(i.push(t),t.name){var r,n=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];n.includes(e.id)||n.push(e.id),this._actionToItems.set(t.name,n)}}))})),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var n;t&&(null==(n=this._actionMatcher)||n.replace([]))}}_mergeItemMaps(e,t){t.forEach(((t,r)=>{var i,n=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach((e=>{n.includes(e)||n.push(e)})),e.set(r,n)}))}_setupEventBasedItems(e,t){var r,i,n=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0})),s=e.filter((e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0})),o=this._buildEventToItemMap(e,x_.Activation),a=this._buildEventToItemMap(e,x_.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==s.length)&&(null!==(r=this._captureHookUnsubscribe)&&void 0!==r||(this._captureHookUnsubscribe=null==(i=this._instance)?void 0:i._addCaptureHook(((e,t)=>{this.onEvent(e,t)}))))}onEvent(e,t){var r,i,n=this._getLogger(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var o=this._activationOutcome(e,s);if("consume"===o)return n.info("event consumed activated item, removing it",{event:e,itemId:s}),void this._deactivateItems([s]);if("persist"===o)return n.info("shown item promoted to persisted activation",{event:e,itemId:s}),this._persistActivation(s),void this._clearActivationTimestamps([s])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,x_.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map((e=>e.id))}),this._deactivateItems(a.map((e=>e.id))),a.forEach((e=>this._cancelPendingItem(e.id))))}if(this._eventToItems.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,x_.Activation);this._activateItems(l.map((e=>e.id)))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t;if(0!==e.length){var r=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),i=[];for(var n of e)r&&this._shouldPersistArmedActivation(n)?this._persistActivation(n)&&this._recordActivationTimestamp(n):i.push(n);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter((t=>t!==e));var t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter((e=>!t.has(e)));var r=this._getRawPersistedActivatedIds(),i=r.filter((e=>!t.has(e)));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e,t=this._getActivationTimestampsKey();if(!t)return{};var r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return r&&"object"==typeof r?r:{}}_recordActivationTimestamp(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps();this._writeActivationTimestamps(v({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var n of Object.entries(t)){var s=n[0],o=n[1];e.includes(s)?i=!0:r[s]=o}i&&(Z(r)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(r))}}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(this._getPersistedActivatedIds().includes(e)){var t=this._getRawActivationTimestamps()[e];return re(t)?t:void 0}}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],n=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return n&&i===n?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];if(r&&r!==e){var i=this._getRawPersistedActivatedIds(),n=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter((e=>re(n[e]))).forEach((e=>this._cancelPendingItem(e)))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter((e=>!this._isItemPermanentlyIneligible(e)))}dispose(){var e,t,r;null==(e=this._sessionIdUnsubscribe)||e.call(this),this._sessionIdUnsubscribe=void 0,null==(t=this._captureHookUnsubscribe)||t.call(this),this._captureHookUnsubscribe=void 0,null==(r=this._actionMatcher)||r.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class qw extends Bw{constructor(e){super(e)}_getActivatedKey(){return os}_getActivatedSessionKey(){return as}_getActivationTimestampsKey(){return ls}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ls]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(ls)}_shouldPersistArmedActivation(e){var t,r;this._getItems((t=>{r=t.find((t=>t.id===e))}));var i=null==(t=r)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return re(i)&&i>0}_getShownEventName(){return O_.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return B_}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[os]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[as]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(as)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||Sa(r)?e===O_.SHOWN?"consume":"ignore":e===O_.SHOWN?"persist":e===O_.DISMISSED||e===O_.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Hw{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);var t={};for(var r of e){var i=this._instance.get_property(r);Y(i)||(t[r]=i)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach((e=>this._instance.unregister(e))):this._instance.unregister(e)}}class $w{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=null==h?void 0:h.__PosthogExtensions__;if(e){var t=e.generateSurveys,r=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:r?e=>r(this._instance,"surveys",e):void 0}}}createEventReceiver(){return new qw(this._instance)}}var Uw=null!=e&&e.location?oi(e.location.hash,"__posthog")||oi(location.hash,"state"):null,Ww="_postHogToolbarParams",zw=Ur("[Toolbar]"),Vw=Ur("[FeatureFlags]");class jw{constructor(e,t){void 0===t&&(t=!1),this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var r,i,n,s,o;return{bootstrap:{featureFlags:null==(r=e.bootstrap)?void 0:r.featureFlags,featureFlagPayloads:null==(i=e.bootstrap)?void 0:i.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(n=e.remote_config_refresh_interval_ms)&&void 0!==n?n:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(s=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==s?s:[],flagKeys:G(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(Vw.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Y(e.flag_keys)||G(e.flag_keys)||Vw.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}}var Gw=Ur("[FeatureFlags]"),Qw=Ur("[FeatureFlags]",{debugEnabled:!0}),Kw="\" failed. Feature flags didn't load in time.",Zw="connection_error",Yw=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},Jw=e=>{var t={};for(var r of jr(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},Xw="Refusing to render web experiment since the viewer is a likely bot",ek={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>wa(t,e),not_regex:(e,t)=>!wa(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class tk{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{tk._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(tk._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t._flagToExperiments)||r.set(e.feature_flag_key,e));var i=t._instance.getFeatureFlag(e.feature_flag_key);J(i)&&e.variants[i]&&t._applyTransforms(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];tk._matchesTestVariant(s,t._instance)&&t._applyTransforms(e.name,n,s.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())tk._logInfo(Xw);else if(!this._config.disable_web_experiments){if(te(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();tk._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),n=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=n&&n.variants[i]&&this._applyTransforms(n.name,i,n.variants[i].transforms)}}))}}previewWebExperiment(){var e=tk.getWindowLocation();if(null!=e&&e.search){var t=ni(null==e?void 0:e.search,"__experiment_id"),r=ni(null==e?void 0:e.search,"__experiment_variant");t&&r&&(tk._logInfo("previewing web experiments "+t+" && "+r),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),r,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(tk._logInfo("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this._applyTransforms(i[0].name,t,i[0].variants[t].transforms))}static _matchesTestVariant(e,t){return!te(e.conditions)&&tk._matchUrlConditions(e,t)&&tk._matchUTMConditions(e)}static _matchUrlConditions(e,t){var r;if(te(e.conditions)||te(null==(r=e.conditions)?void 0:r.url))return!0;var i=tk.getWindowLocation();if(i){var n,s,o,a=ui(t,i.href);return null==(n=e.conditions)||!n.url||ek[null!==(s=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,a)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(te(e.conditions)||te(null==(t=e.conditions)?void 0:t.utm))return!0;var r=Ha();if(r.utm_source){var i,n,s,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==r.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.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)==r.utm_medium,_=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==r.utm_term;return d&&p&&_&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];$r.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?tk._logInfo(Xw):"control"!==t?r.forEach((r=>{if(r.selector){var i;tk._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var n=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==n||n.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):tk._logInfo("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?qS(r,this._config.custom_blocked_useragents):void 0}}var rk=Ur("[Conversations]"),ik="Conversations not available yet.";function nk(e,t){var r,i,n,s,o,a,l,u=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,c=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,d=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,h=Y(d)?Math.max(c,2048):Math.max(c,d),p=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(s=null!==(o=null==p?void 0:p["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==s?s:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==p?void 0:p["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==p?void 0:p["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:p,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var sk=["debug","log","warn","error","info"],ok="console",ak="__posthogHandledLogsRequestError",lk=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[ak]=!0,r},uk=e=>!!e&&"object"==typeof e&&!0===e[ak],ck={featureFlags:class{constructor(e){this.name=Q_,this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=Gw,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t=this._refreshIntervalMs;Y(t)||this._config.remoteRequestsDisabled||!i||"hidden"===i.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==i?void 0:i.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._mutableConfigSource=new jw(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var r;null==(r=this._mutableConfigSource)||r.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),Fw(e.kv.initialize(),(()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))}))}_finishSetup(t){if(this._client===t)return e&&Jr(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties((()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues)),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){var e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&i&&!Y(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Y(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),null!=i&&i.addEventListener&&Jr(i,Hs,this._onVisibilityChange)))}_scheduleNextRefresh(){Y(this._refreshIntervalMs)||(Y(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){Y(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==i||null==i.removeEventListener||i.removeEventListener(Hs,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null==(t=this._dynamicProperties)||t.dispose(),this._dynamicProperties=void 0,this._reloadingHandlers=[],null==e||e.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return null==(t=this._client)?void 0:t.kv.get(e)}_set(e){this._persist((()=>{var t;return null==(t=this._client)?void 0:t.kv.set(e)}))}_remove(e){this._persist((()=>{var t;return null==(t=this._client)?void 0:t.kv.remove(e)}))}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){var e={};for(var t of[Gn,Zn,Yn,Xn]){var r=this._prop(t);Y(r)||(e[t]=r)}this._baseEventProperties=e;var i=v({},e),n=this._prop(jn);if(n)for(var s of Object.entries(n))i["$feature/"+s[0]]=s[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(ps);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e=this._config.evaluationContexts;return null!=e&&e.length?e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_getValidFlagKeys(){var e=this._config.flagKeys;if(!Y(e))return e.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t}))}initialize(){var e,t,r=this._config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var n,s,o=null!==(n=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)&&void 0!==n?n:{},a=Object.keys(i).filter((e=>!!i[e])).reduce(((e,t)=>(e[t]=i[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(e[t]=o[t],e)),{});return this._receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,r){var i,n,s=null!=r&&r.merge&&null!==(i=this._prop(jn))&&void 0!==i?i:{},o=null!=r&&r.merge&&null!==(n=this._prop(Zn))&&void 0!==n?n:{},a=v({},s,e),l=v({},o,t),u={};for(var c of Object.entries(a)){var d=c[0],h=c[1];u[d]={key:d,enabled:b(h),variant:S(h),reason:void 0,metadata:Y(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this._receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(Kn),t=this._prop(Xn),r=this._prop(es);if(!r&&!t)return e||{};var i=Vr({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var s of n){var o,a,l=i[s],u=null==t?void 0:t[s],c=Y(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=Y(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[s],p=v({},l,{enabled:c,variant:c?null!=d?d:null==l?void 0:l.variant:void 0});c!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),h&&(p.metadata=v({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[s]=p}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((r=>{var i=e[r];return{key:r,enabled:b(i),variant:S(i),payload:y(t[r])}}))}getFlagVariants(){var e=this._prop(jn),t=this._prop(Xn);if(!t)return e||{};for(var r=Vr({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(Zn),t=this._prop(es);if(!t)return e||{};for(var r=Vr({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||this._reloadDebouncer||(this._reloadingHandlers.slice().forEach((e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}})),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter((t=>t!==e))}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(cs)}_callFlagsEndpoint(e){this._clearDebouncer();var t=this._client;if(t&&!this._config.remoteRequestsDisabled&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:v({},t.initialPersonProperties,this._prop(ts)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(rs),timezone:Qa()};Y(t.deviceId)||(r.$device_id=t.deviceId),(null!=e&&e.disableFlags||this._config.featureFlagsDisabled)&&(r.disable_flags=!0);var i=this._getValidEvaluationEnvironments();i.length&&(r.evaluation_contexts=i);var n=this._getValidFlagKeys();Y(n)||(r.flag_keys=n);var s=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(s?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;var l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[hs]:[Zw]}),this._logger.error("Feature flag request failed",e),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then((e=>{var t,i,n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a===this._requestGeneration){if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),!r.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!o;var u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?Zw:"unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),n.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var c=!(null==(i=n.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),this._set({[hs]:u}),c?this._logger.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(n,o,{partialResponse:s}),l()}}else l()})).catch(u)}catch(e){u(e)}}}_hasStatusZeroCircuitBreakerTripped(){return ai(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=li(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.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 r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else this._logger.warn('getFeatureFlag for key "'+e+Kw)}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._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r,i=this.getFlagVariants(),n=e in i,s=i[e],o=this.getFlagPayloads()[e],a=String(s),l=this._prop(Yn)||void 0,u=this._prop(ps)||void 0,c=this._prop(cs)||{};if(this._config.deduplicateCallsPerSession){var d,h=null==(d=this._client)?void 0:d.session.sessionId,p=this._prop(ds);h&&h!==p&&(c={},r=h)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(a))r&&this._set({[cs]:c,[ds]:r});else{var _,g,f,m,b,S,w,k,C,E,T,x;G(c[e])?c[e].push(a):c[e]=[a],this._set(v({[cs]:c},r?{[ds]:r}:{}));var I=this.getFeatureFlagDetails(e),M=[...null!==(_=this._prop(hs))&&void 0!==_?_:[]];Y(s)&&M.push("flag_missing");var R={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(g=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this._config.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[e])&&void 0!==m?m:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Y(null==I||null==(S=I.metadata)?void 0:S.has_experiment)||(R.$feature_flag_has_experiment=I.metadata.has_experiment),Y(null==I||null==(w=I.metadata)?void 0:w.version)||(R.$feature_flag_version=I.metadata.version);var P,F=null!==(k=null==I||null==(C=I.reason)?void 0:C.description)&&void 0!==k?k:null==I||null==(E=I.reason)?void 0:E.code;F&&(R.$feature_flag_reason=F),null!=I&&null!=(T=I.metadata)&&T.id&&(R.$feature_flag_id=I.metadata.id),Y(null==I?void 0:I.original_variant)&&Y(null==I?void 0:I.original_enabled)||(R.$feature_flag_original_response=Y(I.original_variant)?I.original_enabled:I.original_variant),null!=I&&null!=(x=I.metadata)&&x.original_payload&&(R.$feature_flag_original_payload=null==I||null==(P=I.metadata)?void 0:P.original_payload),M.length&&(R.$feature_flag_error=M.join(",")),this._captureFeatureFlagCalled(R)}else r&&this._set({[cs]:c,[ds]:r});if(n)return{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:y(o)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+Kw)}_captureFeatureFlagCalled(e){try{var t;null==(t=this._client)||t.capture("$feature_flag_called",e).catch((e=>{this._logger.error("Failed to capture feature flag call",e)}))}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var r=this;return _((function*(){var i=r._client;if(i){var n={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},s=r._getValidEvaluationEnvironments();s.length&&(n.evaluation_contexts=s);var o,a=r._getValidFlagKeys();Y(a)||(n.flag_keys=a);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:r._config.compression,sentAt:"body",timeoutMs:r._config.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[e])||void 0}catch(e){return void r._logger.error("Remote config feature flag request failed",e)}try{t(o)}catch(e){r._logger.error("Remote config feature flag callback failed",e)}}}))()}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+Kw),t.defaultValue;var r=this.getFeatureFlag(e,t);return Y(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,r){this._receivedFeatureFlags(e,t,r)}_receivedFeatureFlags(e,t,r){if(this._client){this._hasLoadedFlags=!0;var i=function(e,t,r,i,n,s){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===s&&(s=Gw);var o=((e,t)=>{var r=e.flags;return r?v({},e,{featureFlags:Object.fromEntries(Object.keys(r).map((e=>{var t;return[e,null!==(t=r[e].variant)&&void 0!==t?t:r[e].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((e=>r[e].enabled)).filter((e=>{var t;return null==(t=r[e].metadata)?void 0:t.payload})).map((e=>{var t;return[e,null==(t=r[e].metadata)?void 0:t.payload]})))}):(e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)})(e,s),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(G(l)){s.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(l)for(var p=0;l.length>p;p++)h[l[p]]=!0;return{[Gn]:l,[jn]:h,[Jn]:!1}}var _=l,g=u,f=a;if(null!=n&&n.partialResponse)_=v({},t,_),g=v({},r,g),f=v({},i,f);else if(e.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));_=v({},t,Object.fromEntries(Object.entries(_).filter((e=>m.has(e[0]))))),g=v({},r,Object.fromEntries(Object.entries(g||{}).filter((e=>m.has(e[0]))))),f=v({},i,Object.fromEntries(Object.entries(f||{}).filter((e=>m.has(e[0])))))}else _=v({},t,_),g=v({},r,g),f=v({},i,f);return v({[Gn]:Object.keys(Jw(_)),[jn]:_||{},[Zn]:g||{},[Kn]:f||{},[Jn]:!0===e.minimalFlagCalledEvents},c?{[Yn]:c}:{},d?{[ps]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);i&&this._set(i),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([Xn,es]),this._fireFeatureFlagsCallbacks(),void Qw.info("All overrides cleared");if(G(e))return this._set({[Xn]:Yw(e)}),this._fireFeatureFlagsCallbacks(),void Qw.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,r=e;this._override_warning=Boolean(null!==(t=r.suppressWarning)&&void 0!==t&&t);var i={},n=r.flags,s=r.payloads;return n&&(i[Xn]=G(n)?Yw(n):n),s&&(i[es]=s),Object.keys(i).length&&this._set(i),!1===n&&!1===s?this._remove([Xn,es]):!1===n?this._remove(Xn):!1===s&&this._remove(es),this._fireFeatureFlagsCallbacks(),!1===n?Qw.info("Flag overrides cleared"):n&&Qw.info("Flag overrides set",{flags:n}),void(!1===s?Qw.info("Payload overrides cleared"):s&&Qw.info("Payload overrides set",{payloads:s}))}if(e&&"object"==typeof e)return this._set({[Xn]:e}),this._fireFeatureFlagsCallbacks(),void Qw.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i=(this._prop(Qn)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},s={$feature_flag:e,$feature_enrollment:t,$set:n};i&&(s.$early_access_feature_name=i.name),r&&(s.$feature_enrollment_stage=r);var o=v({},this.getFlagVariants(),{[e]:t});this._set({[Gn]:Object.keys(Jw(o)),[jn]:o,[ts]:v({},this._prop(ts)||{},n)}),this._fireFeatureFlagsCallbacks();try{var a;null==(a=this._client)||a.capture("$feature_enrollment_update",s).catch((e=>{this._logger.error("Failed to capture early access feature enrollment",e)}))}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(Qn);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return _((function*(){var i=r._client;if(i){var n,s=t?"&"+t.map((e=>"stage="+e)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+s,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r._set({[Qn]:n=o.json.earlyAccessFeatures})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(n)}catch(e){r._logger.error("Early access feature callback failed",e)}}}))()}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,r)=>(e[r]=t[r],e)),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((t=>{try{t(r,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(ts)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,s={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(s[o]=n[o]));this._set({[ts]:v({},r,s,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=v({},this._prop(ts)||{});e.forEach((e=>{delete r[e]})),this._set({[ts]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(ts),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(rs)||{},i=v({},r);for(var n of Object.keys(e))i[n]=v({},r[n],e[n]);this._set({[rs]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(rs)||{};this._set({[rs]:v({},t,{[e]:{}})})}else this._remove(rs)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},dk={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===Js||this._recordingStatus===Xs?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=js,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t;if(null==i||!i.visibilityState||"visible"===i.visibilityState)return!0;var r=null==e||null==(t=e.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=r&&r.length)||r.some((e=>"visible"===e.name))})(),this._onVisibilityChange=()=>{var e;"visible"===(null==i?void 0:i.visibilityState)&&(this._documentWasEverVisible=!0,null==(e=this._lazyLoadedSessionRecording)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Cw.error("started without valid sessionManager"),new Error(kw+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===Ds)throw new Error(kw+' cannot be used with cookieless_mode="always"');null!=i&&i.addEventListener&&Jr(i,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(){this._sessionRecordingDisposed=!0,null==i||null==i.removeEventListener||i.removeEventListener("visibilitychange",this._onVisibilityChange),this.stopRecording()}get _isRecordingEnabled(){var t,r=!(null==(t=this._instance.get_property(Rn))||!t.enabled),i=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&r&&i&&!n}startIfEnabledOrStop(e){var t;if(!(this._sessionRecordingDisposed||this._isRecordingEnabled&&null!=(t=this._lazyLoadedSessionRecording)&&t.isStarted)){var r=!Y(Object.assign)&&!Y(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),Cw.info("starting")):(this._recordingStatus=js,this.stopRecording())}}_lazyLoadAndStart(e){var t,r,i;this._isRecordingEnabled&&(this._recordingStatus!==Js&&this._recordingStatus!==Xs&&(this._recordingStatus=Ys),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=h.__PosthogExtensions__)&&r.initSessionRecording?this._onScriptLoaded(e):null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return this._instance.register_for_session({[Es]:!0}),Cw.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(Nn),null==(t=this._persistence)||t.unregister(Pn)}_validateSampleRate(e,t){if(te(e))return null;var r,i=re(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(Cw.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,r,i=this._persistence,n=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),s=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:s;te(o)&&this._resetSampling();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[Rn]:v({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:v({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Y(a)?null:a,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):(this._recordingStatus===Js&&(this._recordingStatus=Xs,Cw.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):Cw.warn("log called before recorder was ready")}get _scriptName(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Rn);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(Rn);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return Cw.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!te(e.cache_timestamp)&&Date.now()-e.cache_timestamp<=bl}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed){if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return Cw.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Es]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(n=h.__PosthogExtensions__)?void 0:n.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===Xs||this._recordingStatus===Js)return;return this._recordingStatus=Js,Cw.info("persisted remote config is stale, requesting fresh config before starting"),void new dS(this._instance).load()}this._recordingStatus=Ys,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Ln]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[Fn]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?An:On]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}}},hk={autocapture:class extends xb{constructor(e){super(new vw(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&($r.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,$r.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var r;if(e&&(null==(r=e.history[t])||!r.__posthog_wrapped__)){var i=this;Dh(e.history,t,(e=>function(r,n,s){e.call(this,r,n,s),i._capturePageview(t)}))}}_getCurrentLocation(){var t=null==e?void 0:e.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:K(e)?e:{}}_shouldCaptureHashChanges(e){return void 0===e&&(e=this._getCaptureOptions()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){var t=this._getCaptureOptions(),r=this._lastLocation;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this._shouldCaptureHashChanges(t)&&e.hash!==r.hash))}_capturePageview(e){try{var t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(Us,{navigation_type:e}),this._lastLocation=t}catch(t){$r.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var t=()=>{this._capturePageview("popstate")};Jr(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var t=()=>{this._capturePageview("hashchange")};Jr(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[Sn]),this.rageclicks=new Sb(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return K(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return te(this._config.capture_heatmaps)?te(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Ew.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Sn]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){Tw(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==i?void 0:i.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&i&&(this._flushHandler=this._flush.bind(this),Jr(e,$s,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),Jr(i,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),Jr(i,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Wb(this.instance,$b,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Jr(i,Hs,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&i&&(this._flushHandler&&e.removeEventListener($s,this._flushHandler),this._onClickHandler&&i.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&i.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&i.removeEventListener(Hs,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(t=this._deadClicksCapture)||t.stop(),this._initialized=!1)}_getProperties(t,r){var i=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(t,r,i){for(var n=t;n&&gi(n)&&!fi(n,"body");){if(n===i)return!1;var s=void 0;try{var o,a,l;s=null==(o=null!==(a=null==(l=n.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:e)?void 0:o.getComputedStyle(n).position}catch(e){return!1}if(q(r,s))return!0;n=Mi(n)}return!1}(Ti(t),["fixed","sticky"],s);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:i),target_fixed:o,type:r}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!vi(e.target)&&Tw(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Ni(Ti(e),this.instance.config.rageclick)&&this._capture(v({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!vi(e.target)&&Tw(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(t){if(e){var r=this._config.disable_capture_url_hashes?Tt(e.location.href):e.location.href,i=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...Da,...i||[]]:[],s=si(r,n,Ba);this._buffer=this._buffer||{},this._buffer[s]||(this._buffer[s]=[]),this._buffer[s].push(t)}}_flush(){this._buffer&&!Z(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Wb,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",v({$current_url:this._buffer.url},this._buffer.metrics.reduce(((e,t)=>v({},e,{["$web_vitals_"+t.name+"_event"]:v({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},te(null==e?void 0:e.name)||te(null==e?void 0:e.value))mw.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!Y(i)){var n=re(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Y(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=i),this._buffer.firstMetricTimestamp=Y(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=v({},e,r?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete o.entries,K(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){var a={};for(var l of ww){var u="url"===l&&"string"==typeof e.attribution[l]?this._maskedURL(e.attribution[l]):e.attribution[l];Y(u)||(a[l]=u)}o.attribution=a}else delete o.attribution;Y(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else mw.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,n=!1,s=h.__PosthogExtensions__,o=null==s?void 0:s.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Y(o)?null==s?void 0:s.postHogWebVitalsCallbacks:void 0);if(!Y(a)){var l=a.withoutAttribution,u=this.attributionMetrics;n=!Y(l),e=u.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,t=u.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,r=u.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,i=u.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(e&&t&&r&&i){var c={reportSoftNavs:this.useSoftNavs},d=n&&this.attributionMetrics.indexOf("INP")>-1?v({},c,{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this),d),this._initialized=!0}else mw.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[En]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=K(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return te(r)?(null==(t=this._instance.persistence)?void 0:t.props[Mn])||bw:r}get flushToCaptureTimeoutMs(){return(K(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=K(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return ne(e)?e?bw:[]:G(e)?e:Sw}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e=K(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){var e=K(this._perfConfig)&&re(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:yw;return e>0&&6e4>=e?yw:e}get isEnabled(){var e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return mw.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=K(this._perfConfig)?this._perfConfig.web_vitals:ne(this._perfConfig)?this._perfConfig:void 0;return ne(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(mw.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=K(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=K(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[En]:r}),this._instance.persistence.register({[Mn]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t=h.__PosthogExtensions__,r=this._callbackFlavor,i=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=i&&i[r]||"web-vitals"===r&&Y(i)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,r,(t=>{t?mw.error("failed to load script",t):e()}))}_maskedURL(t){var r=t||(null==e?void 0:e.location.href);if(r){var i=this._instance.config.disable_capture_url_hashes?Tt(r):r,n=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Da,...n||[]]:[];return si(i,s,Ba)}mw.error("Could not determine current URL")}}},pk={exceptionObserver:class{constructor(t){var r;this._startCapturing=()=>{var t;if(e&&this.isEnabled&&null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions){var r=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=r(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){gw.error("failed to start",e),this._stopCapturing()}}},this._instance=t,this._remoteEnabled=!(null==(r=this._instance.persistence)||!r.props[wn]),this._rateLimiter=new fe(v({},function(e){var t,r,i,n;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:gw})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return K(e)?t=v({},t,e):(Y(e)?this._remoteEnabled:e)&&(t=v({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gw.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return gw.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[wn]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,n=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(n)?gw.info("Skipping exception capture because of client rate limiting.",{exception:n}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=af(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(kn))&&void 0!==t?t:[],this._exceptionStepsConfig=Dr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Nr(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=Dr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var n=e.config;if("errorTracking"in n){var s=null!==(t=null==(r=n.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=n.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=s,this._instance.persistence&&this._instance.persistence.register({[kn]:this._suppressionRules,[Cn]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Cn),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=r?r:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!J(e)||0===e.trim().length)return void nf.warn("Ignoring exception step because message must be a non-empty string");var r=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(((r,i)=>Ar.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&nf.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this._exceptionStepsBuffer.add(v({[Fr]:e,[Lr]:(new Date).toISOString()},i))}catch(e){nf.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void nf.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void nf.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void nf.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void nf.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&te(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(s=globalThis._posthogReleaseId)&&s.length>0?s:void 0;i&&(r.$release_id=i);try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return n&&this._exceptionStepsBuffer.clear(),n}catch(e){return nf.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void nf.error("Failed to process exception event. Ignoring this exception.",e)}var s}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:v({},e,{$exception_steps:t})}catch(t){return nf.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Fr]:e,[Lr]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return K(e)?v({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce(((e,t)=>{var r=t.type,i=t.value;return J(r)&&r.length>0&&e.$exception_types.push(r),J(i)&&i.length>0&&e.$exception_values.push(i),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var r=e.values.map((e=>{var r=Ca[e.operator],i=t[e.key];if(!r||!i)return!1;var n=G(e.value)?e.value:[e.value];return n.length>0&&r(n,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return nf.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap((e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}));return t.some((e=>{var t=e.filename;return!!t&&sf.some((e=>t.startsWith(e)))}))}_isInjectedBrowserScriptException(e){return e.some((e=>{var t=e.value;return J(t)&&of.some((e=>t.includes(e)))}))}_isPostHogException(e){if(e.length>0){var t,r,i,n,s=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=s[s.length-1];return null!==(i=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!te(e)&&G(e)}}},_k=v({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[xn]:!!t.productTours}),!Iw(this._instance))return!this._productTourManager&&te(null==(r=this._persistence)?void 0:r.props[us])||xw.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&Iw(this._instance)&&this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",(t=>{t?xw.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=h.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!G(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[us];if(G(i)&&!t)return this._cachedTours=i,void e(i,{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(Iw(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||xw.warn(n):xw.error(n),void e([],{isLoaded:!1,error:n})}var s=G(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=s,r&&r.register({[us]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){te(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(us)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},ck),vk={siteApps:class{constructor(e){this._siteAppElementPatchCount=0,this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=h._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,i,n,s,o,a;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(c)){var h=d[0];l[h]={id:u[h],type:h,properties:d[1]}}var p=e.$set_once,_=e.$set;return{event:v({},g(e,Mw),{properties:v({},e.properties,_?{$set:v({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},_)}:{},p?{$set_once:v({},null!==(i=null==(n=e.properties)?void 0:n.$set_once)&&void 0!==i?i:{},p)}:{}),elements_chain:null!==(s=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==s?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Rw.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Rw.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,n,s,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==i?void 0:i.defaultView,c=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!c)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var d=[],h=this,p=new WeakSet,_=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push((()=>{e[t]=i}))}},v=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},g=e=>e.map((e=>"string"==typeof e?e:v(e))).filter((e=>!ee(e)));return _(c,"appendChild",(e=>function(t){var r=v(t);return r?e.call(this,r):t})),_(c,"insertBefore",(e=>function(t,r){var i=v(t);return i?e.call(this,i,r):t})),_(c,"replaceChild",(e=>function(t,r){var i=v(t);return i?e.call(this,i,r):r})),[null==(t=u.Element)?void 0:t.prototype,null==(r=u.Document)?void 0:r.prototype,null==(n=u.DocumentFragment)?void 0:n.prototype].forEach((e=>{_(e,"append",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),_(e,"prepend",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}))})),[null==(s=u.Element)?void 0:s.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((e=>{_(e,"before",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),_(e,"after",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})),_(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var n=g(r);return r.length&&!n.length?void 0:e.apply(this,n)}))})),_(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(e=>function(t,r){var i=v(r);return i?e.call(this,t,i):null})),this._restoreSiteAppElementPatches=()=>{d.forEach((e=>e())),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(Rw.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>this._runWithPreparedSiteAppElements((()=>null==t.processEvent?void 0:t.processEvent(e))))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,n=n=>{t.errored=!n,t.loaded=!0,Rw.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var s=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),n(e)}})),!1).processEvent;s&&(t.processEvent=s),i=!0}catch(t){Rw.error(Pw+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){Rw.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements((()=>null==i.processEvent?void 0:i.processEvent(r)))}catch(t){Rw.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(e){var t,r,i,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void Rw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var s=e.config;if(null!=(i=s.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;h["__$$ph_site_app_"+t]=n._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(n._instance,r,(e=>{if(e)return Rw.error(Pw+t,e)}))};for(var a of s.siteApps)o()}else Rw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},gk={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(Y(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Y(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this._stopCapturing()},this._instance=e}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=h.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return fw.error("failed to load script",t);e()}))}_getConfiguredHostnames(){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}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return G(e)?(G(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(G(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},fk=v({surveys:class extends Ow{constructor(e){var t;super(new $w(e),{get projectToken(){return t.config.token},kv:new Hw(t=e)}),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?fS(e,t.query):e;return new Promise((e=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})}))}}},ck),mk={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,r,n){if(void 0===t&&(t=void 0),void 0===r&&(r=void 0),void 0===n&&(n=void 0),Xr(this.instance.config))return!1;if(!e||!i)return!1;t=null!=t?t:e.location,n=null!=n?n:e.history;try{if(!r){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}r=null==e?void 0:e.localStorage}var s,o=Uw||oi(t.hash,"__posthog")||oi(t.hash,"state"),a=o?Gr((()=>JSON.parse(atob(decodeURIComponent(o)))))||Gr((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?t.hash=a.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((s=JSON.parse(r.getItem(Ww)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=h.ph_load_toolbar||h.ph_load_editor;!te(t)&&Q(t)?t(e,this.instance):zw.warn("No toolbar load function found")}loadToolbar(t){var r=!(null==i||!i.getElementById(di));if(!e||r)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=v({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(Ww,JSON.stringify(v({},s,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(s);else if(0===this._getToolbarState()){var o;this._setToolbarState(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return zw.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(s)})),Jr(e,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(s)}))}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},yk=v({experiments:tk},ck),bk={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this._remoteConfigSuccessful=e.ok,e.ok)){var t=e.config.conversations;te(t)||(ne(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Xr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==h?void 0:h.__PosthogExtensions__;if(e&&!Y(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(As);r(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else rk.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,rk.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else rk.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){rk.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():rk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!ee(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Xr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Y(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?te(this._remoteConfig)||!this._remoteConfig.token?"missing_token":null!=h&&h.__PosthogExtensions__?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,r){var i=this;return _((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(rk.warn(ik),null)}))()}getMessages(e,t){var r=this;return _((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(rk.warn(ik),null)}))()}markAsRead(e){var t=this;return _((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(rk.warn(ik),null)}))()}getTickets(e){var t=this;return _((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(rk.warn(ik),null)}))()}requestRestoreLink(e){var t=this;return _((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(rk.warn(ik),null)}))()}restoreFromToken(e){var t=this;return _((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(rk.warn(ik),null)}))()}restoreFromUrlToken(){var e=this;return _((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(rk.warn(ik),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}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},Sk={logs:class{constructor(t){var r,i=this;this.name=K_,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Ur("[logs]"),this._coreLogger=v({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(uk)||i._logger.error(...t)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect())},this._instance=t,this._instance&&null!=(r=this._instance.config.logs)&&r.captureConsoleLogs&&(this._isLogsEnabled=!0),e&&Jr(e,"online",this._onReconnect)}_buildCore(e,t,r,i){var n,s=nk(null==(n=this._instance)||null==(n=n.config)?void 0:n.logs,r);return[new Jt(this._createHost(e,t),s,this._coreLogger,(()=>this._getSdkContext()),(e=>e()),void 0,i),s]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore((()=>this._queue),(e=>{this._queue=e}));this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore((()=>this._consoleQueue),(e=>{this._consoleQueue=e}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ok);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}setup(e){var t;if(!this._disposed){this._client=e,null!=(t=this._instance)&&null!=(t=t.config)&&null!=(t=t.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();var r=!1,i=e.onRemoteConfig((e=>{var t;r=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)}));this._disposed?i.dispose():(this._remoteConfigSubscription=i,r||this.loadIfEnabled())}}dispose(){var t,r,i,n;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null==(t=this._remoteConfigSubscription)||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null==(r=this._consoleLogsDispose)||r.call(this),this._consoleLogsDispose=void 0,null==(i=this._core)||i.reset(),null==(n=this._consoleCore)||n.reset())}onRemoteConfig(e){var t,r;if(!this._disposed){var i=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;te(i)?this._stopRecorderStartedByPersistedHint():(null==(r=this._instance)||null==(r=r.persistence)||r.register({[In]:!!i}),i?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}}reset(){var e,t,r,i;this._stopConsoleRecorder(),null==(e=this._core)||e.clearQueue(),this._queue=[],null==(t=this._core)||t.reset(),null==(r=this._consoleCore)||r.clearQueue(),this._consoleQueue=[],null==(i=this._consoleCore)||i.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,r){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:r})}_persistedCaptureHint(){var e;return!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)||!e[In])}_remoteConfigWillArrive(){var e,t;return null==(e=this._instance)||null==e._shouldDisableFlags||!e._shouldDisableFlags()||!(null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])||!t.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null==(e=this._consoleCore)||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e,t=this;if(!this._isRecordingConsole&&null!=h&&h.console){var r=nk(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=function(e){var i;try{i=Vg(h.console[e])}catch(e){return 0}if(!i)return 0;t._consoleRecorderUnpatchers.push(Dh(h.console,e,(n=>{var s=function(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];try{t._recordConsoleEntry(e,s,r)}catch(e){}return n.apply(h.console,s)};return s.__rrweb_original__=i,s})))};for(var n of sk)i(n);this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout((()=>{this._stopConsoleRecorder()}),3e4)}}_recordConsoleEntry(e,t,r){var i;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null!=(i=this._instance)&&i.is_capturing()){if(r>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){for(var e of(this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0),this._consoleRecorderUnpatchers))e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){var e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={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._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch((e=>this._logFlushError(e))),this._consoleCore&&this._consoleCore.flush().catch((e=>this._logFlushError(e))))}_logFlushError(e){uk(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this._disposed&&this._isLogsEnabled&&!this._isLoaded&&!this._isLoading){var e=null==h?void 0:h.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();var t=e.loadExternalDependency;if(!t)return this._logger.error(As),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",(t=>{if(this._isLoading=!1,!this._disposed&&this._isLogsEnabled){var r=e.logs;if(t||null==r||!r.initializeLogs)this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var i,n,s=this._takeConsoleBuffer();this._consoleLogsDispose=r.initializeLogs(null!==(i=this._client)&&void 0!==i?i:this._instance),this._isLoaded=!0,s.length>0&&(null==r.replayConsoleBuffer||r.replayConsoleBuffer(null!==(n=this._client)&&void 0!==n?n:this._instance,s))}}}))}catch(e){throw this._isLoading=!1,e}}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===k.LogsQueue?e():void 0,setPersistedProperty(e,r){var i;e===k.LogsQueue&&t(null!==(i=r)&&void 0!==i?i:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>qr.LIB_NAME,getLibraryVersion:()=>qr.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(ai(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:lk(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(n),t(e))},n=setTimeout((()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:lk(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:lk(e.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}}))}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=li(e,this._consecutiveStatusZeroFailures,3,(()=>this._logger.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."))))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,qr.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,ok,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,n){if(0!==t.length){var s=t.map((e=>e.record));n([]);var o=Yt(s,Zt(r,qr.LIB_NAME,qr.LIB_VERSION),i,qr.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,n=r.sessionStartTimestamp,s=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,te(n)||(t.sessionStartTimestamp=n),te(s)||(t.lastActivityTimestamp=s)}if(null!=h&&null!=(e=h.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Tt(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},wk={metrics:class{constructor(e){this._logger=Ur("[metrics]"),this._instance=e}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new rr(this._createHost(),function(e){var t,r,i,n,s,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(s=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==s?s:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch((e=>this._logger.error("PostHog metrics flush failed:",e)))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>qr.LIB_NAME,getLibraryVersion:()=>qr.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((r=>{var i=!1,n=e=>{i||(i=!0,clearTimeout(s),r(e))},s=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(v({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;n({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("metrics request failed with status "+t)})}}}))}))}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},kk=v({},ck,dk,hk,pk,_k,vk,fk,gk,mk,yk,bk,Sk,wk);_w.__defaultExtensionClasses=v({},kk);var Ck=function(){qr.SDK_DIST_CHANNEL="npm";var t=XS[aw]=new _w;return function(){function t(){t.done||(t.done=!0,lw=!1,zr(XS,(function(e){e._dom_loaded()})))}null!=i&&i.addEventListener?"complete"===i.readyState?t():Jr(i,"DOMContentLoaded",t,{capture:!1}):e&&$r.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();export{T_ as Compression,sS as DEFAULT_PRODUCT_TOUR_APPEARANCE,N_ as DisplaySurveyType,_w as PostHog,oS as ProductTourEventName,aS as ProductTourEventProperties,O_ as SurveyEventName,D_ as SurveyEventProperties,x_ as SurveyEventType,M_ as SurveyPosition,L_ as SurveyQuestionBranchingType,F_ as SurveyQuestionType,A_ as SurveySchedule,R_ as SurveyTabPosition,P_ as SurveyType,I_ as SurveyWidgetType,Ck as default,Ck as posthog,hS as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.full.no-external.js.map
|