posthog-js 1.424.0 → 1.424.1

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.
Files changed (43) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/customizations.full.js +1 -1
  14. package/dist/customizations.js +1 -1
  15. package/dist/default-extensions.js +1 -1
  16. package/dist/default-extensions.js.map +1 -1
  17. package/dist/extension-bundles.js +1 -1
  18. package/dist/extension-bundles.js.map +1 -1
  19. package/dist/lazy-recorder.js +1 -1
  20. package/dist/lazy-recorder.js.map +1 -1
  21. package/dist/main.js +1 -1
  22. package/dist/main.js.map +1 -1
  23. package/dist/module.full.js +1 -1
  24. package/dist/module.full.js.map +1 -1
  25. package/dist/module.full.no-external.js +1 -1
  26. package/dist/module.full.no-external.js.map +1 -1
  27. package/dist/module.js +1 -1
  28. package/dist/module.js.map +1 -1
  29. package/dist/module.no-external.js +1 -1
  30. package/dist/module.no-external.js.map +1 -1
  31. package/dist/module.slim.js +1 -1
  32. package/dist/module.slim.no-external.js +1 -1
  33. package/dist/posthog-recorder.js +1 -1
  34. package/dist/posthog-recorder.js.map +1 -1
  35. package/dist/recorder-v2.js +1 -1
  36. package/dist/recorder-v2.js.map +1 -1
  37. package/dist/recorder.js +1 -1
  38. package/dist/recorder.js.map +1 -1
  39. package/lib/package.json +3 -3
  40. package/lib/src/extensions/replay/external/json-ld.js.map +1 -1
  41. package/lib/src/extensions/replay/external/network-plugin.js +17 -9
  42. package/lib/src/extensions/replay/external/network-plugin.js.map +1 -1
  43. package/package.json +6 -6
@@ -1,2 +1,2 @@
1
- !function(){"use strict";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,s=null==t?void 0:t.location,n=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,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,s)}function g(e){return function(){var t=this,r=arguments;return new Promise((function(i,s){var n=e.apply(t,r);function o(e){p(n,i,s,o,a,"next",e)}function a(e){p(n,i,s,o,a,"throw",e)}o(void 0)}))}}function _(){return _=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},_.apply(null,arguments)}function v(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}({}),x="min_length",E="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"],T=["token"],M=20,P=1e3,R=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 s=e.charCodeAt(r+1);56320>s||s>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","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],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()},W=function(e){return e.replace(/^\$/,"")};function U(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,se=e=>"[object Boolean]"===j.call(e),ne=e=>e instanceof FormData,oe=e=>q(I,e),ae=e=>q(T,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"],ge=e=>q(pe,e),_e=[!1,"false",0,"0","no"];function ve(e,t,r,i,s){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: "+s),ve(s||r,t,r,i))}class fe{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ve(e.bucketSize,0,100,e._logger),this._refillRate=ve(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ve(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),s=this._buckets[i];return s?this._applyRefill(s,r):this._buckets[i]=s={tokens:this._bucketSize,lastAccess:r},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var me="Mobile",ye="iOS",be="Android",Se="Tablet",we=be+" "+Se,ke="iPad",Ce="Apple",xe=Ce+" Watch",Ee="Safari",Ie="BlackBerry",Te="Samsung",Me=Te+"Browser",Pe=Te+" Internet",Re="Chrome",Fe=Re+" OS",Le=Re+" "+ye,Ae="Internet Explorer",Oe=Ae+" "+me,De="Opera",Ne=De+" Mini",Be="Edge",qe="Microsoft "+Be,He="Firefox",$e=He+" "+ye,We="Nintendo",Ue="PlayStation",ze="Xbox",Ve=be+" "+me,je=me+" "+Ee,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",st="Whale",nt="DuckDuckGo",ot="Pale Moon",at="Waterfox",lt="Brave",ut="Claude",ct="Codex",dt="ChatGPT",ht="Google Search App",pt="(\\d+(\\.\\d+)?)",gt=new RegExp("Version/"+pt),_t=new RegExp("("+ut+"|"+ct+"|"+dt+")\\/"+pt),vt=new RegExp(ze,"i"),ft=new RegExp(Ue+" \\w+","i"),mt=new RegExp(We+" \\w+","i"),yt=new RegExp(Ie+"|PlayBook|BB10","i"),bt={"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"},St=function(e,t,r,i){t=t||"";var s=function(e){return null!=e&&e.brave?lt:null}(r);return s||(null!=i&&i.detectGoogleSearchApp&&q(e,"GSA/")?ht:q(e," OPR/")&&q(e,"Mini")?Ne:q(e," OPR/")?De:yt.test(e)?Ie:q(e,"IE"+me)||q(e,"WPDesktop")?Oe:q(e,"OculusBrowser")?tt:q(e,Me)?Pe:q(e,Be)||q(e,"Edg/")?qe:q(e,rt+"/")?rt:q(e,"YaBrowser/")?it:q(e,st+"/")?st:q(e,nt+"/")||q(e,"Ddg/")?nt:q(e,ut+"/")?ut:q(e,ct+"/")?ct:q(e,dt+"/")?dt:q(e,"FBIOS")?"Facebook "+me:q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?Le:q(e,"CrMo")||q(e,Re)?Re:q(e,be)&&q(e,Ee)?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,Ee)&&!q(e,Re)&&!q(e,be)}(e))(e,t)?q(e,me)?je:Ee:q(e,"PaleMoon/")?ot:q(e,at+"/")?at:q(e,He)?He:q(e,"MSIE")||q(e,"Trident/")?Ae:q(e,"Gecko")?He:"")},wt={[Oe]:[new RegExp("rv:"+pt)],[qe]:[new RegExp(Be+"?\\/"+pt)],[Re]:[new RegExp("("+Re+"|CrMo)\\/"+pt)],[Le]:[new RegExp("CriOS\\/"+pt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pt)],[Ee]:[gt],[je]:[gt],[De]:[new RegExp("(Opera|OPR)\\/"+pt)],[He]:[new RegExp(He+"\\/"+pt)],[$e]:[new RegExp("FxiOS\\/"+pt)],[et]:[new RegExp("Konqueror[:/]?"+pt,"i")],[Ie]:[new RegExp(Ie+" "+pt),gt],[Ve]:[new RegExp("android\\s"+pt,"i")],[Pe]:[new RegExp(Me+"\\/"+pt)],[tt]:[new RegExp("OculusBrowser\\/"+pt)],[rt]:[new RegExp(rt+"\\/"+pt)],[it]:[new RegExp("YaBrowser\\/"+pt)],[st]:[new RegExp(st+"\\/"+pt)],[lt]:[new RegExp(lt+"\\/"+pt)],[ut]:[_t],[ct]:[_t],[dt]:[_t],[nt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pt)],[ot]:[new RegExp("PaleMoon\\/"+pt)],[at]:[new RegExp(at+"\\/"+pt)],[ht]:[new RegExp("GSA\\/"+pt)],[Ae]:[new RegExp("(rv:|MSIE )"+pt)],Mozilla:[new RegExp("rv:"+pt)]},kt=function(e,t,r,i){var s=St(e,t,r,i),n=wt[s];if(Y(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ct=[[new RegExp(ze+"; "+ze+" (.*?)[);]","i"),e=>[ze,e&&e[1]||""]],[new RegExp(We,"i"),[We,""]],[new RegExp(Ue,"i"),[Ue,""]],[yt,[Ie,""]],[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=bt[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",""]]],xt=function(e){for(var t=0;Ct.length>t;t++){var r=Ct[t],i=r[1],s=r[0].exec(e),n=s&&(Q(i)?i(s,e):i);if(n)return n}return["",""]},Et=function(e){return mt.test(e)?We:ft.test(e)?Ue:vt.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)?xe:yt.test(e)?Ie:/(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:""},It=function(e,t){var r,i,s,n,o=Et(e);return o===ke||o===we||"Kobo"===o||"Kindle Fire"===o||o===Xe?Se:o===We||o===ze||o===Ue||o===Ze?"Console":o===xe?"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!==(s=null==t?void 0:t.screenHeight)&&void 0!==s?s:0)/(null!==(n=null==t?void 0:t.devicePixelRatio)&&void 0!==n?n:1)?me:Se:"Desktop"},Tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Mt(e,t){return"string"==typeof(r=e)&&Tt.test(r)?e:t();var r}function Pt(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 Rt(e){return e?e.split("#")[0]:e}function Ft(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function Lt(e,t,r){return At.apply(this,arguments)}function At(){return(At=g((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,s)=>{i=Ft((()=>{try{null==r||r(),e()}catch(e){s(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var Ot,Dt="NativeGzipValidationError",Nt=e=>e.length>=2&&31===e[0]&&139===e[1],Bt=(e,t)=>e===C.GZipJS||t===C.GZipJS||"gzip"===t,qt=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Ht=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return qt(e)||t===Dt},$t=e=>{throw Pt(Dt,"Native gzip produced invalid output: "+e)},Wt=function(){var e=g((function*(e,t){18>e.size&&$t("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Nt(r)&&8===r[2]||$t("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Ot)return Ot;Ot=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Ot[e]=t>>>0}return Ot})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&$t("invalid-crc");var s=t.length>>>0;i.getUint32(4,!0)!==s&&$t("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function Ut(e,t,r){return zt.apply(this,arguments)}function zt(){return zt=g((function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(i).then((()=>n.close())).catch(function(){var e=g((function*(e){try{yield n.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield Wt(l,i),l}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})),zt.apply(this,arguments)}var Vt=0x8000000000000000,jt="9223372036854775808",Gt={}.propertyIsEnumerable;function Qt(e,t){try{return Yt(e,t,{ancestors:new WeakSet,remainingNodes:R},0)}catch(e){return[]}}function Kt(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:L};if(r.remainingNodes--,se(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){var r=e.toString(),i=BigInt(jt);return e>=i||-i>e?(null==t||t.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}(e,t);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 s=BigInt(e).toString();return e>=Vt||-Vt>e?(null==t||t.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}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 n=e.getTime(),o=Number.isFinite(n)?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 Kt(a.call(e),t,r,i+1)}catch(e){}return G(e)?{arrayValue:{values:Zt(e,t,r,i+1)}}:{kvlistValue:{values:Yt(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:D(String(e))}}function Zt(e,t,r,i){for(var s=[],n=Math.min(e.length,P),o=0;n>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(te(a))continue;s.push(Kt(a,t,r,i))}catch(e){s.push({stringValue:A})}return e.length>o&&s.push({stringValue:L}),s}function Yt(e,t,r,i){var s=[];for(var n in e)if(Gt.call(e,n)){if(s.length>=P||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[n];if(ee(o)||Y(o))continue;s.push({key:D(n),value:Kt(o,t,r,i)})}catch(e){s.push({key:D(n),value:{stringValue:A}})}}return s}function Jt(e,t,r){return _({},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})}var Xt={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var er={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},tr=er.info;function rr(e){try{return D(String(e))}catch(e){return A}}function ir(e,t,r,i){var s,n=er[e.level||"info"]||tr,o=n.text,a=n.number,l=(void 0===(s=re(i)?i:void 0)&&(s=Date.now()),String(s)+"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=_({},u),d=e.attributes;if(d){var h=[];try{h=Object.keys(d)}catch(e){h=[]}for(var p of h){var g=void 0;try{g=d[p]}catch(e){g=A}Object.defineProperty(c,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var v={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:o,body:{stringValue:rr(e.body)},attributes:Qt(c,r)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),Y(e.trace_flags)||(v.flags=e.trace_flags),v}function sr(e,t,r){return Jt(e,t,r)}function nr(e,t,r,i){return{resourceLogs:[{resource:{attributes:Qt(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let or=class{constructor(e,t,r,i,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=s,this._waitForStoragePersist=n,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 s={record:ir(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(s)))}}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 s of r)try{var n=s(i);if(!n)return this._logger.info("Log was rejected in beforeSend function"),null;i=n}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 g((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return g((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,s=0;r.length>0&&i>s;){var n,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=nr(c,e._buildResourceAttributes(),null!==(n=e._scopeName)&&void 0!==n?n: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:[],s+=u.length,"fatal"===h.kind)throw h.error}}}))()}_persistQueueAdvance(e){var t=this;return g((function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),s=null!==(r=t._instance.getPersistedProperty(k.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(k.LogsQueue,s.slice(i)),yield t._waitForStoragePersist()}))()}_buildResourceAttributes(){return sr(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=Ft((()=>{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 g((function*(){t._clearFlushTimer();var r=t.flush().catch((()=>{}));void 0!==e?yield Lt(r,e):yield r}))()}flushWithTimeout(e){var t=this;return g((function*(){var r=t.flush();yield Lt(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 ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(e){return String(e)+"000000"}function ur(e,t,r,i){var s="";return i&&(s=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+s}let cr=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=g((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?_({},t.attributes):void 0,i=ur(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 s=this._series.get(i);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,s)}var n=this._typeByName.get(t.name);void 0===n?this._typeByName.set(t.name,t.type):n===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+n+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,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(ar.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,ar)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=G(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Metric was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=Ft((()=>{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 g((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 Jt(e,t,r)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Qt(r)},scopeMetrics:[{scope:{name:i,version:s},metrics:t}]}]};var t,r,i,s}_buildMetrics(e){var t=lr(Date.now()),r=new Map;for(var i of e.values()){var s,n=ur(i.type,i.name,i.unit,void 0),o=r.get(n);o||(o=_({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(n,o));var a=Qt(null!==(s=i.attributes)&&void 0!==s?s:{},this._logger),l=lr(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:ar})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var s=i[0],n=i[1],o=this._series.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=n.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function dr(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var hr,pr,gr;function _r(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return gr&&r.length===pr||(pr=r.length,gr=r.reduce(((r,i)=>{hr||(hr={});var s=hr[i];if(s)r[s[0]]=s[1];else for(var n=e(i),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,hr[i]=[l,u];break}}return r}),{})),gr}}class vr{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),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}modifyFrames(e){var t=this;return g((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)),_({},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 g((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,s,n={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!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:_r(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 s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return _({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}var fr="?";function mr(e,t,r,i,s){var n={platform:e,filename:t,function:"<anonymous>"===r?fr:r,in_app:!(null!=t&&t.startsWith("webkit-masked-url://"))&&"<anonymous>"!==t};return Y(i)||(n.lineno=i),Y(s)||(n.colno=s),n}var yr=(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]:fr,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},br=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Sr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wr=/\((\S*)(?::(\d+))(?::(\d+))\)/,kr=(e,t)=>{var r=br.exec(e);if(r)return mr(t,r[1],fr,+r[2],+r[3]);var i=Sr.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var s=wr.exec(i[2]);s&&(i[2]=s[1],i[3]=s[2],i[4]=s[3])}var n=yr(i[1]||fr,i[2]);return mr(t,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Cr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Er=(e,t)=>{var r=Cr.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=xr.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var s=r[3],n=r[1]||fr,o=yr(n,s);return mr(t,s=o[1],n=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},Ir=/\(error: (.*)\)/,Tr=50;class Mr{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 Pr{match(e){return ce(e)}coerce(e,t){var r,i=this.getStack(e),s=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:s}}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 Rr{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 _({},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,s=null!==(t=i.lineno)&&void 0!==t?t:0,n=null!==(r=i.colno)&&void 0!==r?r:0;if(J(i.filename)&&0!==i.filename.length&&0!==s)return"Error\n at "+i.filename+":"+s+":"+n}}var Fr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Lr{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),s=i[0],n=i[1];return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Fr);return i&&(t=i[1],r=i[2]),[t,r]}}var Ar=["fatal","error","warning","log","info","debug"];function Or(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 s=r.slice(0,i).join(", ");if(t>=s.length)return i===r.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class Dr{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{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: "+Or(e)}isSeverityLevel(e){return J(e)&&!X(e)&&Ar.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 Nr{match(e){return de(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Or(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Br{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 qr{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 Hr="$message",$r="$timestamp",Wr=new Set([Hr,$r]),Ur={enabled:!0,max_bytes:32768};function zr(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ur.enabled,max_bytes:jr(e.max_bytes,Ur.max_bytes)}:_({},Ur)}class Vr{constructor(e){this._entries=[],this._totalBytes=0,this._config=zr(e)}setConfig(e){this._config=zr(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=U(e)}catch(e){return}try{var r=JSON.parse(t);if(!K(r))return;var i=r,s=i[Hr],n=i[$r];if(!J(s)||0===s.trim().length)return;if(!J(n)&&!re(n))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 jr(e,t){if(!re(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var Gr={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"},Qr=function(t,r){var i=(void 0===r?{}:r).debugEnabled,s={_log(r){if(e&&(Gr.DEBUG||e.POSTHOG_DEBUG||i)&&!Y(e.console)&&e.console){for(var s=("__rrweb_original__"in e.console[r]?e.console[r].__rrweb_original__:e.console[r]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(t,...o)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._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){s.error("You must initialize PostHog before calling "+e)},createLogger:(e,r)=>Qr(t+" "+e,r)};return s},Kr=Qr("[PostHog.js]"),Zr=Kr.createLogger;function Yr(e,t){G(e)&&e.forEach(t)}function Jr(e,t){if(!te(e))if(G(e))e.forEach(t);else if(ne(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)V.call(e,r)&&t(e[r],r)}var Xr=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 s of r)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function ei(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 ti=function(e){try{return e()}catch(e){return}},ri=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){Kr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Kr.critical(e)}}},ii=function(e){var t={};return Jr(e,(function(e,r){(J(e)&&e.length>0||re(e))&&(t[r]=e)})),t};var si=["herokuapp.com","vercel.app","netlify.app"];function ni(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 si)if(r===i)return!1;return!0}function oi(e,t,r,i){var s=null!=i?i:{},n=s.capture,o=s.passive;null==e||e.addEventListener(t,r,{capture:void 0!==n&&n,passive:void 0===o||o})}function ai(e){return"ph_toolbar_internal"===e.name}var li=["localhost","127.0.0.1"],ui=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return U(e)}},ci=e=>{var t=null==i?void 0:i.createElement("a");return Y(t)?null:(t.href=e,t)},di=function(e,t){var r,i;void 0===t&&(t="&");var s=[];return Jr(e,(function(e,t){Y(e)||Y(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+r)})),s.join(t)},hi=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var n=i[s].split("=");if(n[0]===t){r=n;break}}if(!G(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){Kr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},pi=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[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!=s&&(h+="#"+s),h},gi=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},_i=(e,t)=>e>=t&&c(),vi=(e,t,r,i)=>{if(0===e){if(c()){var s=t+1;return s===r&&i(),s}return t}return 0};function fi(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Q(i))return t;try{var s=i(t);return J(s)&&s?s:t}catch(e){return Kr.error("Error in get_current_url, falling back to window.location.href",e),t}}function mi(t){var r,i=null==e||null==(r=e.location)?void 0:r.href;return Y(i)?void 0:fi(t,i)}var yi="__POSTHOG_TOOLBAR__",bi=1,Si=3,wi=11;function ki(e){return e instanceof Element&&(e.id===yi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ci(e){return!!e&&e.nodeType===bi}function xi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ei(e){return!!e&&e.nodeType===Si}function Ii(e){return!!e&&e.nodeType===wi&&Ci(e.host)}var Ti=1e3;function Mi(e){return e?H(e).split(/\s+/):[]}function Pi(e,t){var r=mi(t);return!!(r&&e&&e.some((e=>r.match(e))))}function Ri(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 Mi(t)}function Fi(e){return te(e)?null:H(e).split(/(\s+)/).filter((e=>is(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Li(e){var t="";return Qi(e)&&!Ki(e)&&e.childNodes&&e.childNodes.length&&Jr(e.childNodes,(function(e){var r;Ei(e)&&e.textContent&&(t+=null!==(r=Fi(e.textContent))&&void 0!==r?r:"")})),H(t)}function Ai(e){var t;return Y(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Oi=["a","button","form","input","select","textarea","label"];function Di(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 s of e)if(r=i(s))return r.v;return!1}function Ni(e){var t=e.parentNode;return!(!t||!Ci(t))&&t}var Bi=[".ph-no-autocapture","[data-ph-no-autocapture]"],qi=["next","previous","prev",">","<"],Hi=[...qi,"+","-","−","–"],$i=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Wi=[".ph-no-deadclick",".ph-no-capture"],Ui=[".ph-no-rageclick",".ph-no-capture"],zi=["","text","search","email","password","url","tel","number"];function Vi(t,r){if(!e||ji(t))return!1;var i,s,n,o,a;if(se(r)?(i=!!r&&Ui,s=void 0,n=!1):(i=null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:Ui,s=null==r?void 0:r.content_ignorelist,n=null!==(a=null==r?void 0:r.ignore_text_selection)&&void 0!==a&&a),!1===i)return!1;if(n&&function(e){return!(!e||!Ci(e))&&(!!xi(e,"textarea")||(xi(e,"input")?q(zi,(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=Gi(t,!1).targetElementList;return!function(e,t){if(!1===e||Y(e))return!1;var r;if(!0===e)r=qi;else{if(!G(e))return!1;if(e.length>10)return Kr.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=>$i(t,e)||$i(i,e)))}))}(s,l.map((e=>{var t;return{safeText:Li(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Di(l,i)}var ji=e=>!e||xi(e,"html")||!Ci(e),Gi=(t,r)=>{if(!e||ji(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[t],n=t;n.parentNode&&!xi(n,"body");)if(Ii(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Ni(n);if(!o)break;if(r||Oi.indexOf(o.tagName.toLowerCase())>-1)i=!0;else try{var a=e.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:s}};function Qi(e){for(var t=new Set,r=0,i=e;i.parentNode&&!xi(i,"body");i=i.parentNode){if(r++>=Ti||t.has(i))return!1;t.add(i);var s=Ri(i);if(q(s,"ph-sensitive")||q(s,"ph-no-capture"))return!1}if(q(Ri(e),"ph-include"))return!0;var n=e.type||"";if(J(n))switch(n.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 Ki(e){return!!(xi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xi(e,"select")||xi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Zi=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}))$"),Yi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ji=[16,15,14,13],Xi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),es=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ts=/[0-9A-Za-z_]/;function rs(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var s=e.charCodeAt(i)-48;r&&(s*=2)>9&&(s-=9),t+=s,r=!r}return t%10==0}function is(e,t){if(void 0===t&&(t=!0),te(e))return!1;if(J(e)){e=H(e);var r=t?Zi.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Yi.lastIndex=0;t=Yi.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),s=0;i.length>s;s++)for(var n of Ji){var o=s+n;if(i.length>=o){var a=i.slice(s,o);if(Zi.test(a)&&rs(a))return!0}}}return!1}(e);if(r)return!1;var i=t?Xi.test(e):function(e){var t;for(es.lastIndex=0;t=es.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&ts.test(r)&&ts.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function ss(e){var t=Li(e);return is(t=(t+" "+ns(e)).trim())?t:""}function ns(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Jr(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=Li(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ns(e)).trim())}catch(e){Kr.error("[AutoCapture]",e)}})),t}function os(e){return e.replace(/"|\\"/g,'\\"')}function as(e){var t=e.attr__class;if(t)return G(t)?t:Mi(t)}var ls="[SessionRecording]",us="redacted",cs=1e6;function ds(e){var t;return Math.min(cs,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:cs)}var hs={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:cs,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},ps=["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"],gs=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],_s=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],vs=e=>{te(e)||Jr(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return ps.includes(t)||_s.some((e=>t.includes(e)))})(t)&&(e[t]=us)}))},fs=["/s/","/e/","/i/"];function ms(e,t,r,i){if(te(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return J(s)&&(s=parseInt(s)),s>r?ls+" "+i+" body too large to record ("+s+" bytes)":e}function ys(e,t){if(te(e))return e;var r=e;return is(r,!1)||(r=ls+" "+t+" body "+us),Jr(gs,(e=>{var i,s;null!=(i=r)&&i.length&&-1!==(null==(s=r)?void 0:s.indexOf(e))&&(r=ls+" "+t+" body "+us+" as might contain: "+e)})),r}var bs=new WeakSet,Ss="$people_distinct_id",ws="distinct_id",ks="$device_id",Cs="$device_model",xs="__alias",Es="__timers",Is="$autocapture_disabled_server_side",Ts="$heatmaps_enabled_server_side",Ms="$exception_capture_enabled_server_side",Ps="$error_tracking_suppression_rules",Rs="$error_tracking_capture_extension_exceptions",Fs="$web_vitals_enabled_server_side",Ls="$dead_clicks_enabled_server_side",As="$product_tours_enabled_server_side",Os="$logs_capture_enabled_server_side",Ds="$web_vitals_allowed_metrics",Ns="$session_recording_remote_config",Bs="$replay_sample_rate",qs="$replay_override_sampling",Hs="$replay_override_linked_flag",$s="$replay_override_url_trigger",Ws="$replay_override_event_trigger",Us="$sesid",zs="$session_is_sampled",Vs="$session_past_minimum_duration",js="$session_recording_url_trigger_activated_session",Gs="$session_recording_event_trigger_activated_session",Qs="$posthog_sr_group_event_trigger_",Ks="$posthog_sr_group_url_trigger_",Zs="$posthog_sr_group_sampling_",Ys="$debug_first_full_snapshot_timestamp",Js="$sess_rec_flush_size",Xs="$enabled_feature_flags",en="$active_feature_flags",tn="$early_access_features",rn="$feature_flag_details",sn="$feature_flag_payloads",nn="$feature_flag_request_id",on="$minimal_flag_called_events",an="$override_feature_flags",ln="$override_feature_flag_payloads",un="$stored_person_properties",cn="$stored_group_properties",dn="$groups",hn="$surveys",pn="$surveys_loaded_at",gn="$surveys_activated",_n="$surveys_activated_session",vn="$surveys_activated_timestamps",fn="ph_product_tours",mn="$flag_call_reported",yn="$flag_call_reported_session_id",bn="$feature_flag_errors",Sn="$feature_flag_evaluated_at",wn="$user_state",kn="$client_session_props",Cn="$capture_rate_limit",xn="$initial_campaign_params",En="$initial_referrer_info",In="$initial_person_info",Tn="$epp",Mn="$posthog_cookieless",Pn="$cookieless_mode",Rn="$sdk_debug_extensions_init_method",Fn="$sdk_debug_extensions_init_time_ms",Ln="$sdk_debug_recording_script_not_loaded",An="$sdk_debug_replay_event_trigger_status",On="$sdk_debug_replay_linked_flag_trigger_status",Dn="$sdk_debug_replay_matched_recording_trigger_groups",Nn="$sdk_debug_replay_pending_trigger_conditions",Bn="$sdk_debug_replay_remote_trigger_matching_config",qn="$sdk_debug_replay_trigger_groups_count",Hn="$sdk_debug_replay_url_trigger_status",$n="$session_recording_start_reason",Wn="PostHog loadExternalDependency extension not found.",Un="on_reject",zn="always",Vn="anonymous",jn="identified",Gn="identified_only",Qn="visibilitychange",Kn="beforeunload",Zn="$pageview",Yn="$pageleave",Jn="$identify",Xn="$groupidentify",eo="disabled",to="sampled",ro="active",io="buffering",so="paused",no="lazy_loading",oo="awaiting_config",ao="missing_config",lo="rrweb_error",uo="trigger",co=uo+"_activated",ho=uo+"_pending",po=uo+"_"+eo;function go(e,t,r,i,s,n){return 0===t?po:(null==e?void 0:e.get_property(r?i+r:s))===n?co:ho}function _o(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 vo(e){return e.includes(co)?co:e.includes(ho)?ho:po}function fo(e){var t=new Set(e);switch(t.delete(po),t.size){case 0:return po;case 1:return Array.from(t)[0];default:return ho}}class mo{constructor(e){this._matchers=e}triggerStatus(e){return vo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return vo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class yo{constructor(e){this._matchers=e}triggerStatus(e){return fo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return fo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class bo{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return co}stop(){}}var So=e=>"sessionRecording"in e;class wo{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=(So(e)?K(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(So(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){Kr.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){Kr.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return go(this._instance,this._urlTriggers.length,this._groupId,Ks,js,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Hn]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=mi(this._instance);if(!e)return!1;try{return _o(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=mi(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,s=_o(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&s||(s&&!i?e():!s&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var s=mi(this._instance);if(s&&s!==this._lastCheckedUrl){this._lastCheckedUrl=s;var n=this.urlBlocked,o=_o(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!n?e():!o&&n&&t();var a=this._urlTriggerStatus(i)===co,l=_o(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",s)}}stop(){this._lastCheckedUrl=""}}class ko{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[On]:e}),e}triggerStatusNoSideEffects(){var e=ho;return te(this.linkedFlag)&&(e=po),this.linkedFlagSeen&&(e=co),e}onConfig(e,t){var r;if(this.linkedFlag=(So(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,s=J(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var n=!1;if(K(r)&&i in r){var o=r[i];n=se(o)?!0===o:s?o===s:!!o}var a=n&&!this.linkedFlagSeen;this.linkedFlagSeen=n,a&&t(i,s)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class Co{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(So(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 go(this._instance,this._eventTriggers.length,this._groupId,Qs,Gs,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[An]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===co,s=this._eventTriggers.includes(e);!i&&s&&t("event",e)}}stop(){}}class xo{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new wo(e,t.id),this._eventTriggerMatching=new Co(e,t.id),this._linkedFlagMatching=new ko(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)),s={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,r);var n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new mo(n):new yo(n)}else this._combinedMatching=new bo}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return this.triggerStatusNoSideEffects(e)!==ho?[]:[{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===ho)).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?Ks+this.group.id:Qs+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function Eo(e){if(e.rrwebError)return lo;if(!e.receivedFlags)return io;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return so;var t=!0===e.isSampled,r=new mo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?to:r===co?ro:r===ho?io:!1===e.isSampled?eo:ro}function Io(e){if(e.rrwebError)return lo;if(!e.receivedFlags)return io;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return so;var t=new yo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==po,i=se(e.isSampled);return r&&t===ho?io:r&&t===po||i&&!e.isSampled?eo:!0===e.isSampled?to:ro}function To(){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 Mo(e){var t=JSON.stringify(e,To());return t?new Blob([t]).size:0}function Po(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:Po(i)}return t}var s=e,n=2,o=!0;for(var a in s)if({}.hasOwnProperty.call(s,a)){var l=s[a];Y(l)||(o||(n+=1),o=!1,n+=a.length+3+Po(l))}return n;default:return 0}}function Ro(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),s=e.sizes.slice(r);return[Ro({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Ro({size:s.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var Fo=Uint8Array,Lo=Uint16Array,Ao=Uint32Array,Oo=new Fo([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]),Do=new Fo([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]),No=new Fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bo=function(e,t){for(var r=new Lo(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var s=new Ao(r[30]);for(i=1;30>i;++i)for(var n=r[i];r[i+1]>n;++n)s[n]=n-r[i]<<5|i;return[r,s]},qo=Bo(Oo,2),Ho=qo[1];qo[0][28]=258,Ho[258]=28;for(var $o=Bo(Do,0)[1],Wo=new Lo(32768),Uo=0;32768>Uo;++Uo){var zo=(43690&Uo)>>>1|(21845&Uo)<<1;Wo[Uo]=((65280&(zo=(61680&(zo=(52428&zo)>>>2|(13107&zo)<<2))>>>4|(3855&zo)<<4))>>>8|(255&zo)<<8)>>>1}var Vo=function(e,t,r){for(var i=e.length,s=0,n=new Lo(t);i>s;++s)++n[e[s]-1];var o,a=new Lo(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(r){o=new Lo(1<<t);var l=15-t;for(s=0;i>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[Wo[d]>>>l]=u}else for(o=new Lo(i),s=0;i>s;++s)o[s]=Wo[a[e[s]-1]++]>>>15-e[s];return o},jo=new Fo(288);for(Uo=0;144>Uo;++Uo)jo[Uo]=8;for(Uo=144;256>Uo;++Uo)jo[Uo]=9;for(Uo=256;280>Uo;++Uo)jo[Uo]=7;for(Uo=280;288>Uo;++Uo)jo[Uo]=8;var Go=new Fo(32);for(Uo=0;32>Uo;++Uo)Go[Uo]=5;var Qo=Vo(jo,9,0),Ko=Vo(Go,5,0),Zo=function(e){return(e/8>>0)+(7&e&&1)},Yo=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof Lo?Lo:e instanceof Ao?Ao:Fo)(r-t);return i.set(e.subarray(t,r)),i},Jo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Xo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},ea=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var s=r.length,n=r.slice();if(!s)return[new Fo(0),0];if(1==s){var o=new Fo(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!=s-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=n[0].s;for(i=1;s>i;++i)n[i].s>h&&(h=n[i].s);var p=new Lo(h+1),g=ta(r[c-1],p,0);if(g>t){i=0;var _=0,v=g-t,f=1<<v;for(n.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));s>i;++i){var m=n[i].s;if(t>=p[m])break;_+=f-(1<<g-p[m]),p[m]=t}for(_>>>=v;_>0;){var y=n[i].s;t>p[y]?_-=1<<t-p[y]++-1:++i}for(;i>=0&&_;--i){var b=n[i].s;p[b]==t&&(--p[b],++_)}g=t}return[new Fo(p),g]},ta=function(e,t,r){return-1==e.s?Math.max(ta(e.l,t,r+1),ta(e.r,t,r+1)):t[e.s]=r},ra=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Lo(++t),i=0,s=e[0],n=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[r.subarray(0,i),t]},ia=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},sa=function(e,t,r){var i=r.length,s=Zo(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;i>n;++n)e[s+n+4]=r[n];return 8*(s+4+i)},na=function(e,t,r,i,s,n,o,a,l,u,c){Jo(t,c++,r),++s[256];for(var d=ea(s,15),h=d[0],p=d[1],g=ea(n,15),_=g[0],v=g[1],f=ra(h),m=f[0],y=f[1],b=ra(_),S=b[0],w=b[1],k=new Lo(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=ea(k,7),E=x[0],I=x[1],T=19;T>4&&!E[No[T-1]];--T);var M,P,R,F,L=u+5<<3,A=ia(s,jo)+ia(n,Go)+o,O=ia(s,h)+ia(n,_)+o+14+3*T+ia(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return sa(t,c,e.subarray(l,l+u));if(Jo(t,c,1+(A>O)),c+=2,A>O){M=Vo(h,p,0),P=h,R=Vo(_,v,0),F=_;var D=Vo(E,I,0);for(Jo(t,c,y-257),Jo(t,c+5,w-1),Jo(t,c+10,T-4),c+=14,C=0;T>C;++C)Jo(t,c+3*C,E[No[C]]);c+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Jo(t,c,D[H=31&q[C]]),c+=E[H],H>15&&(Jo(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}else M=Qo,P=jo,R=Ko,F=Go;for(C=0;a>C;++C)if(i[C]>255){var H;Xo(t,c,M[257+(H=i[C]>>>18&31)]),c+=P[H+257],H>7&&(Jo(t,c,i[C]>>>23&31),c+=Oo[H]);var W=31&i[C];Xo(t,c,R[W]),c+=F[W],W>3&&(Xo(t,c,i[C]>>>5&8191),c+=Do[W])}else Xo(t,c,M[i[C]]),c+=P[i[C]];return Xo(t,c,M[256]),c+P[256]},oa=new Ao([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aa=function(){for(var e=new Ao(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),la=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=aa[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},ua=function(e,t,r,i,s){return function(e,t,r,i,s,n){var o=e.length,a=new Fo(i+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(i,a.length-s),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=sa(l,u,e.subarray(c,d)):(l[c]=true,u=sa(l,u,e.subarray(c,o)))}else{for(var h=oa[t-1],p=h>>>13,g=8191&h,_=(1<<r)-1,v=new Lo(32768),f=new Lo(_+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&_},S=new Ao(25e3),w=new Lo(288),k=new Lo(32),C=0,x=0,E=(c=0,0),I=0,T=0;o>c;++c){var M=b(c),P=32767&c,R=f[M];if(v[P]=R,f[M]=P,c>=I){var F=o-c;if((C>7e3||E>24576)&&F>423){u=na(e,l,0,S,w,k,x,E,T,c-T,u),E=C=x=0,T=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=g,N=P-R&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&&P!=R;){if(e[c+A]==e[c+A-N]){for(var W=0;H>W&&e[c+W]==e[c+W-N];++W);if(W>A){if(A=W,O=N,W>B)break;var U=Math.min(N,W-2),z=0;for(L=0;U>L;++L){var V=c-N+L+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,R=V)}}}N+=(P=R)-(R=v[P])+32768&32767}if(O){S[E++]=268435456|Ho[A]<<18|$o[O];var G=31&Ho[A],Q=31&$o[O];x+=Oo[G]+Do[Q],++w[257+G],++k[Q],I=c+A,++C}else S[E++]=e[c],++w[e[c]]}}u=na(e,l,true,S,w,k,x,E,T,c-T,u)}return Yo(a,0,i+Zo(u)+s)}(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)},ca=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},da=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&&ca(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)}},ha=function(e){return 10+(e.filename&&e.filename.length+1||0)};function pa(e,t){void 0===t&&(t={});var r=la(),i=e.length;r.p(e);var s=ua(e,t,ha(t),8),n=s.length;return da(s,t),ca(s,n-8,r.d()),ca(s,n-4,i),s}function ga(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Fo(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},o=0;r>o;++o){if(s+5>i.length){var a=new Fo(s+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Yo(i,0,s)}function _a(e,t){for(var r="",i=0;e.length>i;){var s=e[i++];r+=String.fromCharCode(s)}return r}class va{constructor(e,t){var r,i,s,n;void 0===t&&(t={}),this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{var e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},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,s,n,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(s=e.attributes)?void 0:s.length)&&void 0!==i?i:0)+(null!==(n=null==(o=e.texts)?void 0:o.length)&&void 0!==n?n: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 s,n,o=i-t.attributes.length;o>0&&(null==(s=(n=this._options).onDroppedAttributeMutations)||s.call(n,o))}var a=this._numberOfChanges(t);if(0!==a||r===a){if(this._byteBudgetDisabled)return e;this._refillByteBudget();var l,u,c=Po(e);return c>this._byteTokens?(null==(l=(u=this._options).onDroppedOversizedMutation)||l.call(u,c),void this._scheduleResync()):(this._byteTokens-=c,e)}},this._scheduleResync=()=>{if(!this._resyncTimer){var e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout((()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null==(e=(t=this._options).requestFullSnapshot)||e.call(t)}),e)}},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:Kr}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(n=this._options.bytesRefillRate)&&void 0!==n?n:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;var o=this._options.resyncIntervalMs;this._resyncIntervalMs=re(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}}Gr.DEBUG=!1,Gr.LIB_VERSION="1.424.0",Gr.LIB_NAME="web";class fa{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(Js,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Js);return K(t=r)&&J(t.sessionId)&&re(t.size)&&r.sessionId===e?r.size:0}}function ma(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<ve(100*t,0,100,Kr)}function ya(e){return"$survey_response_"+e}function ba(e,t){if(!t)return null;var r=e[ya(t)];return G(r)?[...r]:r}function Sa(e,t,r){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!Y(t.originalQuestionIndex)){var r,s=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,n=ba(e,t.id);Y(n)||(i[s]=n)}})),_({$survey_questions:t.questions.map((t=>{var i,s;return{id:t.id,question:null!==(i=null==r?void 0:r[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==i?i:t.question,response:ba(e,t.id)}}))},e,i)}function wa(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 ka(e){return"string"==typeof e&&e.trim()?e.trim():null}function Ca(e){return e.toLowerCase()}function xa(e,t,r){if(!e||!t)return null;var i=Ca(t),s=Object.keys(e).find((e=>Ca(e)===i));if(s)return null==r||r.debug("Found exact translation match: "+s),s;if(i.includes("-")){var n=i.split("-")[0],o=Object.keys(e).find((e=>Ca(e)===n));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var Ea=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ia(e,t,r){var i,s=xa(e.translations,t,r),n=_({},e),o=!1;if(s){var a,l=null==(a=e.translations)?void 0:a[s];if(l)if(null==r||r.info("Applying survey-level translation for language: "+s),Y(l.name)||(n.name=l.name,o=!0),n.appearance){var u=_({},n.appearance);for(var c of Ea){var d=l[c];Y(d)||(u[c]=d,o=!0)}n.appearance=u}else(function(e){return Ea.some((t=>!Y(e[t])))})(l)&&(o=!0)}var h=e.questions.map((e=>function(e,t,r){var i,s=xa(e.translations,t,r);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var n=null==(i=e.translations)?void 0:i[s];if(!n)return{question:e,matchedKey:null,hasChanges:!1};var o=_({},e),a=!1;return Y(n.question)||(o.question=n.question,a=!0),Y(n.description)||(o.description=n.description,a=!0),Y(n.buttonText)||(o.buttonText=n.buttonText,a=!0),"link"in o&&!Y(n.link)&&(o.link=n.link,a=!0),"lowerBoundLabel"in o&&!Y(n.lowerBoundLabel)&&(o.lowerBoundLabel=n.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Y(n.upperBoundLabel)&&(o.upperBoundLabel=n.upperBoundLabel,a=!0),"choices"in o&&function(e){return G(e.choices)}(n)&&(o.choices=n.choices,a=!0),{question:a?o:e,matchedKey:a?s:null,hasChanges:a}}(e,t,r))),p=h.map((e=>e.question)),g=h.some((e=>e.hasChanges)),v=null;return s||(v=(null==(i=h.find((e=>e.matchedKey)))?void 0:i.matchedKey)||null),g&&(n.questions=p,o=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:n,matchedKey:o?s||v:null}}function Ta(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function Ma(e){var t;return Ta(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var Pa=(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}},Ra=e=>e.toLowerCase(),Fa={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=>Pa(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Pa(t,e))))),icontains:(e,t)=>t.map(Ra).some((t=>e.map(Ra).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Ra).every((t=>e.map(Ra).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 La(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 s=Fa[r.operator];return!!s&&s(r.values,[String(i)])}))}function Aa(e,t,r){return ui({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var Oa=new Set(["is_not","not_icontains","not_regex"]);function Da(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,s=null==i?void 0:i[e.key],n=e.operator||"exact";if(Y(s)||ee(s))return Oa.has(n);var o=Fa[n];return!!o&&!Y(e.value)&&!ee(e.value)&&o(G(e.value)?e.value.map(String):[String(e.value)],G(s)?s.map(String):[String(s)])}))}var Na=Zr("[SessionRecording]");function Ba(e,t){return t?e:"!"+e}function qa(e,t){return e===t||e!=="!"+t&&null}class Ha{constructor(e,t,r,i,s,n,o){this._sampleRate=null,this._recordingStatusFunction=Io,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=s,this._tryTakeFullSnapshot=n,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=re(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new mo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Eo):(this._triggerStatusMatcher=new yo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Io),this._instance.register_for_session({[Bn]: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){Na.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,s=this._sampleRate;if(!re(s))return null==(r=this._instance.persistence)||r.unregister(zs),void(null==(i=this._instance.persistence)||i.unregister(Bs));var n=this._instance.get_property(zs),o=this._instance.get_property(Bs),a=qa(n,e),l=re(o)&&o!==s,u=Y(o)&&n===e,c=l||u||!se(a),d=c?ma(e,s):a;c&&(d?this._reportStarted("sampled"):Na.warn("Sample rate ("+s+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[zs]:Ba(e,d),[Bs]:ee(o)&&n===e?null:s})}ensureSamplingDecision(e){if(re(this._sampleRate)){var t=this._instance.get_property(zs);se(qa(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,s;null==(e=this._instance.persistence)||e.unregister(Gs),null==(t=this._instance.persistence)||t.unregister(js),null==(r=this._instance.persistence)||r.unregister(zs),null==(i=this._instance.persistence)||i.unregister(Bs),null==(s=this._instance.persistence)||s.unregister(Vs)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===ho}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===ho)).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 $a{constructor(e,t,r,i,s){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=s}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Bn]:"v2_trigger_groups",[qn]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):Na.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return lo;if(e.urlTriggerMatching.urlBlocked)return so;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return eo;var i=!1,s=!1;for(var n of t){var o=n.triggerStatus(e.sessionId);if(o===co){var a=n.group.id,l=r.get(a);Y(l)?Kr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(s=!0)}else o===ho&&(i=!0)}return s?to:i?io:eo}({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 s=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var n=function(i){i.checkUrlTriggerConditions(t,r,(t=>{s._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),s.updateActiveTriggers(e),s._onTriggerActivated(t))}),e)};for(var o of this._triggerGroupMatchers)n(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return Na.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var s=function(r){r.checkEventTriggerConditions(e.event,(s=>{if(i._checkGroupLevelProperties(r,e.properties)){var n=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(un),a=n.some((t=>!t.properties||0===t.properties.length||Da(t.properties,e.properties,o)));a&&(r.activateTrigger(s,t),i.updateActiveTriggers(t),i._onTriggerActivated(s))}}),t)};for(var n of this._triggerGroupMatchers)s(n)}catch(e){Na.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,s=i.id,n=i.sampleRate,o=Zs+s,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(K(a)){var h=a.sessionId,p=a.sampleRate,g=a.sampled;u="string"==typeof h&&h!==e,c=re(p)&&p!==n,l=h===e&&re(p)&&p===n&&se(g)?g:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var _=u||c||d||!se(l),v=_?ma(e+s,n):l;_&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:i.name,sampleRate:n,isSampled:v}),this._triggerGroupSamplingResults.set(s,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:n,sampled:v}})}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(zs),null==(t=this._instance.persistence)||t.unregister(Bs),null==(r=this._instance.persistence)||r.unregister(Vs),this._triggerGroupMatchers)){var s,n,o,a=i.group.id;null==(s=this._instance.persistence)||s.unregister(Qs+a),null==(n=this._instance.persistence)||n.unregister(Ks+a),null==(o=this._instance.persistence)||o.unregister(Zs+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,s=i.id,n="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);n&&t.push({id:s,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Dn]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===ho)return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap((t=>t.triggerStatusNoSideEffects(e)!==ho?[]: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||Da(r,t,this._instance.get_property(un))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new xo(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 Wa=e=>{if(i){try{for(var t=e+"=",r=i.cookie.split(";").filter((e=>e.length)),s=0;r.length>s;s++){for(var n=r[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},Ua="https?://(.*)",za=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Va=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...za],ja="<masked>",Ga=["li_fat_id"];function Qa(e,t,r){if(!i)return{};var s,n=t?[...za,...r||[]]:[],o=Ka(pi(i.URL,n,ja),e),a=(s={},Jr(Ga,(function(e){var t=Wa(e);s[e]=t||null})),s);return Xr(a,o)}function Ka(e,t){var r=Va.concat(t||[]),i={};return Jr(r,(function(t){var r=hi(e,t);i[t]=r||null})),i}function Za(e){var t=function(e){return e?0===e.search(Ua+"google.([^/?]*)")?"google":0===e.search(Ua+"bing.com")?"bing":0===e.search(Ua+"yahoo.com")?"yahoo":0===e.search(Ua+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",s={};if(!ee(t)){s.$search_engine=t;var n=i?hi(i.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function Ya(){return navigator.language||navigator.userLanguage}var Ja="$direct";function Xa(){return(null==i?void 0:i.referrer)||Ja}function el(e,t,r){void 0===r&&(r=!1);var i=e?[...za,...t||[]]:[],n=r?Rt(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:Xa().substring(0,1e3),u:o?pi(o,i,ja):void 0}}function tl(e,t){var r;void 0===t&&(t=!1);var i=e.r,s=e.u,n=t?Rt(s):s,o={$referrer:i,$referring_domain:null==i?void 0:i==Ja?Ja:null==(r=ci(i))?void 0:r.host};if(n){o.$current_url=n;var a=ci(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Ka(n);Xr(o,l)}if(i){var u=Za(i);Xr(o,u)}return o}function rl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function il(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var sl=1e5,nl="https://schema.org",ol=[],al="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(" "),ll="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ul="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(" "),cl="Accommodation AdministrativeArea Country Place State".split(" "),dl={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:ll,publisher:ul},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:ol},Offer:{seller:ul},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:ul,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ul,areaServed:cl,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:ol}},hl={},pl=[[ll,hl],["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(" "),dl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),dl.Event],[ul,dl.Organization],[cl,dl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),dl.Product],["AggregateRating EmployerAggregateRating Rating".split(" "),hl]],gl="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 _l(e,t){return V.call(e,t)?e[t]:void 0}function vl(e){var t=typeof e;return ee(e)||"string"===t||"number"===t||"boolean"===t}function fl(e){return vl(e)||G(e)&&e.every(vl)?e:void 0}function ml(e){if(V.call(dl,e))return dl[e];for(var t of pl){var r=t[1];if(t[0].includes(e))return r}return gl.includes(e)?hl:void 0}function yl(e,t){if(!K(e))return null;var r=_l(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=>!!ml(e)))}(r).filter((e=>!t||!t.length||t.includes(e)));if(!i.length)return null;var s={"@type":"string"==typeof r?i[0]:i},n=fl(_l(e,"@id"));for(var o of(Y(n)||(s["@id"]=n),al)){var a=fl(_l(e,o));Y(a)||(s[o]=a)}for(var l of i){var u=ml(l),c=function(){var t=_l(e,d),r=u[d];if(!0===r){var i=fl(t);Y(i)||(s[d]=i)}else if(G(t)){var n=t.map((e=>yl(e,r))).filter(K);n.length&&(s[d]=n)}else{var o=yl(t,r);o&&(s[d]=o)}};for(var d of Object.keys(u))c()}return s}function bl(e){if(!K(e))return null;var t=_l(e,"@context");if("string"!=typeof t||!/^https?:\/\/schema\.org\/?$/.test(t))return null;var r=yl(e);if(r)return _({"@context":nl},r);var i=_l(e,"@graph");if(!G(i))return null;var s=i.map((e=>yl(e))).filter(K);return s.length?{"@context":nl,"@graph":s}:null}function Sl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function wl(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 kl(e){return Sl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Sl)}function Cl(e){return Y(e)?void 0:Math.round(e)}function xl(e){return K(e)?e.network_timing:e}var El,Il,Tl=36e5,Ml=943718.4,Pl="[SessionRecording]",Rl=Zr(Pl),Fl=[m.MouseMove,m.MouseInteraction,m.Scroll,m.ViewportResize,m.Input,m.TouchMove,m.MediaInteraction,m.Drag],Ll=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Al(){var e;return null==h||null==(e=h.__PosthogExtensions__)?void 0:e.rrweb}function Ol(){var e;return null==(e=Al())?void 0:e.record}function Dl(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,To())}}function Nl(e){return _a(pa(ga(Dl(e))))}function Bl(e){return ql.apply(this,arguments)}function ql(){return(ql=g((function*(e){var t=Dl(e),r=yield Ut(t,Gr.DEBUG,{rethrow:!0});return _a(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Hl="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,$l=!1;function Wl(e){return G(e)&&0===e.length?El=null!=El?El:Nl([]):Nl(e)}function Ul(e){return zl.apply(this,arguments)}function zl(){return(zl=g((function*(e){return G(e)&&0===e.length?El||(Il=null!=Il?Il:Bl([]).then((e=>(El=e,e))).catch((e=>{throw El=void 0,Il=void 0,e}))):Bl(e)}))).apply(this,arguments)}function Vl(e){return Hl&&!$l&&function(e){return e.type===f.FullSnapshot||e.type===f.IncrementalSnapshot&&(e.data.source===m.Mutation||e.data.source===m.StyleSheetRule)}(e)}function jl(e){return{event:e,size:Po(e)}}function Gl(e,t){return _({},e,{data:t,cv:"2024-10"})}function Ql(e,t){return _({},e,{cv:"2024-10",data:_({},e.data,t)})}function Kl(e){try{if(e.type===f.FullSnapshot)return jl(Gl(e,Nl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation)return jl(Ql(e,{texts:Wl(e.data.texts),attributes:Wl(e.data.attributes),removes:Wl(e.data.removes),adds:Wl(e.data.adds)}));if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule)return jl(Ql(e,{adds:e.data.adds?Nl(e.data.adds):void 0,removes:e.data.removes?Nl(e.data.removes):void 0}))}catch(e){Rl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:Mo(e)}}function Zl(){return Zl=g((function*(e){try{if(e.type===f.FullSnapshot)return jl(Gl(e,yield Bl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation){var t=yield Promise.all([Ul(e.data.texts),Ul(e.data.attributes),Ul(e.data.removes),Ul(e.data.adds)]);return jl(Ql(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?Bl(e.data.adds):void 0,e.data.removes?Bl(e.data.removes):void 0]);return jl(Ql(e,{adds:r[0],removes:r[1]}))}}catch(t){return Ht(t)&&($l=!0),Rl.error("could not compress event asynchronously - trying synchronous compression",t),Kl(e)}return{event:e,size:Mo(e)}})),Zl.apply(this,arguments)}function Yl(e,t){return e.type===f.Custom&&e.data.tag===t}function Jl(e){return Yl(e,"sessionIdle")}function Xl(e){return Yl(e,"$session_ending")}function eu(e){return Yl(e,"$session_starting")}class tu{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(Pl+" 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 qa(this._instance.get_property(zs),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._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=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,s,n;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(Ys),this._maxDepthExceeded=!1,null==(s=Al())||null==s.resetMaxDepthState||s.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==(n=this._strategy)||n.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Vs])===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 s,n=this._getBufferDuration();return!!ee(n)||r>n||(null==(s=this._instance.persistence)||s.register({[Vs]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==io?(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(),s=r.windowId;this._sessionId=r.sessionId,this._windowId=s,this._linkedFlagMatching=new ko(this._instance),this._urlTriggerMatching=new wo(this._instance),this._eventTriggerMatching=new Co(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||Rl.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 fa(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,s,n,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==(s=this._instance.config.session_recording)?void 0:s.maskAllElementAttributes},d=null!==(n=null==c?void 0:c.maskAllInputs)&&void 0!==n?n: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,g=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(g)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:g}}_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],s=t[e];return!Y(i)&&i!==s}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,Rl.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 ve(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,Zr("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,s,n,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!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(n=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==n?n:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:ve(c,0,12,Zr("canvas recording fps"),4),quality:ve(d,0,1,Zr("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,s={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},n=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),a=xl(this._instance.config.capture_performance),l=xl(null==i?void 0:i.capturePerformance),u=!!(se(a)?a:l);return n||o||u?{recordHeaders:n,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 n=null==(t=h.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Q(n))if(!li.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){var o=Q(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(n(((e,t,r)=>{var i,s={payloadSizeLimitBytes:hs.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...hs.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...hs.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=ds(s),e=>(null!=e&&e.requestBody&&(e.requestBody=ms(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=ms(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t,r)=>{var i;if(null==r||!r(e.name)){var s=ci(e.name),n=0===t.indexOf("http")?null==(i=ci(t))?void 0:i.pathname:t;"/"===n&&(n="");var o=null==s?void 0:s.pathname.replace(n||"","");if(!(s&&o&&fs.some((e=>0===o.indexOf(e)))))return e}})((vs((i=t).requestHeaders),vs(i.responseHeaders),i),e.api_host,r));var i},c=Q(e.session_recording.maskNetworkRequestFn);return c&&Q(e.session_recording.maskCapturedNetworkRequestFn)&&Kr.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:_({},t,{name:null==r?void 0:r.url})}),s.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,s=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return te(s)&&i?(bs.add(i),i):null!=s?s:void 0}}:e=>function(e){if(!Y(e))return e.requestBody=ys(e.requestBody,"Request"),e.responseBody=ys(e.responseBody,"Response"),e}(u(e)),_({},hs,s,{recordHeaders:n,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else Rl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Rt(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Rt(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...za,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(pi(r,i,ja))}_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 s=t.maskNetworkRequestFn({url:e});return null==s?void 0:s.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}):Rl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Ll((()=>Ol().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=Ol();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(Ll((()=>Ol().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,s=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return re(s)&&Number.isFinite(s)&&s>=1e3&&36e5>=s?s: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),Rl.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"}),Rl.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,s;null==(i=this._instance.persistence)||i.register({["url"===e?js:Gs]:this.sessionId}),null==(s=this._strategy)||s.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(Ns);if(e){var t;try{t=K(e)?e:JSON.parse(e)}catch(e){return void Rl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,s=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-s>Tl)return Rl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(Ns))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(t){var r,s,n=this._remoteConfig;if(n){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(Ys),null!=n&&n.endpoint&&(this._endpoint=null==n?void 0:n.endpoint),this._strategy=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new $a(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Ha(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(n),null==(s=this._removeEventTriggerCaptureHook)||s.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(qs,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(qs)})),this._checkOverride(Hs,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Hs)})),this._checkOverride(Ws,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ws)})),this._checkOverride($s,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister($s)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(oi(e,"beforeunload",this._onBeforeUnload),oi(e,"pagehide",this._onPageHide),oi(e,"offline",this._onOffline),oi(e,"online",this._onOnline),oi(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)||Rl.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){Rl.error("Could not add $pageview to rrweb session",e)}}))),this.status===ro&&this._reportStarted(t||"recording_initialized"))}else Rl.info("remote config must be stored in persistence before recording can start")}_teardown(){var t,r,s,n,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==(s=this._onSessionIdListener)||s.call(this),this._onSessionIdListener=void 0,null==(n=this._onSessionIdleResetForcedListener)||n.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(),Rl.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),Rl.info("stopped")})),!0}stop(){this._stopRecordingProducers(),this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),Rl.info("stopped"))}_restartForSessionIdChange(e){var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null==(t=Al())||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(e){var t=(void 0===e?{}:e).discardProducerEvents;void 0!==t&&t&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),Rl.info("discarded")}_captureProcessedEvent(e,t,r,i,s){var n={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:s};this.status!==eo?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(n)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Rl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=Al())||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||Rl.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,Rl.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?Kl(e.event):{event:e.event,size:Mo(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 s=this,n={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(n),this._queuedCompressionEvents+=1;var o=function(){var r=g((function*(){try{if(n.processed)return;var r,i;try{var o=t?Vl(e)?yield function(e){return Zl.apply(this,arguments)}(e):Kl(e):{event:e,size:Mo(e)};r=o.event,i=o.size}catch(t){Rl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=Mo(e)}s._captureQueuedCompressionEvent(n,r,i)}finally{s._finishQueuedCompressionEvent(n)}}));return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(o):o()}onRRwebEmit(e){var t,r,i,s,n,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=Al())&&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({[Ys]:e.timestamp},void 0));var g=e.type===f.FullSnapshot&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();var _=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(_){var v=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}(_),y=function(e){return Xl(e)?e.data.payload:null}(v),b=function(e){return eu(e)?e.data.payload:null}(v),S=function(e){return Jl(e)?e.data.payload:null}(v);y||b?null!=y&&y.lastActivityTimestamp&&(v.timestamp=y.lastActivityTimestamp):null!=S&&S.sessionId||this._updateWindowAndSessionIds(v),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!==(s=null!==(n=null==y?void 0:y.currentSessionId)&&void 0!==n?n:null==b?void 0:b.nextSessionId)&&void 0!==s?s: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 Jl(e)||Xl(e)||eu(e)}(v)){v.type===f.FullSnapshot&&(this._eventsDroppedWhileIdle=0),S&&(v.timestamp=S.lastActivityTimestamp+S.threshold);var C=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):C||this._scheduleJsonLdScan();var x=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(this._queuedCompressionEvents>0||x&&Vl(v))this._enqueueCompression(v,x,w,k);else{var E=x?Kl(v):{event:v,size:Mo(v)};this._captureProcessedEvent(v,E.event,E.size,w,k)}}else(function(e){return e.type===f.FullSnapshot||e.type===f.Meta||e.type===f.IncrementalSnapshot&&e.data.source!==m.CanvasMutation})(v)&&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}):eo}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({[zs]:this.sessionId,[Bs]: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&&!Xl(e)&&!eu(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!==io)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Nn]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Nn]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[Nn]:t}),Rl.info("buffering: "+r))}_flushBuffer(){var e;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>Ml?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===io||i===so||i===eo||r)return this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==t)return this._buffer;if(t.data.length>0){var s,n=this._currentMaskedHostname();Ro(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:Gr.LIB_NAME,$lib_version:Gr.LIB_VERSION,$snapshot_host:n})})),null==(s=this._strategy)||s.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,s=this._buffer.sessionId!==i;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>Ml){var n=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==n)return;s&&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>Ml)?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({[$n]:e}),Rl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",_({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Fl.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 s=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=s.windowId,o=s.sessionId,a=this._sessionId!==o,l=this._windowId!==n;if(this._windowId=n,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,s,n,o,a,l,u=this._sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp,c=null==(e=Al())||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:Cl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Cl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(s=this._slowestFullSnapshot)?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this._slowestFullSnapshot)?void 0:n.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:Cl(null==c?void 0:c.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Cl(null==c?void 0:c.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Cl(null==(a=Al())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=Al())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$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,s,n,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=_({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=_({},a.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(a.recordCanvas=!0,a.sampling=_({},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,Rl.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!==(s=this._masking.maskTextSelector)&&void 0!==s?s:void 0,a.blockSelector=null!==(n=this._masking.blockSelector)&&void 0!==n?n: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,Rl.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 g=Ol();if(g){this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new va(g,{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";Rl.info(r,{node:t}),this.log(Pl+" "+r,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log(Pl+" Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});var v=this._gatherRRWebPlugins();if(this._stopRrweb=g(_({emit:e=>{this.onRRwebEmit(e)},plugins:v,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Rl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},a)),!this._stopRrweb)return this._rrwebError=!0,void Rl.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,s=r.getCaptureState||(()=>!0),n=sl,o=t=>{try{var o=s();if(!n||!1===o||!t.isConnected||t.ownerDocument!==e||function(e,t){for(var r=e;r;){if(wl(r,t.blockClass,t.blockSelector)||wl(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>sl)return null;try{var t=JSON.parse(e),r=G(t)?t.map(bl):bl(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>n)return void(n=0);r.emit(l)&&(i.set(t,u),n-=u.length)}}catch(e){return}};try{var a=new t((e=>{try{if(!n||!1===s())return;var t=e=>{for(var t of kl(e))o(t)};for(var r of e)if("childList"===r.type)Sl(r.target)&&o(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&Sl(i)&&o(i)}else"attributes"===r.type&&Sl(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),n&&!1!==s()&&kl(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=se(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:a,activePlugins:v.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Rl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}var ru,iu=["type"],su=Object.defineProperty,nu=(e,t,r)=>((e,t,r)=>t in e?su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),ou=(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))(ou||{}),au=(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))(au||{}),lu=(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))(lu||{}),uu=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(uu||{}),cu=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(cu||{}),du=(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))(du||{}),hu=(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))(hu||{});function pu(e,t){return-1!==e.indexOf(t)}var gu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},_u={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},vu={};function fu(e){if(vu[e])return vu[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 gu?gu[e]:void 0,s=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]"))}))),n=e in _u?_u[e]:void 0,o=Boolean(n&&n.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(s&&o)return vu[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 pu(e,"AppleWebKit")&&!pu(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),vu[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var mu={};function yu(e,t,r){var i,s=e+"."+String(r);if(mu[s])return mu[s].call(t);var n=fu(e),o=null==(i=Object.getOwnPropertyDescriptor(n,r))?void 0:i.get;return o?(mu[s]=o,o.call(t)):t[r]}var bu={};function Su(e,t,r){var i=e+"."+String(r);if(bu[i])return bu[i].bind(t);var s=fu(e)[r];return"function"!=typeof s?t[r]:(bu[i]=s,s.bind(t))}function wu(){return fu("MutationObserver").constructor}function ku(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],s={next:i},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return s.next.apply(this,t)}));return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]!==n)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===n)return void(o.next=s.next);o=r(i=o.next)}else e[t]=s.next}}catch(e){return()=>{}}}var Cu={childNodes:e=>yu("Node",e,"childNodes"),parentNode:e=>yu("Node",e,"parentNode"),parentElement:e=>yu("Node",e,"parentElement"),textContent:e=>yu("Node",e,"textContent"),contains:(e,t)=>Su("Node",e,"contains")(t),getRootNode:e=>Su("Node",e,"getRootNode")(),host:e=>e&&"host"in e?yu("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?yu("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Su("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Su("Element",e,"querySelectorAll")(t),mutationObserver:wu,patch:ku},xu=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0});function Eu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Iu=0,Tu=6e4;function Mu(){Iu+=1}function Pu(){return Iu}function Ru(e,t){return t!==Iu||e>Tu}var Fu=0,Lu=0,Au=0,Ou=xu(),Du=null,Nu=null,Bu=[],qu=0,Hu=0,$u={slowestBatchMs:0},Wu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0},Uu=e=>e&&e>0?e:null;function zu(e){(Fu+=1)>1||(Ou=xu(),Bu=[],qu=0,Nu=Uu(e),Lu=Eu(),Au=Iu)}function Vu(){return 0===Fu?Du||xu():(Fu-=1)>0?Ou:(Ou.durationMs=Eu()-Lu,Ou.deferredStylesheetCount=qu,Wu.deferredCount+=qu,Nu=null,Ru(Ou.durationMs,Au)?Ou:Du=Ou)}var ju=32;function Gu(e,t,r){var i=e.length;if(r>=ju)return i;for(var s=0;e.length>s;s++){var n=e[s];try{var o=n.cssRules;if(o&&o.length)i+=Gu(o,t,r+1);else if(t&&n.styleSheet){var a=n.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=Gu(l,t,r+1))}}}catch(e){}}return i}function Qu(e){if(0!==Fu){var t=Gu(e,null,0);Ou.cssRuleCount+=t,Hu>0&&(Ou.nonDeferrableCssRuleCount+=t)}}function Ku(e){Hu+=1;try{return e()}finally{Hu-=1}}function Zu(e){Fu>0&&(Ou.stylesheetMs+=e)}function Yu(e){if(0===Fu||null===Nu)return!1;var t=Ou.cssRuleCount-Ou.nonDeferrableCssRuleCount;return t>=Nu||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),Gu(t,r,0)}catch(e){return 0}}(e)>Nu}function Ju(){Wu.failedCount+=1}function Xu(e){e>0&&(Wu.abandonedCount+=e)}function ec(e){return e.nodeType===e.ELEMENT_NODE}function tc(e){var t=e&&"host"in e&&"mode"in e&&Cu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Cu.shadowRoot(t)===e)}function rc(e){return"[object ShadowRoot]"==={}.toString.call(e)}function ic(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 sc(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 nc=0;function oc(e){var t=0===nc,r=t?Eu():0;nc+=1;try{var i=e.rules||e.cssRules;if(!i)return null;Qu(i);var s=e.href;return!s&&e.ownerNode&&(s=e.ownerNode.baseURI),ic(Array.from(i,(e=>ac(e,s))).join(""))}catch(e){return null}finally{nc-=1,t&&Zu(Eu()-r)}}function ac(e,t){var r;if(uc(e)){var i;try{i=oc(e.styleSheet)||sc(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return xc(i,e.styleSheet.href)}catch(e){}return i}var s=e.cssText;return cc(e)&&e.selectorText.includes(":")&&(s=lc(s)),t?xc(s,t):s}function lc(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function uc(e){return"styleSheet"in e}function cc(e){return"selectorText"in e}var dc=/^-?[A-Za-z_][\w-]*$/,hc=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function pc(e){var t=[],r=!1,i=null,s=new Map;function n(e){var s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void n(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!s.importRule)return r=!0,void(i=e);o(t[t.length-1],s.importRule,e)}function o(e,t,r){var i;try{var s;try{s=r||sc(t)}catch(e){s=t.cssText}try{s&&(null==(i=t.styleSheet)?void 0:i.href)&&(s=xc(s,t.styleSheet.href))}catch(e){}s&&e.parts.push(s),e.index+=1}catch(e){n(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&uc(r)){var i=s.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(cc(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&&!dc.test(r.containerName)?null:"@container "+(r.containerName?r.containerName+" ":"")+r.containerQuery+" {";if("string"==typeof r.conditionText){var s="";try{s=(null==(t=e.constructor)?void 0:t.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?"@supports "+r.conditionText+" {":null}return"string"==typeof r.name?"keyText"in r.cssRules[0]?dc.test(r.name)?"@keyframes "+r.name+" {":null:""===r.name?"@layer {":hc.test(r.name)?"@layer "+r.name+" {":null:null}(e);if(null===i)return!1;var s=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?xc(i,s):i,fixColons:"sheet"===r.kind&&cc(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var n=r.cssText;"sheet"===e.kind&&cc(r)&&r.selectorText.includes(":")&&(n=lc(n)),e.parts.push(e.sheetHref?xc(n,e.sheetHref):n),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;Qu(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var n=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:n,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,!uc(t)||s.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return s.set(t,null),0}if(!i||r.some((e=>e.sheet===i)))return 0;try{var n=i.rules||i.cssRules;if(!n)return 0;Qu(n);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(n);s.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(n,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var s=Eu(),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){n(null)}}else{var u=null;try{if("group"===l.kind){var c=l.prelude+l.parts.join("")+"}";u=l.fixColons?lc(c):c}else u=ic(l.parts.join(""))}catch(e){}n(u)}}}catch(e){r=!0,i=null}finally{Zu(Eu()-s)}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 gc{constructor(){nu(this,"idNodeMap",new Map),nu(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))),ec(e)){var r=Cu.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 _c(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,s=e.type,n=e.maskInputFn,o=e.value||"",a=s&&vc(s);return(r[i.toLowerCase()]||a&&r[a])&&(o=n?n(o,t):"*".repeat(o.length)),o}function vc(e){return e.toLowerCase()}var fc=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 mc(e){var t=e.element,r=e.name,i=e.value,s=e.maskAttributeFn,n=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==n&&n&&fc.has(vc(r))?i:"*".repeat(i.length):s?s(r,i,t):i:i}var yc="__rrweb_original__";function bc(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?vc(t):null}catch(e){return null}}var Sc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wc=/^(?:[a-z+]+:)?\/\//i,kc=/^www\..*/i,Cc=/^(data:)([^,]*),(.*)/i;function xc(e,t){return(e||"").replace(Sc,((e,r,i,s,n,o)=>{var a,l=i||n||o,u=r||s||"";if(!l)return e;if(wc.test(l)||kc.test(l))return"url("+u+l+u+")";if(Cc.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 Ec,Ic,Tc="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Mc=4096,Pc=1e5,Rc=10,Fc=new Map,Lc=1,Ac=new RegExp("[^a-z0-9-_:]"),Oc=-2;function Dc(){return Lc++}var Nc=/^[^ \t\n\r\u000c]+/,Bc=/^[, \t\n\r\u000c]+/,qc=new WeakMap;function Hc(e,t){return t&&""!==t.trim()?$c(e,t):t}function $c(e,t){var r=qc.get(e);if(r||(r=e.createElement("a"),qc.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Wc(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?Tc:e}(e,t.maxBase64ImageLength):e}function Uc(e,t,r,i,s,n){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&s){var a=null==(o=s.sheet)?void 0:o.href;if(a)return a}var l=Hc(e,i);if(l.startsWith("data:")){if("img"===t&&s){var u=l;return((null==n?void 0:n.type)||void 0!==(null==n?void 0:n.quality))&&(u=function(e,t,r,i){if(Pc>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>Mc||e.naturalHeight>Mc)return t;var s=Fc.get(t);if(s&&s.type===r&&s.quality===i)return s.result;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var o=n.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=n.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(Fc.size>=Rc){var u=Fc.keys().next().value;void 0!==u&&Fc.delete(u)}return Fc.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(s,l,n.type,n.quality)),Wc(u,n)}if("image"===t)return Wc(l,n)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=Hc(e,i);return"image"===t&&c.startsWith("data:")?Wc(c,n):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,s=e.exec(t.substring(r));return s?(r+=(i=s[0]).length,i):""}for(var s=[];i(Bc),t.length>r;){var n=i(Nc);if(","===n.slice(-1))n=Hc(e,n.substring(0,n.length-1)),s.push(n);else{var o="";n=Hc(e,n);for(var a=!1;;){var l=t.charAt(r);if(""===l){s.push((n+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,s.push((n+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return s.join(", ")}(e,i):"style"===r?xc(i,$c(e)):"object"===t&&"data"===r?Hc(e,i):i:Hc(e,i)}function zc(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function Vc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&Vc(Cu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&Vc(Cu.parentNode(e),t,r)}function jc(e,t,r,i){var s;if(ec(e)){if(!Cu.childNodes(s=e).length)return!1}else{if(null===Cu.parentElement(e))return!1;s=Cu.parentElement(e)}try{if("string"==typeof t){if(i){if(s.closest("."+t))return!0}else if(s.classList.contains(t))return!0}else if(Vc(s,t,i))return!0;if(r)if(i){if(s.closest(r))return!0}else if(s.matches(r))return!0}catch(e){}return!1}function Gc(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var Qc=new Map;function Kc(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function Zc(e){return null==e?"":e.toLowerCase()}var Yc=50,Jc=!1,Xc=!1;function ed(e,t){var r=t.doc,i=t.mirror,s=t.blockClass,n=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,g=t.maskTextFn,_=t.maskInputFn,v=t.maskAllElementAttributes,f=void 0!==v&&v,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,x=void 0!==C&&C,E=t.canvasMaskingConfigured,I=t.onSerialize,T=t.onIframeLoad,M=t.iframeLoadTimeout,P=void 0===M?5e3:M,R=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,W=t.maxDepth,U=void 0===W?Yc:W,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=U)return Xc=!0,Jc||(Jc=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+U+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=jc(e,o,a,void 0===z)),Fu>0&&(Ou.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,s=t.blockSelector,n=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,g=t.dataURLOptions,_=void 0===g?{}:g,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:hu.Document,childNodes:[],compatMode:e.compatMode}:{type:hu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:hu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r,i,s,n=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,g=void 0===p?{}:p,_=t.inlineImages,v=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=vc(e.tagName);return Ac.test(t)?"div":t}(e),C=new Set,x={},E=e.attributes.length,I=0;E>I;I++){var T=e.attributes[I];zc(k,T.name)||(x[T.name]=Uc(n,k,vc(T.name),T.value,e,g))}if("link"===k&&o&&!w){var M=e.sheet;if(!M){var P=function(e){return e.href}(e);P&&!(M=Kc(n,P))&&P.includes(".css")&&(M=Kc(n,window.location.origin+"/"+P.replace(window.location.href,"")))}var R=null;M&&(Yu(M)?Fu>0&&(Bu.push(e),qu+=1):R=oc(M)),R&&(delete x.rel,delete x.href,x._cssText=R)}if("style"===k&&e.sheet&&!(e.innerText||Cu.textContent(e)||"").trim().length){var F=Ku((()=>oc(e.sheet)));F&&(x._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var L=e.value,A=e.checked;"radio"!==x.type&&"checkbox"!==x.type&&"submit"!==x.type&&"button"!==x.type&&L?x.value=_c({element:e,type:bc(e),tagName:k,value:L,maskInputOptions:l,maskInputFn:u}):A&&(x.checked=A)}if("option"===k&&(e.selected&&!l.select?x.selected=!0:delete x.selected),"dialog"===k&&e.open){try{x.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){x.rr_open_mode="modal",x.ph_rr_could_not_detect_modal=!0}C.add("rr_open_mode")}if("canvas"===k&&v&&!(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 s=t.getImageData;if(new Uint32Array((yc in s?s[yc]:s).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)||(x.rr_dataURL=e.toDataURL(g.type,g.quality));else if(!("__context"in e)){var O=e.toDataURL(g.type,g.quality),D=n.createElement("canvas");D.width=e.width,D.height=e.height,O!==D.toDataURL(g.type,g.quality)&&(x.rr_dataURL=O)}var N,B,q=!1;if("img"===k&&_){Ec||(Ec=n.createElement("canvas"),Ic=Ec.getContext("2d"));var H=e,W=H.currentSrc||H.getAttribute("src")||"<unknown-src>",U=H.crossOrigin,z=(t,r)=>q?mc({element:e,name:t,value:r,maskAllElementAttributes:d,maskAttributeFn:h}):r,V=()=>{Gc(H,"load",V);try{Ec.width=H.naturalWidth,Ec.height=H.naturalHeight,Ic.drawImage(H,0,0);var e=Ec.toDataURL(g.type,g.quality);x.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="+W+"! Error: "+e)}"anonymous"===H.crossOrigin&&(U?x.crossOrigin=z("crossOrigin",U):H.removeAttribute("crossorigin"))};H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V)}if("audio"===k||"video"===k){var j=x;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&&(x.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(x.rr_scrollTop=e.scrollTop)),w){var G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null==(r=n.defaultView)?void 0:r.getComputedStyle(e);x={class:x.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null==(i=n.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(Y+((null==(s=n.defaultView)?void 0:s.scrollY)||0))+"px"},C.add("rr_width"),C.add("rr_height"),C.add("rr_left"),C.add("rr_top"),J&&(x.rr_position=J.position||"static",C.add("rr_position"),J.transform&&"none"!==J.transform&&(x.rr_transform=J.transform,C.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(x.rr_display=J.display,C.add("rr_display")))}if("iframe"!==k||m(x.src)||(e.contentDocument||(x.rr_src=x.src),delete x.src),d||h)for(var X of Object.entries(x)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(x[ee]=mc({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:hu.Element,tagName:k,attributes:x,childNodes:[],isSVG:(B=e,Boolean("svg"===B.tagName||B.ownerSVGElement)||void 0),needBlock:w,rootId:S,isCustom:N}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:_,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,s=t.maskTextFn,n=t.rootId,o=Cu.parentNode(e),a=o&&o.tagName,l=Cu.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if(Yu(o.sheet));else if(null==(r=o.sheet)?void 0:r.cssRules){var d=oc(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=xc(l,$c(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=s?s(l,Cu.parentElement(e)):l.replace(/[\S]/g,"*")),{type:hu.Text,textContent:l||"",isStyle:u,rootId:n}}(e,{doc:r,needsMask:n,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:hu.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:hu.Comment,textContent:Cu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,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===hu.Comment)return!0;if(e.type===hu.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 s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==s?void 0:s[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&&(Zc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Zc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Zc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Zc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Zc(e.attributes.property).match(/^(og|twitter|fb):/)||Zc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Zc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Zc(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(Zc(e.attributes.name))||Zc(e.attributes.property).match(/^article:/)||Zc(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(Zc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===hu.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?Oc:Dc();var K=Object.assign(Q,{id:G});if(i.add(e,K),G===Oc)return null;I&&I(e);var Z=!u;if(K.type===hu.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=Cu.shadowRoot(e);Y&&rc(Y)&&(K.isShadowHost=!0)}if((K.type===hu.Document||K.type===hu.Element)&&Z){y.headWhitespace&&K.type===hu.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onIframeListenerRegistered:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:U};if(K.type===hu.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(Cu.childNodes(e))){var ee=ed(X,J);ee&&K.childNodes.push(ee)}var te=null;if(ec(e)&&(te=Cu.shadowRoot(e)))for(var re of Array.from(Cu.childNodes(te))){var ie=ed(re,J);ie&&(rc(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var se=Cu.parentNode(e);if(se&&tc(se)&&rc(se)&&(K.isShadow=!0),K.type===hu.Element&&"iframe"===K.tagName){var ne=function(e,t,r){var i,s=()=>{},n=e.contentWindow;if(!n)return s;try{i=n.document.readyState}catch(e){return s}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),Gc(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?Gc(e,"load",o):(a=!0,Gc(e,"load",c))}}var d,h="about:blank";try{d=n.location.href}catch(e){return s}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),Gc(e,"load",o)}}return e.addEventListener("load",o),()=>{Gc(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&T){var r=ed(t,{doc:t,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onIframeListenerRegistered:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:U});r&&T(e,r)}}),P);null==R||R(e,ne)}return K.type===hu.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!Qc.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,v=!1,b=()=>{if(!v){v=!0;try{(()=>{if(F){var t=ed(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:U});t&&F(e,t)}})()}finally{Qc.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}),Qc.set(t,h)}}}(e,0,A),K}function td(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 rd{constructor(){nu(this,"parentElement",null),nu(this,"parentNode",null),nu(this,"ownerDocument"),nu(this,"firstChild",null),nu(this,"lastChild",null),nu(this,"previousSibling",null),nu(this,"nextSibling",null),nu(this,"ELEMENT_NODE",1),nu(this,"TEXT_NODE",3),nu(this,"nodeType"),nu(this,"nodeName"),nu(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof rd))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 id(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>sd(r,e,t,i)}function sd(e,t,r,i){nd((()=>{var s=e.removeEventListener;"function"==typeof s&&(void 0!==i?s.call(e,t,r,i):s.call(e,t,r))}))}function nd(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var od="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.",ad={map:{},getId(){return console.error(od),-1},getNode(){return console.error(od),null},removeNodeFromMap(){console.error(od)},has(){return console.error(od),!1},reset(){console.error(od)}};function ld(e,t,r){void 0===r&&(r={});var i=null,s=0;return function(){for(var n=arguments.length,o=new Array(n),a=0;n>a;a++)o[a]=arguments[a];var l=Date.now();s||!1!==r.leading||(s=l);var u=t-(l-s),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),s=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{s=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function ud(e,t,r,i,s){void 0===s&&(s=window);var n=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),n&&n.set){if(n.get)try{n.get.call(this)}catch(e){return}n.set.call(this,e)}}}),()=>ud(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ad=new Proxy(ad,{get(e,t,r){return"map"===t&&console.error(od),Reflect.get(e,t,r)}}));var cd=Date.now;function dd(e){var t,r,i,s,n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null==(t=Cu.parentElement(n.body))?void 0:t.scrollLeft)||(null==(r=null==n?void 0:n.body)?void 0:r.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null==(i=Cu.parentElement(n.body))?void 0:i.scrollTop)||(null==(s=null==n?void 0:n.body)?void 0:s.scrollTop)||0}}function hd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function pd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function gd(e){return e?e.nodeType===e.ELEMENT_NODE?e:Cu.parentElement(e):null}function _d(e,t,r,i){if(!e)return!1;var s=gd(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(Vc(s,t,i))return!0}catch(e){}if(r){if(s.matches(r))return!0;if(i&&null!==s.closest(r))return!0}return!1}function vd(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Oc}function fd(e,t){if(tc(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=Cu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||fd(i,t))}function md(e){return Boolean(e.changedTouches)}function yd(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function bd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Sd(e){return!!e&&(e instanceof rd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Cu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(cd=()=>(new Date).getTime());class wd{constructor(){nu(this,"id",1),nu(this,"styleIDMap",new WeakMap),nu(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 kd(e){var t,r=null;return"getRootNode"in e&&(null==(t=Cu.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Cu.host(Cu.getRootNode(e))&&(r=Cu.host(Cu.getRootNode(e))),r}function Cd(e){var t=e.ownerDocument;return!!t&&(Cu.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=kd(r);)r=t;return r}(e);return Cu.contains(t,r)}(e))}function xd(e){return"__ln"in e}class Ed{constructor(){nu(this,"length",0),nu(this,"head",null),nu(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&&xd(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&&xd(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 Id,Td=(e,t)=>e+"@"+t;class Md{constructor(){nu(this,"frozen",!1),nu(this,"locked",!1),nu(this,"texts",[]),nu(this,"attributes",[]),nu(this,"attributeMap",new WeakMap),nu(this,"generatedAttributes",new WeakMap),nu(this,"removes",[]),nu(this,"mapRemoves",[]),nu(this,"movedMap",{}),nu(this,"addedSet",new Set),nu(this,"movedSet",new Set),nu(this,"droppedSet",new Set),nu(this,"removesSubTreeCache",new Set),nu(this,"mutationCb"),nu(this,"blockClass"),nu(this,"blockSelector"),nu(this,"maskTextClass"),nu(this,"maskTextSelector"),nu(this,"inlineStylesheet"),nu(this,"maskInputOptions"),nu(this,"maskTextFn"),nu(this,"maskInputFn"),nu(this,"maskAllElementAttributes"),nu(this,"maskAttributeFn"),nu(this,"keepIframeSrcFn"),nu(this,"recordCanvas"),nu(this,"canvasMaskingConfigured"),nu(this,"inlineImages"),nu(this,"slimDOMOptions"),nu(this,"dataURLOptions"),nu(this,"doc"),nu(this,"mirror"),nu(this,"iframeManager"),nu(this,"stylesheetManager"),nu(this,"shadowDomManager"),nu(this,"canvasManager"),nu(this,"processedNodeManager"),nu(this,"unattachedDoc"),nu(this,"canvasManagerReleased",!1),nu(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),nu(this,"emit",(()=>{if(!this.frozen&&!this.locked){var e,t,r=Eu(),i=Pu();try{this.processBufferedMutations()}finally{e=Eu()-r,t=i,Fu>0||Ru(e,null!=t?t:Iu)||e>$u.slowestBatchMs&&($u.slowestBatchMs=e)}}})),nu(this,"processBufferedMutations",(()=>{for(var e=[],t=new Set,r=new Ed,i=e=>{for(var t=e,r=Oc;r===Oc;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},s=s=>{var n=Cu.parentNode(s);if(n&&Cd(s)&&"TEXTAREA"!==n.tagName){var o=tc(n)?this.mirror.getId(kd(s)):this.mirror.getId(n),a=i(s);if(-1===o||-1===a)return r.addNode(s);var l=ed(s,{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=>{yd(e,this.mirror)&&this.iframeManager.addIframe(e),bd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Sd(e)&&!_d(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Cu.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 n of this.movedSet)Rd(this.removesSubTreeCache,n)&&!this.movedSet.has(Cu.parentNode(n))||s(n);for(var o of this.addedSet)Fd(this.droppedSet,o)||Rd(this.removesSubTreeCache,o)?Fd(this.movedSet,o)?s(o):this.droppedSet.add(o):s(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(Cu.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(Cu.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var g=Cu.parentNode(h.value);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var _=Cu.host(g);if(-1!==this.mirror.getId(_)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),s(l.value)}var v={texts:this.texts.map((e=>{var t=e.node,r=Cu.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),s=JSON.stringify(e._unchangedStyles);r.style.length>i.length&&(i+s).split("var(").length===r.style.split("var(").length&&(r.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var n of Object.entries(r)){var o=n[0],a=n[1];"string"!=typeof a&&null!==a||(r[o]=mc({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};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={},(v.texts.length||v.attributes.length||v.removes.length||v.adds.length)&&this.mutationCb(v)})),nu(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),nu(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(Cu.childNodes(e),(e=>Cu.textContent(e)||"")).join("");t.attributes.value=_c({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:bc(e),value:r,maskInputFn:this.maskInputFn})})),nu(this,"processMutation",(e=>{var t;if(!vd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var r=Cu.textContent(e.target);_d(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue||this.texts.push({value:jc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,gd(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break;case"attributes":var i,s=e.target,n=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 s=e.lookupPrefix(r);return s?s+":"+t:t}(s,n,o),l=o?s.getAttributeNS(o,n):e.target.getAttribute(n);if("value"===a){var u=s,c=bc(u);l=_c({element:u,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:c,value:l,maskInputFn:this.maskInputFn})}if(_d(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;var d=this.attributeMap.get(e.target),h="IFRAME"===s.tagName&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&s.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===a&&"INPUT"===s.tagName&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!zc(s.tagName,a)){var p=Uc(this.doc,vc(s.tagName),vc(a),l,s,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 g=this.unattachedDoc.createElement("span"),_=s.style;for(var v of(e.oldValue&&(g.style.cssText=e.oldValue),Array.from(_))){var f=_.getPropertyValue(v),m=_.getPropertyPriority(v);f!==g.style.getPropertyValue(v)||m!==g.style.getPropertyPriority(v)?d.styleDiff[v]=""===m?f:[f,m]:d._unchangedStyles[v]=[f,m]}for(var y of Array.from(g.style))""===_.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===a&&"DIALOG"===s.tagName){d.attributes.rr_open_mode=s.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(_d(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=tc(e.target)?this.mirror.getId(Cu.host(e.target)):this.mirror.getId(e.target);_d(e.target,this.blockClass,this.blockSelector,!1)||vd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Pd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||fd(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Td(r,i)]?Pd(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!tc(e.target)||!rc(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),Cu.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),nu(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(vd(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[Td(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_d(e,this.blockClass,this.blockSelector,!1)||(Cu.childNodes(e).forEach((e=>this.genAdds(e))),Sd(e)&&Cu.childNodes(Cu.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 Pd(e,t){for(var r=[t];r.length;){var i=r.pop();e.delete(i),Cu.childNodes(i).forEach((e=>r.push(e)))}}function Rd(e,t,r){return 0!==e.size&&function(e,t,r){var i=Cu.parentNode(t);return!!i&&e.has(i)}(e,t)}function Fd(e,t){if(0===e.size)return!1;for(var r=Cu.parentNode(t);r;){if(e.has(r))return!0;r=Cu.parentNode(r)}return!1}var Ld=function(e,t){return void 0===t&&(t="rrweb"),Id?function(){try{return e(...arguments)}catch(e){if(Id&&!0===Id(e,t))return;throw e}}:e},Ad=[];function Od(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 Dd(e,t){var r,i=new Md;i.init(e);try{r=new(wu())(Ld(i.processMutations.bind(i)));var s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),r.observe(t,s),Ad.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function Nd(e){var t=e.scrollCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Od(e);if(o&&!_d(o,s,n,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=dd(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=[id("scroll",Ld(ld(Ld((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(id("scrollend",Ld(l),r)),()=>u.forEach((e=>e()))}function Bd(e,t){for(var r=Ad.length-1;r>=0;r--){var i=Ad[r];if(i){var s=i.bufferBelongsToIframe(e);!s&&t&&t.has(i.bufferDoc())&&(s=!0),s&&(i.reset(),Ad.splice(r,1))}}}var qd=["INPUT","TEXTAREA","SELECT"],Hd=new WeakMap;function $d(e){return function e(t,r){if(jd("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||jd("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||jd("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||jd("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 s=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(s)}return r}(e,[])}function Wd(e,t,r){var i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:i}):{}}var Ud=5e3;function zd(e,t){var r,i,s,n,o=e.stylesheetManager;n=e.mirror.getId("#document"===t.nodeName?t:Cu.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(s=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:s.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==n&&-1!==n&&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!==n&&-1!==n)try{o.adoptStyleSheets(e,n)}catch(e){}return r}}),Ld((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function Vd(e,t){void 0===t&&(t={});var r,i,s=e.doc.defaultView;if(!s)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,s=e.mouseInteractionCb,n=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,g=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),s(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),n(...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),g(...arguments)}}(e,t);var n,o,a,l,u,c,d,h,p=[],g=Ld((()=>{if(i){i.destroy(),i.reset();var t=Ad.indexOf(i);-1!==t&&Ad.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect(),p.forEach((e=>e()))}));try{if(e.recordDOM){var v=Dd(e,e.doc);r=v.observer,i=v.buffer}if(p.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,s=e.mirror;if(!1===r.mousemove)return()=>{};var n,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=ld(Ld((e=>{var r=Date.now()-n;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],n=null})),a),c=Ld(ld(Ld((e=>{var t=Od(e),r=md(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;n||(n=cd()),l.push({x:i,y:o,id:s.getId(t),timeOffset:cd()-n}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?au.Drag:e instanceof MouseEvent?au.MouseMove:au.TouchMove)})),o,{trailing:!1})),d=[id("mousemove",c,i),id("touchmove",c,i),id("drag",c,i)];return Ld((()=>{d.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,s=e.blockClass,n=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(lu).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{var o=vc(e),a=(e=>r=>{var o=Od(r);if(!_d(o,s,n,!0)){var a=null,l=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=uu.Mouse;break;case"touch":a=uu.Touch;break;case"pen":a=uu.Pen}a===uu.Touch&&(lu[e]===lu.MouseDown?l="TouchStart":lu[e]===lu.MouseUp&&(l="TouchEnd"))}else md(r)&&(a=uu.Touch);null!==a?(u=a,(l.startsWith("Touch")&&a===uu.Touch||l.startsWith("Mouse")&&a===uu.Mouse)&&(a=null)):lu[e]===lu.Click&&(a=u,u=null);var c=md(r)?r.changedTouches[0]:r;if(c){var d=i.getId(o),h=c.clientX,p=c.clientY;Ld(t)(_({type:lu[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))}}})(e);if(window.PointerEvent)switch(lu[e]){case lu.MouseDown:case lu.MouseUp:o=o.replace("mouse","pointer");break;case lu.TouchStart:case lu.TouchEnd:return}l.push(id(o,a,r))})),Ld((()=>{l.forEach((e=>e()))}))}(e)),p.push(Nd(e)),p.push(function(e,t){var r=e.viewportResizeCb,i=t.win,s=-1,n=-1;return id("resize",Ld(ld(Ld((()=>{var e=hd(),t=pd();s===e&&n===t||(r({width:Number(t),height:Number(e)}),s=e,n=t)})),200)),i)}(e,{win:s})),p.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.ignoreClass,a=e.ignoreSelector,l=e.maskInputOptions,u=e.maskInputFn,c=e.userTriggeredOnInput;function d(e){var t=Od(e),i=e.isTrusted,d=r.defaultView;if(!t||!d||t instanceof d.HTMLElement){var p=t&&t.tagName;if(t&&"OPTION"===p&&(t=Cu.parentElement(t)),t&&p&&qd.indexOf(p)>=0&&!_d(t,s,n,!0)&&!(t.classList.contains(o)||a&&t.matches(a))){var g=t.value,_=!1,v=bc(t)||"";"radio"===v||"checkbox"===v?_=t.checked:(l[p.toLowerCase()]||l[v])&&(g=_c({element:t,maskInputOptions:l,tagName:p,type:v,value:g,maskInputFn:u})),h(t,c?{text:g,isChecked:_,userTriggered:i}:{text:g,isChecked:_});var f=t.name;"radio"===v&&f&&_&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;h(e,c?{text:r,isChecked:!_,userTriggered:!1}:{text:r,isChecked:!_})}}))}}}function h(e,r){var s=Hd.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Hd.set(e,r);var n=i.getId(e);Ld(t)(_({},r,{id:n}))}}var p=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>id(e,Ld(d),r))),g=r.defaultView;if(!g)return()=>{p.forEach((e=>e()))};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&p.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map((e=>ud(e[0],e[1],{set(){Ld(d)({target:this,isTrusted:!1})}},!1,g)))),Ld((()=>{p.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,s=e.mirror,n=e.sampling,o=e.doc,a=Ld((e=>ld(Ld((n=>{var o=Od(n);if(o&&!_d(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,c=o.playbackRate,d=o.loop;t({type:e,id:s.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),n.media||500))),l=[id("play",a(du.Play),o),id("pause",a(du.Pause),o),id("seeked",a(du.Seeked),o),id("volumechange",a(du.VolumeChange),o),id("ratechange",a(du.RateChange),o)];return Ld((()=>{l.forEach((e=>e()))}))}(e)),e.recordDOM){var f=function(e){var t=new Map,r=new Set,i=!0,s=e=>{if(i)try{e()}catch(e){}},n=e=>{var r,i=t.get(e);if(i){for(;null==(r=i[0])?void 0:r.ready;){var n=i.shift();(null==n?void 0:n.emit)&&s(n.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}),n(e)):s(r)}else s(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,g=()=>{h||p||(h=!0,void 0!==d&&r.delete(d),c.ready=!0,c.emit=void 0,n(o))};try{d=e.setTimeout(g,Ud),h||p?e.clearTimeout(d):r.add(d)}catch(e){g()}return t=>{!p&&i&&(p=!0,void 0!==d&&(e.clearTimeout(d),r.delete(d)),h?t&&s(l):(c.ready=!0,t||(c.emit=void 0),n(o)))}},reset(){i=!1,r.forEach((t=>e.clearTimeout(t))),r.clear(),t.clear()}}}(s);p.push(f.reset),p.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,s=e.stylesheetManager,n=t.win,o=t.mutationQueue;if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};var a=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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")}),n.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),n.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,c=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(c,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;s.onCssomSheetMutation(t);var c=Wd(t,i,s.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=oc(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")})),n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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={};Gd("CSSGroupingRule")?d.CSSGroupingRule=n.CSSGroupingRule:(Gd("CSSMediaRule")&&(d.CSSMediaRule=n.CSSMediaRule),Gd("CSSConditionRule")&&(d.CSSConditionRule=n.CSSConditionRule),Gd("CSSSupportsRule")&&(d.CSSSupportsRule=n.CSSSupportsRule));var h={};return Object.entries(d).forEach((e=>{var t=e[0],n=e[1];h[t]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Wd(t.parentStyleSheet,i,s.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...$d(t),l];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,adds:[{rule:a,index:h}]})))}return l}),"host")}),n.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Wd(t.parentStyleSheet,i,s.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...$d(t),a];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,removes:[{index:h}]})))}return l}),"host")})})),Ld((()=>{n.CSSStyleSheet.prototype.insertRule=a,n.CSSStyleSheet.prototype.deleteRule=c,l&&(n.CSSStyleSheet.prototype.replace=l),u&&(n.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:s,mutationQueue:f})),p.push(zd(e,e.doc)),p.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,s=e.ignoreCSSAttributes,n=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:Ld(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2],h=e.apply(t,o);if(s.has(u))return h;var p=null==(l=t.parentRule)?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);var g=Wd(p,i,n.styleMirror),_=g.id,v=g.styleId;if(_&&-1!==_||v&&-1!==v){var f=$d(t.parentRule);a.queueMutation(p,(()=>r({id:_,styleId:v,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:Ld(((e,t,o)=>{var l,u=o[0],c=e.apply(t,o);if(s.has(u))return c;var d=null==(l=t.parentRule)?void 0:l.parentStyleSheet;n.onCssomSheetMutation(d);var h=Wd(d,i,n.styleMirror),p=h.id,g=h.styleId;if(p&&-1!==p||g&&-1!==g){var _=$d(t.parentRule);a.queueMutation(d,(()=>r({id:p,styleId:g,remove:{property:u},index:_})))}return c}),"host")}),Ld((()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u}))}(e,{win:s,mutationQueue:f})),e.collectFonts&&p.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var s=[],n=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return n.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=ku(r.fonts,"add",(function(e){return function(r){return setTimeout(Ld((()=>{var e=n.get(r);e&&(t(e),n.delete(r))})),0),e.apply(this,[r])}}));return s.push((()=>{i.FontFace=o})),s.push(a),Ld((()=>{s.forEach((e=>e()))}))}(e))}for(var m of(p.push((o=(n=e).doc,a=n.mirror,l=n.blockClass,u=n.blockSelector,c=n.selectionCb,d=!0,(h=Ld((()=>{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 s=e.getRangeAt(i),n=s.startContainer,h=s.startOffset,p=s.endContainer,g=s.endOffset;_d(n,l,u,!0)||_d(p,l,u,!0)||t.push({start:a.getId(n),startOffset:h,end:a.getId(p),endOffset:g})}c({ranges:t})}})))(),id("selectionchange",h))),p.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?ku(r.customElements,"define",(function(e){return function(r,i,s){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,s])}})):()=>{}}(e)),e.plugins))p.push(m.observer(m.callback,s,m.options))}catch(e){try{g()}catch(e){}throw e}return g}function jd(e){return void 0!==window[e]}function Gd(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Qd{constructor(e){nu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),nu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var s=r||this.getRemoteIdToLocalIdMap(e),n=i||this.getLocalIdToRemoteIdMap(e),o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),n.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 Kd{constructor(e){nu(this,"iframes",new WeakMap),nu(this,"crossOriginIframeMap",new WeakMap),nu(this,"crossOriginIframeMirror",new Qd(Dc)),nu(this,"crossOriginIframeStyleMirror"),nu(this,"crossOriginIframeRootIdMap",new WeakMap),nu(this,"mirror"),nu(this,"mutationCb"),nu(this,"wrappedEmit"),nu(this,"loadListener"),nu(this,"pageHideListener"),nu(this,"stylesheetManager"),nu(this,"recordCrossOriginIframes"),nu(this,"messageHandler"),nu(this,"nestedIframeListeners",new Map),nu(this,"attachedWindows",new WeakMap),nu(this,"attachedDocuments",new WeakMap),nu(this,"attachedIframes",new Map),nu(this,"loadListenerDisposers",new WeakMap),nu(this,"iframeElementsById",new Map),nu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Qd(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=>nd(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{sd(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 s=this.attachedDocuments.get(e);s||this.attachedDocuments.set(e,s=new Set),s.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){var o=this.handleMessage.bind(this);nd((()=>{n.addEventListener("message",o),this.nestedIframeListeners.set(n,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(n)}))}nd((()=>{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 s=()=>{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",s),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:s})}})),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 ou.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:ou.IncrementalSnapshot,data:{source:au.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case ou.Meta:case ou.Load:case ou.DomContentLoaded:return!1;case ou.Plugin:return t;case ou.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ou.IncrementalSnapshot:switch(t.data.source){case au.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 au.Drag:case au.TouchMove:case au.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case au.ViewportResize:return!1;case au.MediaInteraction:case au.MouseInteraction:case au.Scroll:case au.CanvasMutation:case au.Input:return this.replaceIds(t.data,e,["id"]),t;case au.StyleSheetRule:case au.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case au.Font:return t;case au.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case au.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 s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(r,t[s]):e.getId(r,t[s]));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===hu.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,s=this.attachedWindows.get(r);s&&(s.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(sd(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(sd(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 n=this.attachedDocuments.get(r);n&&(n.forEach((e=>{nd((()=>this.mirror.removeNodeFromMap(e)))})),nd((()=>Bd(r,n))),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&&sd(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{sd(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 Zd{constructor(e){nu(this,"shadowDoms",new WeakSet),nu(this,"mutationCb"),nu(this,"scrollCb"),nu(this,"bypassOptions"),nu(this,"mirror"),nu(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(rc(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(r=null==(i=Cu.host(e))?void 0:i.ownerDocument)&&void 0!==r?r:t,n=Dd(_({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),o=n.observer,a=n.buffer;this.restoreHandlers.push({doc:s,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();var e=Ad.indexOf(a);-1!==e&&Ad.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Nd(_({},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(Cu.host(e))),this.restoreHandlers.push({doc:s,handler:zd({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:ku(e.prototype,"attachShadow",(function(e){return function(i){var s=e.call(this,i),n=Cu.shadowRoot(this);return n&&Cd(this)&&r.addShadowRoot(n,t),s}}))})}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 Yd="skip-frame";function Jd(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 Xd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),th=0;64>th;th++)eh[Xd.charCodeAt(th)]=th;var rh=new Map,ih=(e,t,r)=>{if(e&&(oh(e,t)||"object"==typeof e)){var i=function(e,t){var r=rh.get(e);return r||rh.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s}};function sh(e,t,r,i){if(e instanceof Array)return e.map((e=>sh(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 s=e.constructor.name,n=function(e){var t,r=new Uint8Array(e),i=r.length,s="";for(t=0;i>t;t+=3)s+=Xd[r[t]>>2],s+=Xd[(3&r[t])<<4|r[t+1]>>4],s+=Xd[(15&r[t+1])<<2|r[t+2]>>6],s+=Xd[63&r[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e);return{rr_type:s,base64:n}}return e instanceof DataView?{rr_type:e.constructor.name,args:[sh(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:[sh(e.data,t,r,i),e.width,e.height]}:oh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ih(e,t,r)}:e}var nh=(e,t,r,i)=>e.map((e=>sh(e,t,r,i))),oh=(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])))},ah=["webgl","webgl2"];function lh(e){return"nodeType"in e}function uh(e,t,r,i){var s=[];try{if(i){var n=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return ku(i.prototype,"configure",(function(i){return function(s){var n=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!n||lh(n)&&_d(n,t,r,!0))return i.call(this,s);lh(n)&&!("__context"in n)&&(n.__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&&s?_({},s,{usage:"number"==typeof s.usage?s.usage|o:o}):s)}}))}(e,t,r);n&&s.push(n)}var o=ku(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(s){for(var n=function(e){return"experimental-webgl"===e?"webgl":e}(s),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!_d(this,t,r,!0)&&("__context"in this||(this.__context=n),i&&ah.includes(n)))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,[s,...a])}}));s.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function ch(e,t,r,i,s,n,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=ku(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(ih(d,n,this),this.canvas&&"tagName"in this.canvas&&!_d(this.canvas,i,s,!0)){var h=nh(u,n,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(n){var c=ud(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!_d(this.canvas,i,s,!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 dh,hh,ph,gh='(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',_h="undefined"!=typeof self&&self.Blob&&new Blob([gh],{type:"text/javascript;charset=utf-8"});function vh(e){var t;try{if(!(t=_h&&(self.URL||self.webkitURL).createObjectURL(_h)))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(gh),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class fh{constructor(e){nu(this,"pendingCanvasMutations",new Map),nu(this,"rafStamps",{latestId:0,invokeId:null}),nu(this,"mirror"),nu(this,"mutationCb"),nu(this,"resetObservers"),nu(this,"frozen",!1),nu(this,"locked",!1),nu(this,"rafIdTimestamp",null),nu(this,"rafIdFlush",null),nu(this,"refCount",0),nu(this,"torndown",!1),nu(this,"resetFrameDedup",null),nu(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,s=e.blockClass,n=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,s,n,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,s,n,{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,s){var n=this;if("OffscreenCanvas"in t){var o,a="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=uh(t,r,i,!0),u=new Map;try{o=new vh}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,s=r.displayHeight;this.mutationCb({id:t,type:cu["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,s]}],displayWidth:i,displayHeight:s})}};var d,h=1e3/e,p=0,_=e=>{var l,v;c||(p&&h>e-p||(p=e,(l=[],v=e=>{try{e.querySelectorAll("canvas").forEach((e=>{_d(e,r,i,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&v(e.shadowRoot)}))}catch(e){}},v(t.document),l).forEach(function(){var e=g((function*(e){var t,r,i=n.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)),g=function(e,t,r,i,s,n){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return Yd}if(void 0!==o){if(!Array.isArray(o)||!o.every(Jd))return Yd;var a=r/s,l=i/n;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}}))}}}(s.canvasMasking,e,h,p,c,d);if(g===Yd)return void u.set(i,!1);var _=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:i,bitmap:_,width:h,height:p,displayWidth:c,displayHeight:d,dataURLOptions:s.dataURLOptions,maskRegions:g},[_])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(_))};d=requestAnimationFrame(_),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 s=uh(e,t,r,!1),n=function(e,t,r,i,s){var n=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=ku(t.CanvasRenderingContext2D.prototype,o,(function(n){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return _d(this.canvas,r,i,!0)||setTimeout((()=>{var r=nh(l,t,this,s);e(this.canvas,{type:cu["2D"],property:o,args:r})}),0),n.apply(this,l)}}));n.push(a)}catch(s){var l=ud(t.CanvasRenderingContext2D.prototype,o,{set(t){_d(this.canvas,r,i,!0)||e(this.canvas,{type:cu["2D"],property:o,args:[t],setter:!0})}});n.push(l)}};for(var l of o)a(l);return()=>{n.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,s){var n=[];return void 0!==t.WebGLRenderingContext&&n.push(...ch(t.WebGLRenderingContext.prototype,cu.WebGL,e,r,i,t,s)),void 0!==t.WebGL2RenderingContext&&n.push(...ch(t.WebGL2RenderingContext.prototype,cu.WebGL2,e,r,i,t,s)),()=>{n.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{s(),n(),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=>v(e,iu)));this.mutationCb({id:t,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(e)}}}}class mh{constructor(e){var t;nu(this,"trackedLinkElements",new WeakSet),nu(this,"pendingDeferredSheets",new Set),nu(this,"mutationCb"),nu(this,"adoptedStyleSheetCb"),nu(this,"maskAllElementAttributes"),nu(this,"maskAttributeFn"),nu(this,"styleMirror",new wd),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=pc(i))}catch(e){}if(!r||!i)return Ju(),null;var s=r,n=!1,o={sheet:i,invalidate(){n=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,c=Eu(),d=Pu(),h=!0;try{if(n)return a=!0,Ju(),!0;if(!s.advance(r))return h=!1,!1;a=!0;var p=s.text();if(!e.isConnected)return!0;var g=null;try{g=e.sheet}catch(e){}return g!==i?(Ju(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(Ju(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),Ru(l=Eu()-c,null!=(u=d)?u:Iu)||(Wu.totalMs+=l,l>Wu.slowestSliceMs&&(Wu.slowestSliceMs=l))}},remainingRules:()=>s.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:mc({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:[]},s=[],n=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var n=r.styleMirror.add(e);t=n;var o=Eu();try{Ku((()=>{try{var t=e.rules||e.cssRules;t&&Qu(t)}catch(e){}s.push({styleId:n,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:ac(t,e.href),index:r})))})}))}finally{Zu(Eu()-o)}}i.styleIds.push(t)};for(var o of e)n(o);s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Qc.forEach((e=>e.abort())),Qc.clear()}trackStylesheetInLinkElement(e){}}class yh{constructor(){nu(this,"nodeMap",new WeakMap),nu(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 bh=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Sh=document.createElement("iframe");document.body.appendChild(Sh),Array.from=(null==(ru=Sh.contentWindow)?void 0:ru.Array.from)||Array.from,document.body.removeChild(Sh)}}catch(e){console.debug("Unable to override Array.from",e)}var wh=new gc,kh=new Set([au.Mutation,au.MediaInteraction,au.StyleSheetRule,au.CanvasMutation,au.Font,au.Log,au.StyleDeclaration,au.AdoptedStyleSheet]);function Ch(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 xh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,s=r.checkoutEveryNms,n=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,g=r.maskTextClass,v=void 0===g?"rr-mask":g,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,x=r.maskInputFn,E=r.maskTextFn,I=r.maskAllElementAttributes,T=void 0!==I&&I,M=r.maskAttributeFn,P=r.hooks,R=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,W=r.recordCanvas,U=void 0!==W&&W,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,se=void 0===ie?new Set([]):ie,ne=r.attributeFilter;Id=r.errorHandler;var oe=_({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),wh.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=td(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,ge=0,_e=new Map,ve=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return R&&!le&&(e=R(e)),e};dh=(e,t)=>{var r,o=e;if(o.timestamp=cd(),!(null==(r=Ad[0])?void 0:r.isFrozen())||o.type===ou.FullSnapshot||o.type===ou.IncrementalSnapshot&&kh.has(o.data.source)||Ad.forEach((e=>e.unfreeze())),ae)null==i||i(ve(o),t);else if(le){var a={type:"rrweb",event:ve(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===ou.FullSnapshot)ue=o,ge=0;else if(o.type===ou.IncrementalSnapshot){if(o.data.source===au.Mutation&&o.data.isAttachIframe)return;ge++,(n&&ge>=n||s&&o.timestamp-ue.timestamp>s)&&hh(!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 s=wh.getNode(i.node.id);s&&"IFRAME"===s.nodeName&&r.add(s)}e.removes.forEach((e=>{var i=e.id;if(!t||!t.has(i)){var s=Se.getIframeElementById(i);s&&r.has(s)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}})),null==pe||pe(),Se.cleanupDetachedIframes()}dh({type:ou.IncrementalSnapshot,data:_({source:au.Mutation},e)})},me=e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Scroll},e)}),ye=e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.CanvasMutation},e)}),be=new mh({mutationCb:fe,adoptedStyleSheetCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.AdoptedStyleSheet},e)}),maskAllElementAttributes:T,maskAttributeFn:M}),Se=new Kd({mirror:wh,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:dh});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:wh,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new yh,Ce=null==N?void 0:N.configured;ph=new fh({recordCanvas:U,mutationCb:ye,win:window,blockClass:a,blockSelector:u,mirror:wh,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var xe=new Zd({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:a,blockSelector:u,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:ce,dataURLOptions:oe,maskTextFn:E,maskInputFn:x,maskAllElementAttributes:T,maskAttributeFn:M,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:de,iframeManager:Se,stylesheetManager:be,canvasManager:ph,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:ne},mirror:wh});hh=function(e){if(void 0===e&&(e=!1),H){zu(S);try{dh({type:ou.Meta,data:{href:window.location.href,width:pd(),height:hd()}},e),null==t||t.cancel(),t=void 0,be.reset(),xe.init(),Ad.forEach((e=>e.lock()));var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,s=void 0===i?new gc:i,n=r.blockClass,o=void 0===n?"rr-block":n,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,g=void 0===p||p,_=r.inlineImages,v=void 0!==_&&_,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,x=void 0!==C&&C,E=r.maskAttributeFn,I=r.slimDOM,T=r.dataURLOptions,M=r.preserveWhiteSpace,P=r.onSerialize,R=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,W=td(void 0!==I&&I);zu(q);try{return ed(e,{doc:e,mirror:s,blockClass:o,blockSelector:l,maskTextClass:c,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:x,maskAttributeFn:E,slimDOMOptions:W,dataURLOptions:T,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:P,onIframeLoad:R,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{Vu()}}(document,{mirror:wh,blockClass:a,blockSelector:u,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:ce,inlineStylesheetBudgetRules:S,maskTextFn:E,maskInputFn:x,maskAllElementAttributes:T,maskAttributeFn:M,slimDOM:de,dataURLOptions:oe,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){yd(e,wh)&&Se.addIframe(e),bd(e,wh)&&be.trackLinkElement(e),Sd(e)&&xe.addShadowRoot(Cu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),xe.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{n=Bu,Bu=[],r=n}if(!i)return console.warn("Failed to snapshot the document");if(dh({type:ou.FullSnapshot,data:{node:i,initialOffset:dd(window)}},e),Ad.forEach((e=>e.unlock())),ph.onFullSnapshot(),r.length){var s=function(e,t,r){var i=!1,s=null,n=0,o=null,a=()=>null!==o||e.length>n,l=()=>{var r=e[n];e[n]=null,n+=1,r&&nd((()=>{o=t.beginDeferredLinkInlining(r,wh.getId(r))}))},u=()=>{if(o){var e=o,t=!0;nd((()=>{t=e.advance(200)})),t&&(o=null)}},c=e=>{if(s=null,!i){var t=0;do{try{o||l(),u()}catch(e){null==o||o.discard(),o=null,Xu(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?s=Ch(c):r())}};return s=Ch(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(!i){i=!0,null==s||s.cancel(),s=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=n;e.length>p;p++)null!==e[p]&&(h+=1);Xu(h),null==o||o.discard(),o=null}r()}}}}(r,be,(()=>{t===s&&(t=void 0)}));t=s}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,wh.getId(document))}finally{Vu()}var n}};try{var Ee=[];for(var Ie of(Ee.push(id("pagehide",(()=>{try{null==t||t.flush()}catch(e){}t=void 0}),window)),["visibilitychange","freeze","resume"]))Ee.push(id(Ie,Mu,document));he=e=>{var t=_e.get(e);t&&(t.forEach((e=>{nd(e);var t=Ee.indexOf(e);-1!==t&&Ee.splice(t,1)})),_e.delete(e))},pe=()=>{for(var e of _e){var t=e[0],r=wh.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 Te=e=>{var t;return Ld(Vd)({mutationCb:fe,mousemoveCb:(e,t)=>dh({type:ou.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.ViewportResize},e)}),inputCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Input},e)}),mediaInteractionCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.MediaInteraction},e)}),styleSheetRuleCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.StyleSheetRule},e)}),styleDeclarationCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Font},e)}),selectionCb(e){dh({type:ou.IncrementalSnapshot,data:_({source:au.Selection},e)})},customElementCb(e){dh({type:ou.IncrementalSnapshot,data:_({source:au.CustomElement},e)})},blockClass:a,ignoreClass:d,ignoreSelector:p,maskTextClass:v,maskTextSelector:m,maskInputOptions:ce,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:x,maskTextFn:E,maskAllElementAttributes:T,maskAttributeFn:M,keepIframeSrcFn:re,blockSelector:u,slimDOMOptions:de,dataURLOptions:oe,mirror:wh,iframeManager:Se,stylesheetManager:be,shadowDomManager:xe,processedNodeManager:ke,canvasManager:ph,ignoreCSSAttributes:se,attributeFilter:ne,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=>dh({type:ou.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},P)};Se.addLoadListener((e=>{try{var t=wh.getId(e),r=Te(e.contentDocument);if("function"==typeof r&&(Ee.push(r),-1!==t)){var i=_e.get(t);i||_e.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Se.addPageHideListener((e=>{var t=wh.getId(e);null==he||he(t),Bd(e)}));var Me=-1,Pe=e=>dh({type:ou.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Re=()=>{var e,t,r,i,s=document,n=null!==(e=null!==(t=null!==(r=null!==(i=s.fullscreenElement)&&void 0!==i?i:s.webkitFullscreenElement)&&void 0!==r?r:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,o=n?wh.getId(n):-1;o!==Me&&(-1!==Me&&Pe({id:Me,enter:!1}),Me=o,-1!==o&&Pe({id:o,enter:!0}))},Fe=()=>{hh();var e=Te(document);"function"==typeof e&&Ee.push(e),Ee.push(id("fullscreenchange",Re)),Ee.push(id("webkitfullscreenchange",Re)),Ee.push(id("mozfullscreenchange",Re)),Ee.push(id("MSFullscreenChange",Re)),bh=!0};return["interactive","complete"].includes(document.readyState)?Fe():(Ee.push(id("DOMContentLoaded",(()=>{dh({type:ou.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()}))),Ee.push(id("load",(()=>{dh({type:ou.Load,data:{}}),"load"===G&&Fe()}),window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Ee.forEach((e=>nd(e))),ke.destroy(),Se.removeLoadListener(),Se.destroy(),_e.clear(),xe.reset(),wh.reset(),bh=!1,Id=void 0}}catch(e){console.warn(e)}}xh.addCustomEvent=(e,t)=>{if(!bh)throw new Error("please add custom event after start recording");dh({type:ou.Custom,data:{tag:e,payload:t}})},xh.freezePage=()=>{Ad.forEach((e=>e.freeze()))},xh.takeFullSnapshot=e=>{if(!bh)throw new Error("please take full snapshot after start recording");hh(e)},xh.mirror=wh;var Eh=Object.defineProperty,Ih=(e,t,r)=>((e,t,r)=>t in e?Eh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class Th{constructor(e){Ih(this,"fileName"),Ih(this,"functionName"),Ih(this,"lineNumber"),Ih(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 Mh=/(^|@)\S+:\d+/,Ph=/^\s*at .*(\S+:\d+|\(native\))/m,Rh=/^(eval@)?(\[native code])?$/,Fh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Ph)?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(Ph)}),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),s=this.extractLocation(r?r[1]:i.pop()),n=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0];return new Th({functionName:n,fileName:o,lineNumber:s[1],columnNumber:s[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Rh)}),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 Th({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,s=this.extractLocation(e.replace(t,""));return new Th({functionName:i,fileName:s[0],lineNumber:s[1],columnNumber:s[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=[],s=2,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new Th({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=[],s=0,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new Th({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(Mh)&&!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 Th({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Lh(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,s=[];if(i.children&&i.children.length>0)for(var n=0;i.children.length>n;n++){var o=i.children[n];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&s.push(o)}s.length>1&&(r+=":eq("+s.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Ah(e){return Array.isArray(e)}function Oh(e){return"object"==typeof e&&null!==e&&!Ah(e)}function Dh(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Oh(e[i])&&Dh(e[i],t-1))return!0;return!1}function Nh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],s=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?s.splice(n,1/0,e):s.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Oh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Oh(o)&&Dh(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]=Ah(u)?Lh(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 Bh={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 qh(e,t,r){var i,s=r?Object.assign({},Bh,r):Bh,n=s.logger;if(!n)return()=>{};i="string"==typeof n?t[n]:n;var o=0,a=!1,l=[];if(s.level.includes("error")){var u=t=>{var r=t.message,i=Fh.parse(t.error).map((e=>e.toString())),n=[Nh(r,s.stringifyOptions)];e({level:"error",trace:i,payload:n})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[Nh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,s.stringifyOptions)]:(r=new Error,i=[Nh("Uncaught (in promise)",s.stringifyOptions),Nh(t.reason,s.stringifyOptions)]);var n=Fh.parse(r).map((e=>e.toString()));e({level:"error",trace:n,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of s.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,n,l){try{if(!(n in t))return()=>{};var u=t[n],c={next:u},d=(t=>function(){for(var n=arguments.length,l=new Array(n),u=0;n>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=Fh.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Nh(e,s.stringifyOptions)));o++,s.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[Nh("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[n]=d,()=>{if(t[n]!==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[n],i=e(r);i;){if(i.next===d)return void(i.next=c.next);i=e(r=i.next)}else t[n]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Hh=e=>({name:"rrweb/console@1",observer:qh,options:e}),$h=e=>"undefined"!=typeof Document&&e instanceof Document,Wh=()=>{},Uh=e=>{var t;if(Q(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function zh(e,t,r){try{if(!(t in e))return Wh;var i={next:e[t]},s=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(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t],n=Uh(r);n;){if(n.next===s)return void(n.next=i.next);n=Uh(r=n.next)}else e[t]=i.next}}catch(e){return Wh}}function Vh(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),s={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return s;for(var n of t.payloadHostDenyList)if(i.endsWith(n))return{hostname:i,isHostDenied:!0};return s}var jh=Zr("[Recorder]"),Gh=e=>"navigation"===e.entryType,Qh=e=>"resource"===e.entryType;function Kh(e,t){return!!t&&(se(t)||t[e])}function Zh(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 Yh=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Jh(e){var t=e.type,r=e.recordBody,i=e.headers;function s(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:!!Zh(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(s(Yh))return!1;if(se(r))return!0;if(G(r))return s(r);var n=r[t];return se(n)?n:s(n)}function Xh(e,t,r,i,s,n){return ep.apply(this,arguments)}function ep(){return ep=g((function*(e,t,r,i,s,n){if(void 0===n&&(n=0),n>10)return jh.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var n=e.length-1;n>=0;n-=1)if(Qh(o=e[n])&&o.initiatorType===t&&(Y(i)||o.startTime>=i)&&(Y(s)||s>=o.startTime))return e[n];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*n))),Xh(e,t,r,i,s,n+1))})),ep.apply(this,arguments)}function tp(e){var t=e.body,r=e.options,i=e.url;if(te(t))return null;var s=Vh(i,r);if(s.isHostDenied)return s.hostname+" is in deny list";if(J(t))return t;if($h(t))return t.textContent;if(ne(t))return di(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 rp=e=>!ee(e)&&("navigation"===e.entryType||"resource"===e.entryType);function ip(e){var t=e.entry,r=e.method,i=e.status,s=e.networkRequest,n=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=[_({},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:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(rp(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 sp=["video/","audio/"];function np(e){return K(e)&&Q(e.getReader)&&Q(e.tee)}var op=500,ap="[SessionReplay] Timeout while trying to read body",lp="[SessionReplay] Failed to read body";function up(e){return lp+": "+e}function cp(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function dp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(ap)),op);try{e.clone().text().then((e=>t(e)),(e=>t(up(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(lp)}}))}(e);var r=ds(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 s=parseInt(i,10);return Number.isFinite(s)&&s>t}catch(e){return!1}}(e,r)?Promise.resolve(cp(r)):function(e,t){return new Promise((r=>{var i,s=!1;function n(){try{var e;null==(e=i)||e.cancel()}catch(e){}}function o(e){s||(s=!0,clearTimeout(l),n(),r(e))}var a,l=setTimeout((()=>o(ap)),op);try{a=e.clone()}catch(e){return void o(lp)}var u=a.body;if(np(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(lp)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(s)n();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var s of e)r.set(s,i),i+=s.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(cp(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(up(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(up(e))))}catch(e){o(lp)}}))}(e,r)}function hp(){return hp=g((function*(e){var t=e.r,r=e.options,i=Vh(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):dp(t,r)})),hp.apply(this,arguments)}function pp(){return pp=g((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,s=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var n=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=sp.some((e=>null==n?void 0:n.startsWith(e)));if(n&&o)return"Content-Type "+n+" is not supported";var a=Vh(s,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return ee(i)?dp(t,r):Promise.resolve(i)})),pp.apply(this,arguments)}var gp=null;function _p(e,t,r){if(!("performance"in t))return()=>{};if(gp)return jh.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},hs,r):hs,s=t=>{var r=[],s=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!s){var n=i.maskRequestFn(e);t||(s=!n||(e=>!!e&&bs.has(e))(n)),n&&r.push(n)}})),r.length>0&&e(_({},t,{requests:r}))},n=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Gh(e)||Qh(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>ip({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var s=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>Gh(e)||Qh(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>ip({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),n=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(s,t,i),o=()=>{},a=()=>{};return(i.recordHeaders||i.recordBody)&&(o=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Kh("request",r.recordHeaders),s=Kh("response",r.recordHeaders),n=zh(t.XMLHttpRequest.prototype,"open",(n=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,g=new Request(a),_={},v={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(_.requestHeaders=v);var m=d.send.bind(d);d.send=e=>(Jh({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(_.requestBody=tp({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(),s=t.join(": ");r&&(i[r]=s)})),s&&(_.responseHeaders=i),Jh({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(_.responseBody=tp({body:d.response,options:r,url:a})),Xh(t,"xmlhttprequest",g.url,h,p).then((t=>{var r=ip({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:_,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){jh.error("Failed to instrument XHR for network capture",e)}n.call(d,o,a.toString(),l,u,c)}));return()=>{n()}}(s,t,i),a=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=Kh("request",r.recordHeaders),s=Kh("response",r.recordHeaders),n=zh(t,"fetch",(n=>function(){var o=g((function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return jh.error("Failed to instrument fetch for network capture",e),n(o,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),i&&(h.requestHeaders=p),!np(null==a?void 0:a.body)&&Jh({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return hp.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){jh.error("Failed to record fetch request for network capture",e)}c=t.performance.now(),u=Zh(o)?yield n(l):yield n(o,a),d=t.performance.now();var g={};return u.headers.forEach(((e,t)=>{g[t]=e})),s&&(h.responseHeaders=g),Jh({type:"response",headers:g,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return pp.apply(this,arguments)}({r:u,options:r,url:o})),u}finally{Xh(t,"fetch",l.url,c,d).then((t=>{var r,i=ip({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()=>{n()}}(s,t,i)),gp=()=>{n(),o(),a(),gp=null}}var vp=e=>({name:"rrweb/network@1",observer:_p,options:e});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Hh,getRecordNetworkPlugin:vp},h.__PosthogExtensions__.rrweb={record:xh,version:"v2",wasMaxDepthReached:()=>Xc,resetMaxDepthState(){Xc=!1,Jc=!1},getLastSnapshotCost:()=>Du,getMutationCost:()=>_({},$u),resetSnapshotCostState(){Fu=0,Lu=0,Au=0,Iu=0,Ou=xu(),Du=null,Nu=null,Bu=[],qu=0,Hu=0,$u={slowestBatchMs:0},Wu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:xh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:Hh},h.getRecordNetworkPlugin=vp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new tu(e,t);var fp,mp,yp,bp,Sp,wp,kp,Cp,xp,Ep,Ip,Tp,Mp,Pp,Rp,Fp={},Lp=[],Ap=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Op=Array.isArray;function Dp(e,t){for(var r in t)e[r]=t[r];return e}function Np(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Bp(e,t,r){var i,s,n,o={};for(n in t)"key"==n?i=t[n]:"ref"==n?s=t[n]:o[n]=t[n];if(arguments.length>2&&(o.children=arguments.length>3?fp.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return qp(e,o,i,s,null)}function qp(e,t,r,i,s){var n={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++yp:s,__i:-1,__u:0};return null==s&&null!=mp.vnode&&mp.vnode(n),n}function Hp(e){return e.children}function $p(e,t){this.props=e,this.context=t}function Wp(e,t){if(null==t)return e.__?Wp(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?Wp(e):null}function Up(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],s=[],n=Dp({},t);n.__v=t.__v+1,mp.vnode&&mp.vnode(n),Xp(e.__P,n,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?Wp(t):r,!!(32&t.__u),s),n.__v=t.__v,n.__.__k[n.__i]=n,tg(i,n,s),t.__e=t.__=null,n.__e!=r&&zp(n)}}function zp(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})),zp(e)}function Vp(e){(!e.__d&&(e.__d=!0)&&bp.push(e)&&!jp.__r++||Sp!=mp.debounceRendering)&&((Sp=mp.debounceRendering)||wp)(jp)}function jp(){try{for(var e,t=1;bp.length;)bp.length>t&&bp.sort(kp),e=bp.shift(),t=bp.length,Up(e)}finally{bp.length=jp.__r=0}}function Gp(e,t,r,i,s,n,o,a,l,u,c){var d,h,p,g,_,v,f,m=i&&i.__k||Lp,y=t.length;for(l=function(e,t,r,i,s){var n,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(s),n=0;s>n;n++)null!=(o=t[n])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[n]=qp(null,o,null,null,null):Op(o)?o=e.__k[n]=qp(Hp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[n]=qp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[n]=o,l=n+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=Kp(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>c?h--:c>s&&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[n]=null;if(d)for(n=0;c>n;n++)null!=(a=r[n])&&0==(2&a.__u)&&(a.__e==i&&(i=Wp(a)),sg(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]||Fp,p.__i=d,v=Xp(e,p,h,s,n,o,a,l,u,c),g=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&ig(h.ref,null,p),c.push(p.ref,p.__c||g,p)),null==_&&null!=g&&(_=g),(f=!!(4&p.__u))||h.__k===p.__k?(l=Qp(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:g&&(l=g.nextSibling),p.__u&=-7);return r.__e=_,l}function Qp(e,t,r,i){var s,n;if("function"==typeof e.type){for(s=e.__k,n=0;s&&s.length>n;n++)s[n]&&(s[n].__=e,t=Qp(s[n],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=Wp(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Kp(e,t,r,i){var s,n,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(s=r-1,n=r+1;s>=0||t.length>n;)if(null!=(u=t[o=0>s?n++:s--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Zp(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Ap.test(t)?r:r+"px"}function Yp(e,t,r,i,s){var n,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||Zp(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Zp(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])n=t!=(t=t.replace(Ip,"$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+n]=r,r?i?r[Ep]=i[Ep]:(r[Ep]=Tp,e.addEventListener(t,n?Pp:Mp,n)):e.removeEventListener(t,n?Pp:Mp,n);else{if("http://www.w3.org/2000/svg"==s)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 Jp(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[xp])t[xp]=Tp++;else if(r[Ep]>t[xp])return;return r(mp.event?mp.event(t):t)}}}function Xp(e,t,r,i,s,n,o,a,l,u){var c,d,h,p,g,_,v,f,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),n=[a=t.__e=r.__e]),(c=mp.__b)&&c(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(c=x.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 x(m,b):(t.__c=h=new $p(m,b),h.constructor=x,h.render=ng),$&&$.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!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Dp({},h.__s)),Dp(h.__s,x.getDerivedStateFromProps(m,h.__s))),g=h.props,_=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==g&&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)})),Lp.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(g,_,v)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=mp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),Lp.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=Dp(Dp({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),k=null!=c&&c.type===Hp&&null==c.key?rg(c.props.children):c,a=Gp(e,Op(k)?k:[k],t,r,i,s,n,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!=n)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=n&&(n[n.indexOf(a)]=null),t.__e=a}else{if(null!=n)for(C=n.length;C--;)Np(n[C]);eg(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||eg(t);mp.__e(e,t,r)}}else null==n&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,s,n,o,a,l){var u,c,d,h,p,g,_,v=r.props||Fp,f=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=n)for(u=0;n.length>u;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(s,m,f.is&&f),a&&(mp.__m&&mp.__m(t,n),a=!1),n=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(n="textarea"==m&&null!=f.defaultValue?null:n&&fp.call(e.childNodes),!a&&null!=n)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||Yp(e,u,null,p,s);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?g=p:"checked"==u?_=p:a&&"function"!=typeof p||v[u]===p||Yp(e,u,p,v[u],s);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Gp("template"==t.type?e.content:e,Op(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:r.__k&&Wp(r,0),a,l),null!=n)for(u=n.length;u--;)Np(n[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[u]||"progress"==m&&!g||"option"==m&&g!=v[u])&&Yp(e,u,g,v[u],s),u="checked",null!=_&&_!=e[u]&&Yp(e,u,_,v[u],s))}return e}(r.__e,t,r,i,s,n,o,l,u);return(c=mp.diffed)&&c(t),128&t.__u?void 0:a}function eg(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(eg))}function tg(e,t,r){for(var i=0;r.length>i;i++)ig(r[i],r[++i],r[++i]);mp.__c&&mp.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){mp.__e(e,t.__v)}}))}function rg(e){return"object"!=typeof e||null==e||e.__b>0?e:Op(e)?e.map(rg):void 0!==e.constructor?null:Dp({},e)}function ig(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){mp.__e(e,r)}}function sg(e,t,r){var i,s;if(mp.unmount&&mp.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ig(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){mp.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(s=0;i.length>s;s++)i[s]&&sg(i[s],t,r||"function"!=typeof e.type);r||Np(e.__e),e.__c=e.__=e.__e=void 0}function ng(e,t,r){return this.constructor(e,r)}function og(e,t,r){var i,s,n;t==document&&(t=document.documentElement),mp.__&&mp.__(e,t),i=t.__k,s=[],n=[],Xp(t,e=t.__k=Bp(Hp,null,[e]),i||Fp,Fp,t.namespaceURI,i?null:t.firstChild?fp.call(t.childNodes):null,s,i?i.__e:t.firstChild,!1,n),tg(s,e,n),e.props.children=null}fp=Lp.slice,mp={__e(e,t,r,i){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},yp=0,$p.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Dp({},this.state),"function"==typeof e&&(e=e(Dp({},r),this.props)),e&&Dp(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Vp(this))},$p.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Vp(this))},$p.prototype.render=Hp,bp=[],wp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kp=function(e,t){return e.__v.__b-t.__v.__b},jp.__r=0,Cp=Math.random().toString(8),xp="__d"+Cp,Ep="__a"+Cp,Ip=/(PointerCapture)$|Capture$/i,Tp=0,Mp=Jp(!1),Pp=Jp(!0),Rp=0;var ag,lg,ug,cg,dg=0,hg=[],pg=mp,gg=pg.__b,_g=pg.__r,vg=pg.diffed,fg=pg.__c,mg=pg.unmount,yg=pg.__;function bg(e,t){pg.__h&&pg.__h(lg,e,dg||t),dg=0;var r=lg.__H||(lg.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Sg(e){return dg=1,function(e,t,r){var i=bg(ag++,2);if(i.t=e,!i.__c&&(i.__=[Fg(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=lg,!lg.__f)){var s=function(e,t,r){if(!i.__c.__H)return!0;var s=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){s=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),n){var a=n.call(this,e,t,r);return s?a||o:a}return!s||o};lg.__f=!0;var n=lg.shouldComponentUpdate,o=lg.componentWillUpdate;lg.componentWillUpdate=function(e,t,r){if(this.__e){var i=n;n=void 0,s(e,t,r),n=i}o&&o.call(this,e,t,r)},lg.shouldComponentUpdate=s}return i.__N||i.__}(Fg,e)}function wg(e,t){var r=bg(ag++,3);!pg.__s&&Rg(r.__H,t)&&(r.__=e,r.u=t,lg.__H.__h.push(r))}function kg(e){return dg=5,Cg((function(){return{current:e}}),[])}function Cg(e,t){var r=bg(ag++,7);return Rg(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function xg(e){var t=lg.context[e.__c],r=bg(ag++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(lg)),t.props.value):e.__}function Eg(){for(var e;e=hg.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Mg),t.__h.some(Pg),t.__h=[]}catch(r){t.__h=[],pg.__e(r,e.__v)}}}pg.__b=function(e){lg=null,gg&&gg(e)},pg.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yg&&yg(e,t)},pg.__r=function(e){_g&&_g(e),ag=0;var t=(lg=e.__c).__H;t&&(ug===lg?(t.__h=[],lg.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&Eg(),ag=0)),ug=lg},pg.diffed=function(e){vg&&vg(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==hg.push(t)&&cg===pg.requestAnimationFrame||((cg=pg.requestAnimationFrame)||Tg)(Eg)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),ug=lg=null},pg.__c=function(e,t){t.some((function(e){try{e.__h.some(Mg),e.__h=e.__h.filter((function(e){return!e.__||Pg(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],pg.__e(r,e.__v)}})),fg&&fg(e,t)},pg.unmount=function(e){mg&&mg(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Mg(e)}catch(e){t=e}})),r.__H=void 0,t&&pg.__e(t,r.__v))};var Ig="function"==typeof requestAnimationFrame;function Tg(e){var t,r=function(){clearTimeout(i),Ig&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Ig&&(t=requestAnimationFrame(r))}function Mg(e){var t=lg,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),lg=t}function Pg(e){var t=lg;e.__c=e.__(),lg=t}function Rg(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Fg(e,t){return"function"==typeof t?t(e):t}function Lg(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&Q(r.then)&&r.then(void 0,(()=>{}))}}}}var Ag="gzip-js",Og="base64",Dg="events",Ng="cancelEvents",Bg={Tab:"tab",Selector:"selector"},qg={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"},Hg={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},$g={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Wg={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ug={End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},zg="always",Vg={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},jg={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",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_COMPLETED:"$survey_completed",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Gg="popover",Qg=Zr("[Surveys]");function Kg(e){return!(!e.start_date||e.end_date)}function Zg(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var Yg="seenSurvey_",Jg="inProgressSurvey_",Xg=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),e_=e=>Xg(Yg,e),t_=e=>{try{var t=e_(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Qg.error("Failed to persist survey seen state",e)}},r_=[$g.Popover,$g.Widget,$g.API],i_={ignoreConditions:!1,ignoreDelay:!1,displayType:Gg},s_="featureFlags",n_="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 o_{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 s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new o_(s)}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 o_(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 a_{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 o_.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 c_}}var l_,u_=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&&(u_=e=>crypto.getRandomValues(e));class c_{nextUint32(){return this._buffer.length>this._cursor||(u_(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var d_=()=>h_().toString(),h_=()=>(l_||(l_=new a_)).generate(),p_="",g_=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var __=null,v_={_is_supported(){if(!ee(__))return __;if(__=!1,i)try{var e="__ph_cookie_support_"+d_();v_._set(e,"xyz"),__='"xyz"'===Wa(e),v_._remove(e)}catch(e){__=!1}return __},_error(e){Kr.error("cookieStore error: "+e)},_get:Wa,_parse(e){var t;try{t=JSON.parse(v_._get(e))||{}}catch(e){}return t},_set(e,t,r,s,n){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),p_)return p_;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),s=Math.min(r.length,8),n="dmn_chk_"+d_();!p_&&s--;){var o=r.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(n)&&(t.cookie=a+";max-age=0",p_=o)}return p_}(e);if(!r){var s=(e=>{var t=e.match(g_);return t?t[0]:""})(e);s!==r&&Kr.info("Warning: cookie subdomain discovery mismatch",s,r),r=s}return r?"; domain=."+r:""}return""}(i.location.hostname,s);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),o="; expires="+u.toUTCString()}n&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Kr.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{v_._set(e,"",-1,t)}catch(e){return}}},f_=null,m_={_is_supported(){if(!ee(f_))return f_;var t=!0;if(Y(e))t=!1;else try{var r="__mplssupport__";m_._set(r,"xyz"),'"xyz"'!==m_._get(r)&&(t=!1),m_._remove(r)}catch(e){t=!1}return t||Kr.error("localStorage unsupported; falling back to cookie store"),f_=t,t},_error(e){Kr.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){m_._error(e)}return null},_parse(e){try{return JSON.parse(m_._get(e))||{}}catch(e){}return null},_set(t,r){try{return null==e||e.localStorage.setItem(t,JSON.stringify(r)),!0}catch(e){m_._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){m_._error(e)}}},y_=[un,en,Xs,rn,sn,nn,Sn,bn,mn],b_=[ks,ws,Us,zs,Tn,In,wn],S_=e=>e+"_cpm",w_=["__proto__","constructor","prototype"],k_=e=>{if(!K(e))return{};var t={};return Object.keys(e).forEach((r=>{-1===w_.indexOf(r)&&(t[r]=e[r])})),t},C_=function(e,t){void 0===t&&(t=[]);var r={};return[...b_,...t].forEach((t=>{var i=e[t];Y(i)||ee(i)||""===i||(r[t]=i)})),r},x_=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var s=e.charCodeAt(i);t=33*t^s,r=Math.imul(r^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},E_=(e,t)=>({p:t,f:x_(JSON.stringify(e))}),I_=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=v_._parse(S_(e)),i=(null==r?void 0:r.f)===x_(t)&&G(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},T_=(e,t)=>t+"|"+(v_._get(S_(e))||""),M_={},P_={_is_supported:()=>!0,_error(e){Kr.error("memoryStorage error: "+e)},_get:e=>e in M_?M_[e]:null,_parse:e=>e in M_?M_[e]:null,_set:(e,t)=>(M_[e]=t,!0),_remove(e){delete M_[e]}},R_=null,F_={_is_supported(){if(!ee(R_))return R_;if(R_=!0,Y(e))R_=!1;else try{var t="__support__";F_._set(t,"xyz"),'"xyz"'!==F_._get(t)&&(R_=!1),F_._remove(t)}catch(e){R_=!1}return R_},_error(e){Kr.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){F_._error(e)}return null},_parse(e){try{return JSON.parse(F_._get(e))||null}catch(e){}return null},_set(t,r){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(r)),!0}catch(e){F_._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){F_._error(e)}}},L_=Zr("[Stylesheet Loader]"),A_=e,O_=i,D_="#020617",N_={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:qg.Right,widgetType:Bg.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:D_,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},B_=[qg.Center,qg.Left,qg.Right];function q_(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 H_(e){var t;void 0===e&&(e=N_.backgroundColor),"#"===e[0]&&(t=q_(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=q_(r)),!t)return D_;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var s=parseInt(i[1]),n=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(s*s*.299+n*n*.587+o*o*.114)>127.5?D_:"white"}return D_}var $_=(e,t,r)=>{var i=ov(e),s=O_.querySelector("."+i);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var n=O_.createElement("div");((e,t,r)=>{var i=_({},N_,r),s=e.style,n=!B_.includes(i.position)||t===$g.Widget&&(null==r?void 0:r.widgetType)===Bg.Tab;s.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)),s.setProperty("--ph-survey-box-padding",i.boxPadding),s.setProperty("--ph-survey-max-width",i.maxWidth),s.setProperty("--ph-survey-z-index",i.zIndex),s.setProperty("--ph-survey-border-color",i.borderColor),n?(s.setProperty("--ph-survey-border-radius",i.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",i.borderRadius+" "+i.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",i.backgroundColor),s.setProperty("--ph-survey-box-shadow",i.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||H_(i.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",H_(i.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||H_(i.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),s.setProperty("--ph-widget-color",i.widgetColor),s.setProperty("--ph-widget-text-color",H_(i.widgetColor)),s.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"),s.setProperty("--ph-survey-input-background",a);var l=(null==r?void 0:r.inputTextColor)||H_(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",i.outlineColor)})(n,e.type,e.appearance),n.className=i;var o=n.attachShadow({mode:"open"}),a=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var s=(e=>{var t;return Q(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return s&&(i=s(i)),i||(L_.error("prepare_external_dependency_stylesheet returned null"),null)})(O_,':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 O_.body.appendChild(n),{shadow:o,isNewlyCreated:!0}},W_=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,s=e.posthog,n=e.isSurveyCompleted,o=e.properties,a=e.surveyLanguage,l=e.questionSnapshots;s?(t_(r),s.capture(Vg.SENT,_({[jg.SURVEY_NAME]:r.name,[jg.SURVEY_ID]:r.id,[jg.SURVEY_ITERATION]:r.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[jg.SURVEY_SUBMISSION_ID]:i,[jg.SURVEY_COMPLETED]:n},a&&{[jg.SURVEY_LANGUAGE]:a},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Sa(t,r,l),o,{$set:{[wa(r,"responded")]:!0}})),n&&(A_.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),nv(r),s.reloadFeatureFlags())):Qg.error("[survey sent] event not captured, PostHog instance not found.")},U_=(e,t,r)=>{return _({[jg.SURVEY_NAME]:e.name,[jg.SURVEY_ID]:e.id,[jg.SURVEY_ITERATION]:e.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[jg.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)&&{[jg.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[jg.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Sa(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots));var i},z_=(e,t,r,i)=>{if(t){if(!r){var s=iv(e),n=s?s.surveyLanguage:i;t.capture(Vg.DISMISSED,_({},U_(e,s,t),n&&{[jg.SURVEY_LANGUAGE]:n},{$set:{[wa(e,"dismissed")]:!0}})),nv(e),t_(e),A_.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else Qg.error("[survey dismissed] event not captured, PostHog instance not found.")},V_=(e,t)=>{if(t){var r=(e=>Xg("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=iv(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Vg.ABANDONED,U_(e,i,t),{transport:"sendBeacon"})}}else Qg.error("[survey abandoned] event not captured, PostHog instance not found.")},j_=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),G_=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Q_=e=>{var t=e.map((e=>e.id));return t.every((e=>!!e))?t:void 0},K_=(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 s of t){var n=r.get(s);if(!n)return null;i.push(n)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?G_(e.questions,j_(e.questions)):e.questions;var r},Z_=e=>Ma(e)||sv(e),Y_=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,Vp(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"+Rp++,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}),J_=()=>xg(Y_),X_=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,s,n,o,a=Dp({},e.props);for(n in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==n?i=t[n]:"ref"==n?s=t[n]:a[n]=void 0===t[n]&&null!=o?o[n]:t[n];return arguments.length>2&&(a.children=arguments.length>3?fp.call(arguments,2):r),qp(e.type,a,i||e.key,s||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function ev(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var s=mi(t);if(!s)return!1;var n=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return Fa[o](n,[s])}var tv=e=>Xg(Jg,e),rv=(e,t)=>{try{localStorage.setItem(tv(e),JSON.stringify(t))}catch(e){Qg.error("Error setting in-progress survey state in localStorage",e)}},iv=e=>{try{var t=localStorage.getItem(tv(e));if(t)return JSON.parse(t)}catch(e){Qg.error("Error getting in-progress survey state from localStorage",e)}return null},sv=e=>{var t=iv(e);return!te(null==t?void 0:t.surveySubmissionId)},nv=e=>{try{localStorage.removeItem(tv(e))}catch(e){Qg.error("Error clearing in-progress survey state from localStorage",e)}};function ov(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function av(e,t,r){if(void 0===t&&(t=qg.Right),e===$g.ExternalSurvey)return{};switch(t){case qg.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case qg.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case qg.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case qg.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case qg.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case qg.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case qg.Left:return{left:"30px"};case qg.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===$g.Widget&&r===Bg.Tab?"60px":"30px"}}}var lv=0;function uv(e,t,r,i,s,n){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:--lv,__i:-1,__u:0,__source:s,__self:n};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return mp.vnode&&mp.vnode(u),u}var cv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),dv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),hv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),pv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),gv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),_v=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:uv("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"})}),vv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:uv("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"})}),fv=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return uv("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:[uv("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),uv("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})]})},mv=uv("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[uv("g",{"clip-path":"url(#clip0_2415_6911)",children:[uv("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:uv("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),uv("g",{mask:"url(#mask0_2415_6911)",children:[uv("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"}),uv("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"}),uv("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"}),uv("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"}),uv("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"}),uv("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"})]})]}),uv("defs",{children:uv("clipPath",{id:"clip0_2415_6911",children:uv("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function yv(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return uv("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",mv]})}function bv(t){var r=t.text,i=t.submitDisabled,s=t.appearance,n=t.onSubmit,o=t.link,a=t.onPreviewSubmit,l=t.skipSubmitButton,u=t.canGoBack,c=t.onBack,d=xg(Y_).isPreviewMode,h=!!u&&!!c,p=!l&&uv("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){o&&(null==e||e.open(o)),d?null==a||a():n()},children:r});return uv("div",{className:"bottom-section",children:[h?uv("div",{className:"form-buttons form-buttons-with-back",children:[uv("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),p]}):p,!s.whiteLabel&&uv(yv,{urlParams:{utm_source:"survey-footer"}})]})}function Sv(e){var t=e.question,r=e.forceDisableHtml;return uv("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[uv(t.type===Wg.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&X_({component:Bp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function wv(e){return uv("button",{className:"form-cancel",onClick:e.onClick,disabled:xg(Y_).isPreviewMode,"aria-label":"Close survey",type:"button",children:fv({fill:"black"})})}uv("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:uv("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 kv=e;function Cv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onClose,a=xg(Y_).isPopup;return wg((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return oi(kv,"keydown",e),()=>{kv.removeEventListener("keydown",e)}}),[o]),uv("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==n.hideCancelButton&&uv(wv,{onClick:()=>o()}),uv("h3",{className:"thank-you-message-header",children:t}),r&&X_({component:Bp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!s&&"text"!==i}),a&&uv(bv,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>o()})]})}function xv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onStart,a=xg(Y_),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return uv("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==n.hideCancelButton&&uv(wv,{onClick:()=>u()}),t&&uv("h3",{className:"intro-screen-header",children:t}),r&&X_({component:Bp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!s&&"text"!==i}),uv(bv,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var Ev=e=>G(e)&&e.every((e=>J(e)));function Iv(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,s=e.onSubmit,n=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=J_().isPreviewMode,d=kg(null),h=Sg((()=>J(a)?a:"")),p=h[0],g=h[1],_=null==i?void 0:i.disableAutofocus;wg((()=>{_||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,_]);var v="surveyQuestion"+o,f=Cg((()=>function(e,t,r){var i,s,n=e.trim();if(!r&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case x:if(void 0!==o.value&&o.value>n.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case E:if(void 0!==o.value&&n.length>o.value)return null!==(s=o.errorMessage)&&void 0!==s?s:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=dr(t.validation,x),y=dr(t.validation,E),b=Cg((()=>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||s(p.trim())},w=()=>{f||n(p.trim())};return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:t,forceDisableHtml:r,htmlFor:v}),uv("textarea",{ref:d,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){g(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&&uv("div",{className:"validation-hint",children:b})]}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function Tv(e){var t=e.question,r=e.appearance,i=e.onSubmit,s=e.onPreviewSubmit,n=e.canGoBack,o=e.onBack;return uv(Hp,{children:[uv("div",{className:"question-container",children:uv(Sv,{question:t,forceDisableHtml:e.forceDisableHtml})}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:n,onBack:o})]})}function Mv(e){var t,r=e.question,i=e.forceDisableHtml,s=e.displayQuestionIndex,n=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=Sg((()=>re(l)?l:G(l)&&l.length>0&&re(parseInt(l[0]))?parseInt(l[0]):J(l)&&re(parseInt(l))?parseInt(l):null)),g=p[0],_=p[1],v="emoji"===r.display&&2===r.scale,f=J_().isPreviewMode,m=e=>f?a(e):o(e);return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:r,forceDisableHtml:i}),uv("div",{className:"rating-section",children:[uv("div",{className:"rating-options",children:["emoji"===r.display&&uv("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=Ov[r.scale])?void 0:t.map(((e,t)=>uv("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+s+"-rating-"+t+" "+(t+1===g?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;_(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&uv("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:Dv(r.scale).map(((e,t)=>uv(Pv,{displayQuestionIndex:s,active:g===e,appearance:n,num:e,setActiveNumber(e){_(e),r.skipSubmitButton&&m(e)}},t)))})]}),!v&&uv("div",{className:"rating-text",children:[uv("div",{children:r.lowerBoundLabel}),uv("div",{children:r.upperBoundLabel})]})]})]}),uv(bv,{text:r.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:ee(g)&&!r.optional,appearance:n,onSubmit:()=>o(g),onPreviewSubmit:()=>a(g),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function Pv(e){var t=e.num,r=e.setActiveNumber;return uv("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 Rv(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,s=e.appearance,n=e.onSubmit,o=e.onPreviewSubmit,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=kg(null),d=Cg((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=G_(t,j_(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),h=Sg((()=>((e,t)=>J(e)||Ev(e)?e:t===Wg.SingleChoice?null:[])(a,t.type))),p=h[0],g=h[1],v=Sg((()=>((e,t)=>{if(J(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Ev(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(a,d))),f=v[0],m=v[1],y=J_().isPreviewMode,b=t.type===Wg.SingleChoice,S=t.type===Wg.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m((e=>_({},e,{isSelected:r,inputValue:r?e.inputValue:""}))),b&&g(""),void(r&&setTimeout((()=>{var e;return null==(e=c.current)?void 0:e.focus()}),75))}if(b)return g(e),m((e=>_({},e,{isSelected:!1,inputValue:""}))),void(w&&(n(e),y&&o(e)));S&&G(p)&&(p.includes(e)?g(p.filter((t=>t!==e))):g([...p,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>_({},e,{inputValue:t}))),b&&g(t)},x=e=>{e.stopPropagation(),"Enter"!==e.key||E()||(e.preventDefault(),I()),"Escape"===e.key&&(e.preventDefault(),m((e=>_({},e,{isSelected:!1,inputValue:""}))),b&&g(null))},E=()=>!(t.optional||!ee(p)&&(!G(p)||f.isSelected||0!==p.length)&&(!f.isSelected||""!==f.inputValue.trim())),I=()=>{f.isSelected&&S?G(p)&&(y?o([...p,f.inputValue]):n([...p,f.inputValue])):y?o(p):n(p)};return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:t,forceDisableHtml:r}),uv("fieldset",{className:"multiple-choice-options limit-height",children:[uv("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),d.map(((e,r)=>{var s=!!t.hasOpenChoice&&r===t.choices.length-1,n="surveyQuestion"+i+"Choice"+r,o=n+"Open",a=s?f.isSelected:b?p===e:G(p)&&p.includes(e);return uv("label",{className:s?"choice-option-open":"",children:[uv("div",{className:"response-choice",children:[uv("input",{type:b?"radio":"checkbox",name:n,checked:a,onChange:()=>k(e,s),id:n,"aria-controls":o}),uv("span",{children:s?e+":":e})]}),s&&uv("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:x,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:E(),appearance:s,onSubmit:I,onPreviewSubmit:I,skipSubmitButton:w,canGoBack:l,onBack:u})]})}var Fv=[1,2,3,4,5],Lv=[1,2,3,4,5,6,7],Av=[0,1,2,3,4,5,6,7,8,9,10],Ov={2:[_v,vv],3:[hv,dv,cv],5:[pv,hv,dv,cv,gv]};function Dv(e){switch(e){case 5:default:return Fv;case 7:return Lv;case 10:return Av}}var Nv=Zr("[Surveys]");function Bv(e,t,r){var i,s=e.questions[t],n=t+1;if(null==(i=s.branching)||!i.type)return t===e.questions.length-1?Ug.End:n;if(s.branching.type===Ug.End)return Ug.End;if(s.branching.type===Ug.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Ug.ResponseBased){if(s.type===Wg.SingleChoice){var o,a=s.choices.indexOf(""+r);if(-1===a&&s.hasOpenChoice&&(a=s.choices.length-1),null!=(o=s.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=s.branching.responseValues[a];return Number.isInteger(l)?l:l===Ug.End?Ug.End:n}}else if(s.type===Wg.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,s.scale);if(null!=(u=s.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=s.branching.responseValues[c];return Number.isInteger(d)?d:d===Ug.End?Ug.End:n}}return n}return Nv.warn("Falling back to next question index due to unexpected branching type"),n}var qv=Zr("[SurveyTranslations]");function Hv(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,s=ka(e.overrideLanguage);if(s)return null==t||t.info("Using override display language: "+s),s;var n=function(e){return e&&"object"==typeof e&&"language"in e?ka(e.language):null}(r);if(n)return null==t||t.info("Using person property language: "+n),n;var o=ka(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(un):void 0,locale:Ya()},qv)}(t);if(!r)return qv.info("No user language detected"),{survey:e,language:null};var i=Ia(e,r,qv);return{survey:i.survey,language:i.matchedKey}}var $v=-1,Wv=e,Uv=i,zv="ph:show_survey_widget",Vv="PHWidgetSurveyClickListener";function jv(e,t){try{var r=e.getBoundingClientRect(),i=Wv.innerHeight,s=Wv.innerWidth,n=r.left+r.width/2-t/2;n+t>s-20&&(n=s-t-20),20>n&&(n=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:n+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:N_.zIndex}}catch(e){return Qg.warn("Failed to calculate trigger position:",e),null}}class Gv{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this.handlePageUnload=()=>{var e=this._posthog.get_property(hn);if(e)for(var t of e)sv(t)&&V_(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var s,n,o,a,l,u=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==u&&u,d=t._translateSurveyForRendering(e),h=d.survey,p=d.language;t._currentLanguage=p,t._surveyPopupProps=null,t._displayOptions=r;var g=t._applyDisplayOverrides(h,r);t._clearSurveyTimeout(g.id);var v=null!=r?r:{},f=v.properties,m=v.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(g,m,f,p);if(!y||null!=(s=g.appearance)&&s.displayThankYouMessage){t._addSurveyToFocus(g);var b={};if((null==(n=g.appearance)?void 0:n.position)===qg.NextToTrigger&&null!=(o=g.appearance)&&o.widgetSelector){var S,w=Uv.querySelector(g.appearance.widgetSelector);w&&(b=jv(w,parseInt((null==(S=g.appearance)?void 0:S.maxWidth)||N_.maxWidth))||{})}var k=(null==(a=g.appearance)?void 0:a.surveyPopupDelaySeconds)||0,C=$_(g,t._posthog).shadow;t._renderedTargets.set(C,C.host);var x={posthog:t._posthog,survey:g,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:p};if(t._surveyPopupProps=x,0>=k)return t._surveyIsRendered=!0,og(uv(Jv,_({},x)),C);var E=()=>{if(!t._shouldDisplaySurvey(g))return Qg.info("Survey "+g.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(g);(()=>{t._surveyIsRendered=!0;var i=t._translateSurveyForRendering(e),s=i.survey,n=i.language;t._currentLanguage=n;var o=t._applyDisplayOverrides(s,r),a=_({},x,{survey:o,surveyLanguage:n});t._surveyPopupProps=a,og(uv(Jv,_({},a,{survey:_({},o,{appearance:_({},o.appearance,{surveyPopupDelaySeconds:0})})})),C)})()},I=c?null==(l=t._posthog.surveys)||null==(l=l._surveyEventReceiver)||null==l.getActivationTimestamp?void 0:l.getActivationTimestamp(g.id):void 0,T=re(I)?Math.max(0,Date.now()-I):0,M=Math.max(0,1e3*k-T);if(0>=M)return E();var P=Wv.setTimeout((()=>{t._surveyTimeouts.delete(g.id),E()}),M);t._surveyTimeouts.set(g.id,P)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=$_(r,this._posthog),n=s.shadow,o=s.isNewlyCreated;this._renderedTargets.set(n,n.host),o&&og(uv(ef,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),n)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Vv),this._widgetSelectorListeners.delete(e),Qg.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=Uv.querySelector(ov(e,!0));return!(null==r||null==(t=r.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=Uv.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;Qg.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(Vv)){var s=t=>{var r,i;t.stopPropagation();var s=(null==(r=e.appearance)?void 0:r.position)===qg.NextToTrigger?jv(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||N_.maxWidth)):{};Wv.dispatchEvent(new CustomEvent(zv,{detail:{surveyId:e.id,position:s}}))};oi(r,"click",s),r.setAttribute(Vv,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:s,survey:e}),Qg.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,s=$_(r,this._posthog).shadow;this._renderedTargets.set(s,s.host),og(uv(Jv,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,r)=>{var i,s=this._translateSurveyForRendering(e),n=s.survey,o=s.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(n,o,r)),og(uv(Jv,{posthog:this._posthog,survey:n,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===$g.Popover||e.type===$g.Widget)),i=new Set(r.map((e=>e.id)));for(var s of Array.from(t._surveyTimeouts.keys()))i.has(s)||t.cancelSurvey(s);var n=t._sortSurveysByAppearanceDelay(r),o=new Set;n.forEach((e=>{if(e.type===$g.Widget){var r,i,s,n;if((null==(r=e.appearance)?void 0:r.widgetType)===Bg.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Bg.Selector&&null!=(s=e.appearance)&&s.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(n=e.appearance)?void 0:n.widgetSelector))}ee(t._surveyInFocus)&&e.type===$g.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)||Qg.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&Qg.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),oi(Wv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags((()=>this._onLanguageChange()))}_onLanguageChange(){if(!ee(this._surveyInFocus)){var e=this._posthog.get_property(hn),t=null==e?void 0:e.find((e=>e.id===this._surveyInFocus));if(t){var r=this._translateSurveyForRendering(t),i=r.survey,s=r.language;if(s!==this._currentLanguage&&(this._currentLanguage=s,this._surveyIsRendered)){var n=this._applyDisplayOverrides(i,this._displayOptions),o=$_(n,this._posthog).shadow;og(uv(Jv,_({},this._surveyPopupProps,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),o)}}}}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,s_))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return null!=t&&t.position||null!=t&&t.selector?_({},e,{appearance:_({},e.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(Qg.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(Wv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach(((e,t)=>this._clearSurveyTimeout(t))),this._widgetSelectorListeners.forEach(((e,t)=>this._detachWidgetSelectorListener(t))),this._renderedTargets.forEach(((e,t)=>{og(null,t),null==e||e.remove()})),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,s=sv(e),n=sv(t);if(s&&!n)return-1;if(!s&&n)return 1;var o=e.schedule===zg,a=t.schedule===zg;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 Hv(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=e.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var s=i.split("&");for(var n of s){var o=n.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}}(Wv.location.search),s=i.params;if(0===Object.keys(s).length)return!1;Qg.info("[Survey Prefill] Detected URL prefill parameters");var n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,r,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var s=t.responses,n=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&W_({responses:o?s:a,survey:e,surveySubmissionId:n,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var s={};for(var n of Object.entries(t)){var o=n[1];s[parseInt(n[0])]=G(o)?o.map(String):[String(o)]}Qg.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,s,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 s=t[i],n=ya(e.id);try{switch(e.type){case Wg.SingleChoice:if(!e.choices||0===e.choices.length)return void Kr.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(s[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void Kr.warn("[Survey Prefill] Invalid choice index for q"+i+": "+s[0]);r[n]=e.choices[o];break;case Wg.MultipleChoice:if(!e.choices||0===e.choices.length)return void Kr.warn("[Survey Prefill] Question "+i+" has no choices");var a=s.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void Kr.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&Kr.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[n]=l;break;case Wg.Rating:var u=parseInt(s[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void Kr.warn("[Survey Prefill] Invalid rating for q"+i+": "+s[0]+" (scale: 0-"+c+")");r[n]=u;break;default:Kr.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){Kr.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return Qg.warn("[Survey Prefill] No valid responses after conversion"),null;var s=d_(),n=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,s={},n=[],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=ya(l.id);Y(r[u])||(s[u]=r[u])}n.push(i);var c=Bv(e,i,l.id?r[ya(l.id)]:null);if(c===Ug.End)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:n};i=c}return{startQuestionIndex:i,skippedResponses:s,skippedIndices:n}}(e,n,i),a=o.startQuestionIndex,l=o.skippedResponses,u=o.skippedIndices,c=a>=e.questions.length;return rv(e,{surveySubmissionId:s,responses:i,lastQuestionIndex:a,questionOrder:Q_(e.questions),visitedIndices:u,surveyLanguage:r}),Qg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:s,startQuestionIndex:a,isSurveyCompleted:c,skippedResponses:l}}catch(e){return Qg.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-")})),s=!0;return t&&(s=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&s}_isSurveyConditionMatched(t){return!t.conditions||ev(t,this._posthog)&&function(t){var i,s;return function(t,i){var s,n,o;if(!t||0===t.length)return!0;if(!u)return!1;var a=It(u,{userAgentDataPlatform:null==r||null==(s=r.userAgentData)?void 0:s.platform,maxTouchPoints:null==r?void 0:r.maxTouchPoints,screenWidth:null==e||null==(n=e.screen)?void 0:n.width,screenHeight:null==e||null==(o=e.screen)?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return Fa[null!=i?i:"icontains"](t,[a])}(null==(i=t.conditions)?void 0:i.deviceTypes,null==(s=t.conditions)?void 0:s.deviceTypesMatchType)}(t)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==O_||!O_.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return Z_(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(!Kg(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!r_.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 s=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,s))return i.eligible=!1,i.reason=s?"Survey linked feature flag is not enabled for variant "+s:"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 n,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,s=Math.abs(i.getTime()-r.getTime());return Math.ceil(s/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,m_._get("lastSeenSurveyDate"))?(e=>!!m_._get(e_(e))&&!Z_(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!==(n=o.reason)&&void 0!==n?n:"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(!Ta(e)&&!Zg(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=Uv.querySelector(ov(e,!0));null!=t&&t.shadowRoot&&(og(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){Qg.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),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}}function Qv(e,t){if(Uv&&Wv){var r,i=new Gv(e);if(e.config.disable_surveys_automatic_display)return Qg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return Qg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var s=()=>{Y(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))},n=()=>{Y(r)||(clearInterval(r),r=void 0)};s();var o=()=>{Uv.hidden?n():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return oi(Uv,"visibilitychange",o),i.setAutomaticDisplayDispose((()=>{n(),Uv.removeEventListener("visibilitychange",o)})),i}}function Kv(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,s=e.setSurveyVisible,n=e.isPreviewMode,o=void 0!==n&&n,a=e.posthog;wg((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===$g.Widget,n=ev(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===Bg.Tab&&r;if(!n)return Qg.info("Hiding survey "+t.id+" because URL does not match"),s(!1),i(t);o&&(Qg.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),s(!0))};oi(Wv,"popstate",r),oi(Wv,"hashchange",r);var n=Wv.history.pushState,l=Wv.history.replaceState;return Wv.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];n.apply(this,t),r()},Wv.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()},()=>{Wv.removeEventListener("popstate",r),Wv.removeEventListener("hashchange",r),Wv.history.pushState=n,Wv.history.replaceState=l}}}),[o,t,i,s,a])}var Zv=200;function Yv(e){switch(void 0===e&&(e=Hg.Right),e){case Hg.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Hg.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Hg.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Jv(e){var t,r,i,s,n,o,a,l,u,c,d,h,p=e.survey,g=e.forceDisableHtml,v=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,x=void 0===C?()=>{}:C,E=e.onPreviewBack,I=void 0===E?()=>{}:E,T=e.onPopupSurveyDismissed,M=void 0===T?()=>{}:T,P=e.onCloseConfirmationMessage,R=void 0===P?()=>{}:P,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=kg(null),N=Number.isInteger(y),B=null!=(t=p.appearance)&&t.surveyPopupDelaySeconds?1e3*p.appearance.surveyPopupDelaySeconds:0,q=function(e,t,r,i,s,n,o,a,l){var u=Sg(i||0===r||e.type===$g.ExternalSurvey),c=u[0],d=u[1],h=Sg(!1),p=h[0],g=h[1],v=kg(!1),f=()=>{var t=()=>{n&&s(e),d(!1)};if(!v.current){var r=null==o?void 0:o.current;r?(v.current=!0,r.style.transition="opacity "+Zv+"ms ease-out",r.style.opacity="0",setTimeout((()=>{v.current=!1,t()}),Zv+50)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return wg((()=>{if(t){if(!i){var s,n=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(ev(e,t)){d(!0),Wv.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(Vg.SHOWN,_({[jg.SURVEY_NAME]:e.name,[jg.SURVEY_ID]:e.id,[jg.SURVEY_ITERATION]:e.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[jg.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){}}};oi(Wv,"PHSurveyClosed",m),oi(Wv,"PHSurveySent",n);var u=r>0?setTimeout(o,r):void 0;return Y(u)&&o(),()=>{Y(u)||clearTimeout(u),Y(s)||clearTimeout(s),Wv.removeEventListener("PHSurveyClosed",m),Wv.removeEventListener("PHSurveySent",n)}}}else Qg.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Kv({survey:e,removeSurveyFromFocus:s,setSurveyVisible:d,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:p,setIsPopupVisible:d,hidePopupWithAnimation:f}}(p,v,B,N,S,k,D,A,O),H=q.isPopupVisible,W=q.hidePopupWithAnimation,U=q.isSurveySent||y===p.questions.length||!0===L,z=Sg(!1),V=z[0],j=z[1],G=Cg((()=>!!iv(p)),[p]),Q=!!(null!=(r=p.appearance)&&r.introScreenHeader||null!=(i=p.appearance)&&i.introScreenDescription),K=N?y===$v:!(null==(s=p.appearance)||!s.displayIntroScreen)&&Q&&!V&&!G,Z=Cg((()=>{var e=iv(p),t=(null==e?void 0:e.surveySubmissionId)||d_();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?z_(p,v,N,O):z_(p,v,N),M()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:x,onPreviewBack:I,posthog:v,properties:F,surveyLanguage:O}}),[N,y,k,v,p,M,x,I,F,O]);return H?uv(Y_.Provider,{value:Z,children:uv("div",{className:"ph-survey",style:_({},av(p.type,null==(n=p.appearance)?void 0:n.position,null==(o=p.appearance)?void 0:o.widgetType),m),ref:D,children:U?uv(Cv,{header:(null==(a=p.appearance)?void 0:a.thankYouMessageHeader)||"Thank you!",description:(null==(l=p.appearance)?void 0:l.thankYouMessageDescription)||"",forceDisableHtml:!!g,contentType:null==(u=p.appearance)?void 0:u.thankYouMessageDescriptionContentType,appearance:p.appearance||N_,onClose(){W(),R()}}):K?uv(xv,{header:(null==(c=p.appearance)?void 0:c.introScreenHeader)||"",description:(null==(d=p.appearance)?void 0:d.introScreenDescription)||"",forceDisableHtml:!!g,contentType:null==(h=p.appearance)?void 0:h.introScreenDescriptionContentType,appearance:p.appearance||N_,onStart:()=>j(!0)}):uv(Xv,{survey:p,forceDisableHtml:!!g,posthog:v})})}):null}function Xv(e){var t,r,i=e.survey,s=e.forceDisableHtml,n=e.posthog,o=Cg((()=>{var e=iv(i);if(!e)return null;var t=re(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(nv(i),null)}),[i]),a=Sg((()=>(null!=o&&o.responses&&Qg.info("Survey is already in progress, filling in initial responses"),(null==o?void 0:o.responses)||{}))),l=a[0],u=a[1],c=xg(Y_),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,g=c.onPreviewSubmit,v=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=Sg((()=>{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=Sg((()=>{var e;return(null!==(e=null==o?void 0:o.visitedIndices)&&void 0!==e?e:[]).filter((e=>e>=0&&i.questions.length>e))})),x=C[0],E=C[1],I=Sg((()=>{var e,t=iv(i);return null!==(e=null==t?void 0:t.questionSnapshots)&&void 0!==e?e:{}})),T=I[0],M=I[1],P=Cg((()=>Q_(K_(i,o))),[i.id,o]),R=Cg((()=>{if(!P||new Set(P).size!==P.length)return K_(i,o);var e=new Map(i.questions.map((e=>[e.id,e]))),t=P.map((t=>e.get(t))).filter((e=>!!e));return t.length===P.length?t:i.questions}),[P,i.questions,i,o]);wg((()=>{!m||Y(d)||0>d||k(d)}),[d,m]);var F=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=d?d:0)>0:x.length>0),L=R.at(w);return L?uv("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&uv(wv,{onClick(){h()}}),uv("div",{className:"survey-box","data-question-index":w,children:tf({question:L,forceDisableHtml:s,displayQuestionIndex:w,appearance:i.appearance||N_,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,s=e.questionId;if(n)if(s){var o=ya(s),a=_({},l,{[o]:t});u(a);var c=R[r],d=null!=c&&c.id?_({},T,{[c.id]:c.question}):T;M(d);var h=Bv(i,r,t),p=h===Ug.End,g=[...x,r];if(p||(E(g),k(h),rv(i,{surveySubmissionId:f,responses:a,lastQuestionIndex:h,questionOrder:Q_(R),visitedIndices:g,surveyLanguage:b,questionSnapshots:d})),i.enable_partial_responses||p){var v=new Set(g.map((e=>{var t;return null==(t=R[e])?void 0:t.id})).filter((e=>!!e)).map((e=>ya(e)))),m=Object.fromEntries(Object.entries(a).filter((e=>v.has(e[0]))));W_({responses:m,survey:i,surveySubmissionId:f,isSurveyCompleted:p,posthog:n,properties:y,surveyLanguage:b,questionSnapshots:d})}}else Qg.error("onNextButtonClick called without a questionId.");else Qg.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:L.id}),onPreviewSubmit:g,initialValue:L.id?l[ya(L.id)]:void 0,canGoBack:F,onBack(){if(m)v();else if(0!==x.length){var e=x[x.length-1],t=x.slice(0,-1);E(t),k(e),rv(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:e,questionOrder:Q_(R),visitedIndices:t,surveyLanguage:b,questionSnapshots:T})}}})})]}):null}function ef(e){var t,r,i,s,n,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=Sg(!0),g=p[0],_=p[1],v=Sg(!1),f=v[0],m=v[1],y=Sg({}),b=y[0],S=y[1],w=kg(void 0),k=()=>{m(!f)};if(wg((()=>{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&&(Qg.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return oi(Wv,zv,t),()=>{Y(w.current)||(clearTimeout(w.current),w.current=void 0),Wv.removeEventListener(zv,t)}}}else Qg.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]),Kv({survey:l,setSurveyVisible:_,posthog:c}),!g)return null;var C=()=>{l.schedule!==zg&&_(!1),Y(w.current)||clearTimeout(w.current),w.current=setTimeout((()=>{w.current=void 0,m(!1)}),200)};return uv(Hp,{children:["tab"===(null==(s=l.appearance)?void 0:s.widgetType)&&uv("button",{className:"ph-survey-widget-tab "+((null==(n=l.appearance)?void 0:n.tabPosition)===Hg.Top?"widget-tab-top":""),onClick:k,disabled:d,style:Yv(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&uv(Jv,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var tf=e=>{var t=e.question,r=e.onSubmit,i=e.onPreviewSubmit,s={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 Wg.Open:return Bp(Iv,_({},s,{question:t,key:t.id}));case Wg.Link:return Bp(Tv,_({},s,{question:t,key:t.id}));case Wg.Rating:return Bp(Mv,_({},s,{question:t,key:t.id}));case Wg.SingleChoice:case Wg.MultipleChoice:return Bp(Rv,_({},s,{question:t,key:t.id}));default:return Qg.error("Unsupported question type: "+t.type),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Qv,h.extendPostHogWithSurveys=Qv;var rf=e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e},sf=1e4,nf=(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),of=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return nf(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var s=0,n=Math.min(e.length,r.remaining-2);n>s;){var o=Math.ceil((s+n)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?n=o-1:s=o}return nf(t,JSON.stringify(e.slice(0,s)),r)},af=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,lf=(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}},uf=(e,t,r)=>{if(!r.truncated)if(K(e)){if(r.seen.has(e))return void lf(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(uf(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else lf(t,e,r)},cf=function(e,t,r,i,s,n){if(void 0===s&&(s=!1),!af(e))return!s||nf(t,"null",r);if(ee(e)||(e=>{try{return re(e)||se(e)}catch(e){return!1}})(e))return nf(t,JSON.stringify(e),r);if("string"==typeof e)return of(e,t,r);if(!K(e)&&!G(e))return nf(t,JSON.stringify(e),r);if(i.has(e))return of("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Q(o))return cf(o.call(e),t,r,i,s)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return of(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return nf(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 cf(l,t,r,i,s,n)}if(G(e)){if(!nf(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!nf(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!cf(d,t,r,i,!0))return!1}return nf(t,"]",r)}if(!nf(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 g=void 0;try{g=e[p]}catch(e){continue}if(n)try{uf(g,p,n)}catch(e){}if(af(g)){var _=(h?"":",")+JSON.stringify(p)+":";if(_.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!nf(t,_,r))return!1;var y=t.length,b=cf(g,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return nf(t,"}",r)},df=(e,t)=>{for(var r=[],i={remaining:t,truncated:!1},s=K(e[0])?{result:{},keysRemaining:50,sizeRemaining:sf,truncated:!1,seen:new WeakSet([e[0]])}:void 0,n=0;e.length>n&&(0>=n||nf(r," ",i))&&cf(e[n],r,i,new WeakSet,!1,0===n?s:void 0);n++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==s?void 0:s.result)||{}}},hf={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},pf=e=>"canCapture"in e,gf=e=>pf(e)?e.canCapture?e.getExtension(n_):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},s=!1,n=function(e){var n=h.console[e];r.push(zh(h.console,e,(r=>{var o=(r=>function(){for(var n=!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&&!s&&u){var c=gf(u);if(c){s=!0,n=!0;var d=df(a,sf),p=d.body,g=d.attributes,v=_({},i,d.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(pf(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),s=i?t[i]:void 0;Q(s)&&s.call(t,r)}})(u,c,{level:hf[e],body:p,attributes:_({"log.source":"console."+e},v,g)})}}}catch(e){}finally{n&&(s=!1),r.apply(h.console,a)}})(r);return o.__rrweb_original__=rf(n),o})))};for(var o of Object.keys(hf))n(o);return()=>{t=void 0,r.forEach((e=>e()))}},replayConsoleBuffer(e,t){var r=gf(e);if(r)for(var i of t)try{var s=df(i.args,sf);null==r.captureBufferedConsoleLog||r.captureBufferedConsoleLog({level:hf[i.level],body:s.body,attributes:_({"log.source":"console."+i.level,host:h.location.host},s.truncated?{body_truncated:"true"}:{},s.attributes)},i.context,i.occurredAtMs)}catch(e){}}};var _f=Zr("[Error tracking]"),vf="webkit-masked-url:",ff=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",vf],mf=["__firefox__","__gCrWeb"];function yf(){return new vr([new Mr,new qr,new Rr,new Pr,new Nr,new Dr,new Lr,new Br],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 s=[],n=t.split("\n"),o=i;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Ir.test(a)?a.replace(Ir,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){s.push(c);break}}if(s.length>=Tr)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Tr).map((e=>{return _({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||fr});var r}))}(s)}}("web:javascript",kr,Er))}var bf=Zr("[ExceptionAutocapture]"),Sf=yf(),wf=t=>{var r=e;r||bf.info("window not available, cannot wrap onerror");var i=r.onerror;return r.onerror=function(){for(var e,r=arguments.length,s=new Array(r),n=0;r>n;n++)s[n]=arguments[n];var o=Sf.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4];if(null!=n)return n;if(J(t)&&J(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:s})}catch(e){return t}return t})(s),{mechanism:{handled:!1}});return t(o),!!Q(i)&&null!==(e=i(...s))&&void 0!==e&&e},r.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=r.onerror)||delete e.__POSTHOG_INSTRUMENTED__,r.onerror=i}},kf=function(t,r){void 0===r&&(r=!1);var i=e;i||bf.info("window not available, cannot wrap onUnhandledRejection");var s=i.onunhandledrejection;return i.onunhandledrejection=function(e){var i,n=Sf.buildFromUnknown(e,{mechanism:{handled:!1}});return t(n),Q(s)?null!==(i=s(e))&&void 0!==i&&i:r},i.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=i.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,i.onunhandledrejection=s}},Cf={wrapOnError:wf,wrapUnhandledRejection:kf,wrapConsoleError(e){var t=console;t||bf.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,s=new Array(i),n=0;i>n;n++)s[n]=arguments[n];t=1==s.length?s[0]:s.join(" ");var o=s.find((e=>e instanceof Error)),a=Sf.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),Q(r)&&r(...s)},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=Cf,h.posthogErrorWrappingFunctions=Cf;var xf=(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){bf.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e}),[]):[],s=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){bf.error("Failed to capture exception for a legacy client",e)}};wf((e=>{i.some((t=>e.$exception_list.some((e=>t.test(e.value||"")))))||s(e)})),kf(s,!0)}};h.extendPostHogWithExceptionAutoCapture=xf,h.extendPostHogWithExceptionAutocapture=xf;var Ef="X-POSTHOG-SESSION-ID",If="X-POSTHOG-WINDOW-ID",Tf="X-POSTHOG-DISTINCT-ID",Mf=[Ef,If,Tf],Pf=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Rf=(e,t)=>({}.hasOwnProperty.call(e,t)),Ff=e=>"object"==typeof e&&!ee(e)||Q(e),Lf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Af=t=>{try{var r;return Lf(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}},Of=(e,t,r,i,s)=>{var n;try{n=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(G(e)&&!e.includes(n))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;s.set(Ef,a.sessionId),s.set(If,l),o=!0}var u=(e=>Q(e)?e():e)(t);return u&&u!==Mn&&(s.set(Tf,u),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};var Df={_patchFetch:(t,r,i)=>zh(e,"fetch",(e=>function(s,n){var o=arguments.length>1?[s,n]:[s],a=o;try{var l=Af(s);if(l)if(Lf(s)){var u=new Request(s,n);Of(t,r,i,u.url,u.headers),a=[u]}else{var c=new Headers(Ff(n)?n.headers:void 0);if(Of(t,r,i,l,c)){var d=((e,t)=>{if(Y(e)||ee(e))return{headers:t};if(Ff(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)=>Rf(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>Rf(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach((e=>t.add(e))),Pf.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&&Pf.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var s=Reflect.getOwnPropertyDescriptor(r,t);return s?_({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(n,c);d&&(a=[s,d])}}}catch(e){a=o}return e.apply(this,a)})),_patchXHR:(t,r,i)=>zh(e.XMLHttpRequest.prototype,"open",(e=>function(s,n,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=Af(n);d&&Of(t,r,i,d,c);var h=e.call(u,s,n,o,a,l);return Mf.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};h.__PosthogExtensions__.tracingHeadersPatchFns=Df,h.postHogTracingHeadersPatchFns=Df,"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 Nf=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 Bf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},qf=e=>{if("loading"===document.readyState)return"loading";var t=Bf();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"},Hf=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$f=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,s=e,n=s.id?"#"+s.id:[Hf(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},Wf=new WeakMap;function Uf(e,t){var r=Wf.get(t);return r||(r=new WeakMap,Wf.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var zf=-1,Vf=()=>zf,jf=e=>{addEventListener("pageshow",(t=>{t.persisted&&(zf=t.timeStamp,e(t))}),!0)},Gf=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Qf=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Kf=()=>{var e,t;return null!==(e=null==(t=Bf())?void 0:t.activationStart)&&void 0!==e?e:0},Zf=-1,Yf=new Set,Jf=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Xf=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Yf)t();isFinite(Zf)||(Zf="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Xf,!0))}},em=function(e){if(void 0===e&&(e=!1),e&&(Zf=1/0),0>Zf){var t,r=Kf(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Zf=null!=i?i:Jf(),addEventListener("visibilitychange",Xf,!0),addEventListener("prerenderingchange",Xf,!0),jf((()=>{setTimeout((()=>{Zf=Jf()}))}))}return{get firstHiddenTime(){return Zf},onHidden(e){Yf.add(e)}}},tm=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Bf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Vf()?a&&(document.prerendering||Kf()>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:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},rm=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var s=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 n of i)s.observe(_({type:n,buffered:!0},r));return s}}catch(e){}},im=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},sm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},nm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};class om{constructor(){this.u=void 0}}var am,lm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},um=[1800,3e3],cm=function(e,t){void 0===t&&(t={});var r=im(t);lm((()=>{var i,s=Uf(t,om),n=em(),o=tm("FCP"),a=rm(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Kf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=Gf(e,o,um,t.reportAllChanges),jf((r=>{o=tm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Vf()),i=Gf(e,o,um,t.reportAllChanges),Qf((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&rm(["soft-navigation"],(r=>{r.forEach((r=>{s.u&&r.navigationId&&sm(s.u,r);var n=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=tm("FCP",n,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Gf(e,o,um,t.reportAllChanges))(!0)}))}),t)}))},dm=[.1,.25],hm=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],pm=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),Nf),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var s=hm(e.sources),n=null==s?void 0:s.node;if(n){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(n))&&void 0!==o?o:$f(n);i.set(s,a)}}},function(e,t){void 0===t&&(t={});var r=em();cm(nm((()=>{var i,s=tm("CLS",0),n=Uf(t,Nf),o=(r,o,a,l,u)=>{s=tm("CLS",0,r,o,a,l,u),n.o=0,i=Gf(e,s,dm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.o>s.value&&(s.value=n.o,s.entries=n.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?n.l(t):l(t);a()},c=["layout-shift"];im(t)&&c.push("soft-navigation");var d=rm(c,u);d&&(i=Gf(e,s,dm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),jf((()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Vf()),Qf(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,s=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=s&&null!=(r=s.sources)&&r.length){var n=hm(s.sources);n&&(t={largestShiftTarget:i.get(n),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:n,largestShiftEntry:s,loadState:qf(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},gm=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),om);im(t)&&(r.u=new Map),cm((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:qf(Vf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=Bf(),s=e.entries.at(-1);if(i){var n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:qf(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}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)},_m=0,vm=1/0,fm=0,mm=e=>{for(var t of e)t.interactionId&&(vm=Math.min(vm,t.interactionId),fm=Math.max(fm,t.interactionId),_m=fm?(fm-vm)/7+1:0)},ym=()=>{var e;return am?_m:null!==(e=performance.interactionCount)&&void 0!==e?e:0};let bm=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return ym()-this.h}D(){this.h=ym(),this.v.length=0,this.p.clear()}S(e){var t=this.T(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{k:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.p.get(e.interactionId);if(i||10>this.v.length||e.duration>r.k){var s;if(i?e.duration>i.k?(i.entries=[e],i.k=e.duration):e.duration===i.k&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.p.set((i={id:e.interactionId,entries:[e],k:e.duration}).id,i),this.v.push(i)),this.v.sort(((e,t)=>t.k-e.k)),this.v.length>10){var n=this.v.splice(10);for(var o of n)this.p.delete(o.id)}null==(s=this.M)||s.call(this,i)}}}};var Sm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=nm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()}),{timeout:t})}},wm=[200,500],km=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),bm),i=[],s=[],n=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(Sm(c),l=!0)},c=()=>{var e=new Set(r.v.map((e=>o.get(e.entries[0])))),t=s.length-10;s=s.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of s){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>n||a.has(e))),l=!1};r.m=e=>{var r,i=e.startTime+e.duration;n=Math.max(n,e.processingEnd);for(var a=s.length-1;a>=0;a--){var l=s[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||s.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),e.interactionId&&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 s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==s?s:$f(i);a.set(e,n)}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 s of i)if(s.startTime+s.duration>=e){if(s.startTime>t)break;r.push(s)}return r};rm(["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=em();lm((()=>{var i;"interactionCount"in performance||am||(am=rm(["event"],mm,{durationThreshold:0}));var s,n=tm("INP"),o=Uf(t,bm),a=(r,i,a,l,u)=>{o.D(),n=tm("INP",-1,r,i,a,l,u),s=Gf(e,n,wm,t.reportAllChanges)},l=()=>{var e=o.S(n.navigationType);e&&e.k!==n.value&&(n.value=e.k,n.entries=e.entries,s())},u=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),Sm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.l(r):u(r);l(),t&&s(!0)}))},d=["event","first-input"];im(t)&&d.push("soft-navigation");var h=rm(d,c,_({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Gf(e,n,wm,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),jf((()=>{a("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Vf())})))}))}}((t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:qf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],s=o.get(i),n=Math.max(s.processingStart,i.startTime),l=Math.max(i.startTime+i.duration,n),u=Math.min(s.processingEnd,l),c=s.entries.sort(((e,t)=>e.processingStart-t.processingStart)),h=d(i.startTime,u),p=r.p.get(i.interactionId),g={interactionTarget:a.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:h,inputDelay:n-i.startTime,processingDuration:u-n,presentationDelay:l-u,loadState:qf(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 s,n,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 g=p.startTime+p.duration;if(g>=r){var _=g-Math.max(r,p.startTime),v=p.duration?_/p.duration*p.forcedStyleAndLayoutDuration:0;l+=_-v,u+=v,_>d&&(n=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",s=p,d=_)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(c=i-m),s&&n&&(e.longestScript={entry:s,subpart:n,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=c,e.totalUnattributedDuration=i-r-l-u-c}})(g),Object.assign(e,{attribution:g})})(t))}),t)};let Cm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null==(t=this.m)||t.call(this,e)}};var $=[2500,4e3],xm=50,Em=[];rm(["resource"],(e=>{for(var t of e)Em.push(t),Em.length>xm&&Em.shift()}));var Im=function(e,t){void 0===t&&(t={}),null!=(t=Object.assign({},t)).resourceBufferSize&&(xm=t.resourceBufferSize);var r=Uf(t,Cm),i=new WeakMap;im(t)&&(r.u=new Map),r.m=e=>{var r=e.element;if(r){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==s?s:$f(r);i.set(e,n)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=im(t);lm((()=>{var s,n=em(),o=tm("LCP"),a=Uf(t,Cm),l=(i,a,l,u,c)=>{o=tm("LCP",-1,i,a,l,u,c),s=Gf(e,o,$,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=em(!0))},u=e=>{a.u&&e.navigationId&&sm(a.u,e),r||s(!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-Kf(),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])}n.firstHiddenTime>d&&(o.value=l,o.entries=c,s())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=rm(d,c);if(h){s=Gf(e,o,$,t.reportAllChanges);var p=["keydown","click","visibilitychange"],g=e=>{if(e.isTrusted&&!r){var t=o.id;Sm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,g,{capture:!0});t===o.id&&(r=!0,s(!0))}}))}};for(var _ of p)addEventListener(_,g,{capture:!0});jf((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Vf()),s=Gf(e,o,$,t.reportAllChanges),Qf((()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,n,o,a,l,u,c=e.entries.at(-1),d=c.url&&(Em.findLast((e=>e.name===c.url))||performance.getEntriesByType("resource").findLast((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!==(s=null==(n=u=Bf())?void 0:n.activationStart)&&void 0!==s?s: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 g=Math.max(0,p-h),v=Math.max(g,d?(d.requestStart||d.startTime)-h:0),f=Math.min(e.value,Math.max(v,d?d.responseEnd-h:0));t=_({},t,{timeToFirstByte:g,resourceLoadDelay:v-g,resourceLoadDuration:f-v,elementRenderDelay:e.value-f,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))}),t)},Tm=-1,Mm=()=>Tm,Pm=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Tm=t.timeStamp,e(t))}),!0)},Rm=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Fm=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Lm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Am=()=>{var e,t;return null!==(e=null==(t=Lm())?void 0:t.activationStart)&&void 0!==e?e:0},Om=-1,Dm=new Set,Nm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Bm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Dm)t();isFinite(Om)||(Om="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Bm,!0))}},qm=function(e){if(void 0===e&&(e=!1),e&&(Om=1/0),0>Om){var t,r=Am(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Om=null!=i?i:Nm(),addEventListener("visibilitychange",Bm,!0),addEventListener("prerenderingchange",Bm,!0),Pm((()=>{setTimeout((()=>{Om=Nm()}))}))}return{get firstHiddenTime(){return Om},onHidden(e){Dm.add(e)}}},Hm=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Lm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Mm()?a&&(document.prerendering||Am()>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:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},$m=new WeakMap;function Wm(e,t){var r=$m.get(t);return r||(r=new WeakMap,$m.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Um{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 zm=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var s=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 n of i)s.observe(_({type:n,buffered:!0},r));return s}}catch(e){}},Vm=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},jm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Gm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};class Qm{constructor(){this.l=void 0}}var Km,Zm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ym=[1800,3e3],Jm=function(e,t){void 0===t&&(t={});var r=Vm(t);Zm((()=>{var i,s=Wm(t,Qm),n=qm(),o=Hm("FCP"),a=zm(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Am(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=Rm(e,o,Ym,t.reportAllChanges),Pm((r=>{o=Hm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Mm()),i=Rm(e,o,Ym,t.reportAllChanges),Fm((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&zm(["soft-navigation"],(r=>{r.forEach((r=>{s.l&&r.navigationId&&jm(s.l,r);var n=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=Hm("FCP",n,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Rm(e,o,Ym,t.reportAllChanges))(!0)}))}),t)}))},Xm=[.1,.25],ey=function(e,t){void 0===t&&(t={});var r=qm();Jm(Gm((()=>{var i,s=Hm("CLS",0),n=Wm(t,Um),o=(r,o,a,l,u)=>{s=Hm("CLS",0,r,o,a,l,u),n.i=0,i=Rm(e,s,Xm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.i>s.value&&(s.value=n.i,s.entries=n.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?n.h(t):l(t);a()},c=["layout-shift"];Vm(t)&&c.push("soft-navigation");var d=zm(c,u);d&&(i=Rm(e,s,Xm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),Pm((()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Mm()),Fm(i)})),setTimeout(i))})))},ty=0,ry=1/0,iy=0,sy=e=>{for(var t of e)t.interactionId&&(ry=Math.min(ry,t.interactionId),iy=Math.max(iy,t.interactionId),ty=iy?(iy-ry)/7+1:0)},ny=()=>{var e;return Km?ty:null!==(e=performance.interactionCount)&&void 0!==e?e:0};class oy{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return ny()-this.u}M(){this.u=ny(),this.v.length=0,this.m.clear()}L(e){var t=this._(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{P:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.m.get(e.interactionId);if(i||10>this.v.length||e.duration>r.P){var s;if(i?e.duration>i.P?(i.entries=[e],i.P=e.duration):e.duration===i.P&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.m.set((i={id:e.interactionId,entries:[e],P:e.duration}).id,i),this.v.push(i)),this.v.sort(((e,t)=>t.P-e.P)),this.v.length>10){var n=this.v.splice(10);for(var o of n)this.m.delete(o.id)}null==(s=this.T)||s.call(this,i)}}}}var ay=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Gm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()}),{timeout:t})}},ly=[200,500],uy=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=qm();Zm((()=>{var i;"interactionCount"in performance||Km||(Km=zm(["event"],sy,{durationThreshold:0}));var s,n=Hm("INP"),o=Wm(t,oy),a=(r,i,a,l,u)=>{o.M(),n=Hm("INP",-1,r,i,a,l,u),s=Rm(e,n,ly,t.reportAllChanges)},l=()=>{var e=o.L(n.navigationType);e&&e.P!==n.value&&(n.value=e.P,n.entries=e.entries,s())},u=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),ay((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.h(r):u(r);l(),t&&s(!0)}))},d=["event","first-input"];Vm(t)&&d.push("soft-navigation");var h=zm(d,c,_({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Rm(e,n,ly,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),Pm((()=>{a("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Mm())})))}))}};class cy{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null==(t=this.p)||t.call(this,e)}}var dy=[2500,4e3],hy=function(e,t){void 0===t&&(t={});var r=!1,i=Vm(t);Zm((()=>{var s,n=qm(),o=Hm("LCP"),a=Wm(t,cy),l=(i,a,l,u,c)=>{o=Hm("LCP",-1,i,a,l,u,c),s=Rm(e,o,dy,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=qm(!0))},u=e=>{a.l&&e.navigationId&&jm(a.l,e),r||s(!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-Am(),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])}n.firstHiddenTime>d&&(o.value=l,o.entries=c,s())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=zm(d,c);if(h){s=Rm(e,o,dy,t.reportAllChanges);var p=["keydown","click","visibilitychange"],g=e=>{if(e.isTrusted&&!r){var t=o.id;ay((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,g,{capture:!0});t===o.id&&(r=!0,s(!0))}}))}};for(var _ of p)addEventListener(_,g,{capture:!0});Pm((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Mm()),s=Rm(e,o,dy,t.reportAllChanges),Fm((()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)}))}))}}))},py={onLCP:Im,onCLS:pm,onFCP:gm,onINP:km,withoutAttribution:{onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=py,h.__PosthogExtensions__.postHogWebVitalsCallbacks=py,h.postHogWebVitalsCallbacks=py;var gy={onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=gy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=gy,h.postHogWebVitalsCallbacks=gy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>gy;var _y={onLCP:Im,onCLS:pm,onFCP:gm,onINP:km,withoutAttribution:{onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=_y,h.__PosthogExtensions__.postHogWebVitalsCallbacks=_y,h.postHogWebVitalsCallbacks=_y;var vy={onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=vy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=vy,h.postHogWebVitalsCallbacks=vy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>vy;class fy{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 my="$copy_autocapture",yy=Zr("[AutoCapture]");function by(e,t){return t.length>e?t.slice(0,e)+"...":t}function Sy(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ci(t));return t}function wy(t,r){var i,s,n=r.e,o=r.maskAllElementAttributes,a=r.maskAllText,l=r.elementAttributeIgnoreList,u=r.elementsChainAsString,c=r.disableCaptureUrlHashes;if(!Ci(t))return{props:{}};for(var d=[t],h=new Set([t]),p=t;p.parentNode&&!xi(p,"body")&&Ti>d.length;)if(Ii(p.parentNode)){var g=p.parentNode.host;if(h.has(g))break;h.add(g),d.push(g),p=g}else{if(!Ci(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var v,f,m=[],y={},b=!1,S=!1;if(Jr(d,(e=>{var t=Qi(e);if(xi(e,"a")){var r=e.getAttribute("href");b=!!(t&&r&&is(r))&&(c?Rt(r):r)}q(Ri(e),"ph-no-capture")&&(S=!0),m.push(function(e,t,r,i,s){void 0===s&&(s=!1);var n=e.tagName.toLowerCase(),o={tag_name:n};Oi.indexOf(n)>-1&&!r&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?by(1024,ss(e)):by(1024,Li(e)));var a=Ri(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),Jr(e.attributes,(function(r){var n;if((!Ki(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&is(r.value)&&(!J(n=r.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=r.value;"class"===r.name&&(a=Mi(a).join(" ")),o["attr__"+r.name]=by(1024,"href"===r.name&&s?Rt(a):a)}}));for(var l=1,u=1,c=e;c=Sy(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 Jr(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&&is(i)&&(t[r]=i)}})),t}(e);Jr(i,((e,t)=>{({}).hasOwnProperty.call(y,t)||(y[t]=e)}))})),S)return{props:{},explicitNoCapture:S};if(a||(m[0].$el_text=xi(t,"a")||xi(t,"button")?ss(t):Li(t)),b){var w,k;m[0].attr__href=b;var C=null==(w=ci(b))?void 0:w.host,x=null==e||null==(k=e.location)?void 0:k.host;C&&x&&C!==x&&(v=b)}return{props:Xr({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(f=m,G(f)?function(e){var t=e.map((e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var n=_({},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 ei(n).sort(((e,t)=>function(e,t){return t>e?-1:e>t?1:0}(e[0],t[0]))).forEach((e=>{var t=e[1];return o[os(e[0].toString())]=os(t.toString())})),(i+=":")+ei(o).map((e=>e[0]+'="'+e[1]+'"')).join("")}));return t.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:as(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ei(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==(s=m[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},y)}}class ky{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 fy(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){yy.error("Failed to capture event",e)}};if(oi(i,"submit",t,{capture:!0}),oi(i,"change",t,{capture:!0}),oi(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,my)}catch(e){yy.error("Failed to capture clipboard event",e)}};oi(i,"copy",r,{capture:!0}),oi(i,"cut",r,{capture:!0}),oi(i,"paste",r,{capture:!0})}}}else yy.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;se(i)&&(null==(r=this._client)||r.kv.set(Is,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 s=null==i?void 0:i.querySelectorAll(t);null==s||s.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(Is),i=this._isDisabledServerSide,s=this._refreshConfig(),n=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(ee(i)&&!se(r)&&!n)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!s.enabled&&!o}_captureEvent(t,r){if(void 0===r&&(r="$autocapture"),this.isEnabled){var i=Ai(t);Ei(i)&&(i=i.parentNode||null);var s,n=this._compileUrlPatterns();"$autocapture"===r&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Vi(i,n.rageclick)&&this._captureEvent(t,"$rageclick");var o=r===my,a=o?_({},n,{dom_event_allowlist:void 0}):n;if(i&&function(t,r,i,s,n,o){var a;if(!e||ji(t))return!1;if(null!=i&&i.url_allowlist&&!Pi(i.url_allowlist,o))return!1;if(null!=i&&i.url_ignorelist&&Pi(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=Gi(t,s),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,s=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(i=s(n))return i.v;return!1}(d,i))return!1;if(!Di(d,null==i?void 0:i.css_selector_allowlist))return!1;if(Di(d,null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:Bi))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(n||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(r.type)>=0;default:return c?(n||["click"]).indexOf(r.type)>=0:(n||["click"]).indexOf(r.type)>=0&&(Oi.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,u=wy(i,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),c=u.props;if(u.explicitNoCapture)return!1;var d=this.getElementSelectors(i);if(d&&d.length>0&&(c.$element_selectors=d),r===my){var h=t.type||"clipboard";if("paste"!==h){var p,g,v=null==e||null==(p=e.getSelection())?void 0:p.toString(),f=Fi(v);if(!f)return!1;c.$selected_content=f,c.$clipboard_text_length=null!==(g=null==v?void 0:v.length)&&void 0!==g?g:0}c.$copy_type=h}return null==(l=this._client)||l.capture(r,c).catch((e=>yy.error("Failed to capture event",e))),!0}}}isBrowserSupported(){return Q(null==i?void 0:i.querySelectorAll)}}var Cy={};function xy(t,r){var i=Cy[t];if(i)return i;var s=r[t];if((e=>Q(e)&&-1!==e.toString().indexOf("[native code]"))(s)&&(null==e||!e.Zone))return Cy[t]=s.bind(r);var n=r.document;if(n&&Q(n.createElement)){var o,a=!1;try{(o=n.createElement("iframe")).hidden=!0,n.head.appendChild(o);var l,u,c=o.contentWindow;c&&c[t]&&(s=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){Kr.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 s&&Q(s)?Cy[t]=s.bind(r):s}function Ey(e,t){var r=Ai(e);return r?_({node:r,originalEvent:e,timestamp:Date.now()},t):null}function Iy(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Ty(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var My="canvas,video,audio,embed,object",Py=1e3;function Ry(e,t){return re(e)&&e>=t}function Fy(e){return e>=0&&Py>e?e:void 0}function Ly(e,t){return t?Fy(e-t):void 0}class Ay{_asRequiredConfig(e){var t,r,i,s,n,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!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(n=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==n?n: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=Ey(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 s=e,n=null==(t=s.changedTouches)?void 0:t[0];if(n){var o=n.clientX-r.x,a=n.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(My))))return;var d=Ey(s,{type:"swipe",swipeDirection:Iy(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 xy("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(){oi(h,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=Ly(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Ly(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Y(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){oi(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){oi(h,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){oi(i,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){oi(h,"blur",this._onFocusChange),oi(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach((r=>{var i=Fy(t-r.timestamp);re(i)&&(Y(r[e])||r[e]>i)&&(r[e]=i)}))}_startSwipeObserver(){oi(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),oi(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),oi(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(My))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){if(ki(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&&!xi(t.node,"html")&&Ci(t.node)&&function(t,r){var i;if(!e||ji(t))return!1;var s=se(r)?Wi:null!==(i=null==r?void 0:r.css_selector_ignorelist)&&void 0!==i?i:Wi;return!Di(Gi(t,!1).targetElementList,s)}(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||ji(i))&&Gi(i,!1).targetElementList.some((e=>xi(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=Ry(t.scrollDelayMs,this._config.scroll_threshold_ms),s=Ry(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=Ry(t.mutationDelayMs,this._config.mutation_threshold_ms),o=Ry(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||n||o||s){var h=Ty(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"]:n,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:s,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=Ty(e);this.instance.capture(r,_({},t,wy(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 Ay(e,t);class Oy{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===zn||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Un}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 ge(e)?1:q(_e,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?m_:v_,r=t._is_supported()?t:P_;if(!this._persistentStore||this._persistentStore!==r){this._persistentStore=r;var i="localStorage"===e?v_:m_;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(ge(i._get(this._storageKey))),i._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,null==r?void 0:r.globalPrivacyControl].some((e=>ge(e)))}}var Dy=Zr("[Dead Clicks]"),Ny=()=>!0,By=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Ls)),i=e.instance.config.capture_dead_clicks;return se(i)?i:!!K(i)||r};class qy{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({[Ls]: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?Dy.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)?_({},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),Dy.info("starting...")}}else Dy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Dy.info("stopping..."))}}var Hy=Zr("[SegmentIntegration]");var $y="posthog-js";function Wy(e,t){var r=void 0===t?{}:t,i=r.organization,s=r.projectId,n=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,g=(null==(r=t.exception)?void 0:r.values)||[],v=g.map((e=>_({},e,{stacktrace:e.stacktrace?_({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>_({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(o=g[0])?void 0:o.value)||t.message,$exception_type:null==(l=g[0])?void 0:l.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=g[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Uy{constructor(e,t,r,i,s,n){this.name=$y,this.setupOnce=function(o){o(Wy(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class zy{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Kr.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,s=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(),s}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},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,c=s.maxContentY;if(!(Y(n)||Y(o)||Y(a)||Y(l)||Y(u)||Y(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ve(o/n,0,1,Kr):1,h=n>1?ve(a/n,0,1,Kr):1,p=l>1?ve(u/l,0,1,Kr):1,g=l>1?ve(c/l,0,1,Kr):1;i=Xr(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:g})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Vy=["flags","surveys"],jy={[Ss]:{exposure:"hidden"},[xs]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Es]:{exposure:"hidden"},[Is]:{exposure:"event"},[Ts]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[Ms]:{exposure:"event"},[Ps]:{exposure:"hidden"},[Rs]:{exposure:"event"},[Fs]:{exposure:"event"},[Ls]:{exposure:"event"},[As]:{exposure:"hidden"},[Ds]:{exposure:"event"},[Ns]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Us]:{exposure:"hidden"},[zs]:{exposure:"event"},[Bs]:{exposure:"event",shouldSkipFromEventProperties:e=>ee(e)},[Vs]:{exposure:"event"},[js]:{exposure:"event"},[Gs]:{exposure:"event"},[Ys]:{exposure:"event"},[Js]:{exposure:"hidden"},[Xs]:{exposure:"hidden",storageGroup:"flags"},[en]:{exposure:"hidden",storageGroup:"flags"},[tn]:{exposure:"hidden"},[rn]:{exposure:"hidden",storageGroup:"flags"},[sn]:{exposure:"hidden",storageGroup:"flags"},[nn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[on]:{exposure:"hidden",storageGroup:"flags"},[an]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[un]:{exposure:"hidden"},[cn]:{exposure:"hidden"},[hn]:{exposure:"hidden",storageGroup:"surveys"},[pn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gn]:{exposure:"event"},[_n]:{exposure:"hidden"},[vn]:{exposure:"hidden"},[fn]:{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"},[mn]:{exposure:"hidden"},[yn]:{exposure:"hidden"},[dn]:{exposure:"event"},[bn]:{exposure:"hidden"},[Sn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wn]:{exposure:"hidden"},[kn]:{exposure:"hidden"},[Cn]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[En]:{exposure:"hidden"},[In]:{exposure:"hidden"},[Tn]:{exposure:"hidden"},[qs]:{exposure:"event"},[Hs]:{exposure:"event"},[$s]:{exposure:"event"},[Ws]:{exposure:"event"},[Rn]:{exposure:"event"},[Fn]:{exposure:"event"},[Ln]:{exposure:"event"},[An]:{exposure:"event"},[On]:{exposure:"event"},[Dn]:{exposure:"event"},[Nn]:{exposure:"event"},[Bn]:{exposure:"event"},[qn]:{exposure:"event"},[Hn]:{exposure:"event"},[$n]:{exposure:"event"}},Gy=[[Qs,{exposure:"hidden"}],[Ks,{exposure:"hidden"}],[Zs,{exposure:"hidden"}]],Qy=e=>{var t=jy[e];if(t)return t;for(var r of Gy){var i=r[1];if(0===e.indexOf(r[0]))return i}},Ky={flags:Sn,surveys:pn},Zy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Yy=e=>e+"_cookie_identity_change_pending",Jy="main",Xy=[Xs,en,rn,sn,nn,Sn,on,un],eb=e=>-1!==Xy.indexOf(e),tb=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return e===t}},rb=e=>{if(!e)return{};var t=JSON.parse(e);return K(t)?t:{}},ib=(e,t)=>{Jr(e,((r,i)=>{var s=Qy(i);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]}))};class sb{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._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._crossTabFeatureFlagHandlers=new Set,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(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Kr.info("Persistence loaded",t.persistence,_({},this.props)),this.update_config(t,t,r),this.save(),e){var s=()=>this.flush();oi(e,"beforeunload",s,{capture:!1}),oi(e,"pagehide",s,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){var r=Vy.find((e=>t.key===this._groupEntryName(e)));r&&this._syncCrossTabFeatureFlagProperties(t.key,r)}}else this._syncCrossTabFeatureFlagProperties(t.key,Jy)},oi(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach((e=>{var t=e[0],r=e[1],i=this._pendingCrossTabFeatureFlagChanges.get(t);if(eb(t)&&!0!==i)if(!0!==r){var s=new Set(i||[]);r.forEach((e=>s.add(e))),s.size&&this._setCrossTabFeatureFlagChangesPending(t,s)}else this._setCrossTabFeatureFlagChangesPending(t,!0)}))}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,r){if(void 0===r&&(r=!0),this._disabled)return!1;var i,s;try{if(s=m_._get(e),ee(s)){var n=this._slotWriteState(t);return n.storageValue=null,t!==Jy&&(n.persisted=!1),!1}i=rb(s)}catch(e){return!1}var o=t===Jy?i:m_._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(i,t,r);return t===Jy&&this._splitStorage&&!tb(this._partitionProps().main,i)||this._rememberCrossTabStorageFingerprint(i,t,!0,s),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[ws],r=e[ws];return!Y(t)&&!Y(r)&&t!==r}_rememberCrossTabStorageFingerprint(e,t,r,i){var s=this._slotWriteState(t);s.storageValue=i,t!==Jy&&(s.persisted=r);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,r){var i=!1;return Xy.forEach((r=>{var s,n=null==(s=Qy(r))?void 0:s.storageGroup;if(!(t===Jy&&this._splitStorage&&n||t!==Jy&&n!==t)){var o=r in e,a=this._mergePendingCrossTabFeatureFlagChanges(r,o?e[r]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(r)?r in this.props:o;l===r in this.props&&tb(a,this.props[r])||(l?this._setProp(r,a,!1):this._deleteProp(r,!1),i=!0)}})),i&&r&&this._crossTabFeatureFlagHandlers.forEach((e=>e())),i}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=m_._get(this._name),r=this._slotWriteState(Jy),i=!1,s=!1;if(t!==r.storageValue)if(ee(t))r.storageValue=null;else{if(e=rb(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(e,Jy,!1),!this._splitStorage||tb(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,Jy,!0,t):r.storageValue=t,i=!0}return this._splitStorage&&Vy.forEach((t=>{var r=m_._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=i&&Xy.some((e=>{var r;return(null==(r=Qy(e))?void 0:r.storageGroup)===t&&e in o}));if(r!==n.storageValue||a){if(ee(r))return n.storageValue=null,n.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||s));var l=rb(r);s=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||s,this._rememberCrossTabStorageFingerprint(l,t,!0,r)}})),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var r=Qy(e);null!=r&&r.volatile||(this._slotWriteState((this._splitStorage?null==r?void 0:r.storageGroup:void 0)||Jy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Xy.forEach((e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0)))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=m_._get(this._name),t=rb(e);this._slotWriteState(Jy).storageValue=e,Xy.forEach((e=>{var r,i=this._splitStorage?null==(r=Qy(e))?void 0:r.storageGroup:void 0,s=i?m_._get(this._groupEntryName(i)):null;if(i){var n=this._slotWriteState(i);n.storageValue=s,n.persisted=!ee(s)}var o=i&&!ee(s)?rb(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)}))}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var r=this._pendingCrossTabFeatureFlagChanges.get(e);if(!r)return t;if(!0===r)return this.props[e];if(e===en){var i=new Set(G(t)?t:[]),s=new Set(G(this.props[e])?this.props[e]:[]);return r.forEach((e=>s.has(e)?i.add(e):i.delete(e))),Array.from(i)}var n=K(t)?_({},t):{},o=K(this.props[e])?this.props[e]:{};return r.forEach((e=>{e in o?n[e]=o[e]:delete n[e]})),n}_markPendingCrossTabFeatureFlagChanges(e,t,r){if(eb(e)){var i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==i){var s=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Qy(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;s=rb(m_._get(a))[e]}catch(e){}var l=new Set(i||[]);if(e===en){if(!Y(t)&&!G(t)||!Y(s)&&!G(s)||!G(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var u=new Set(t||[]),c=new Set(s||[]),d=new Set(r);new Set([...u,...d]).forEach((e=>{u.has(e)!==d.has(e)&&l.add(e)})),l.forEach((e=>{c.has(e)===d.has(e)&&l.delete(e)}))}else{if(!K(r))return void(tb(s,r)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!Y(t)&&!K(t)||Y(t)&&Z(r)&&Y(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var h=K(t)?t:{},p=K(s)?s:{};new Set([...Object.keys(h),...Object.keys(r)]).forEach((e=>{e in h==e in r&&tb(h[e],r[e])||l.add(e)})),l.forEach((e=>{e in p==e in r&&tb(p[e],r[e])&&l.delete(e)}))}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_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=C_(e,this._config.cookie_persisted_properties||[]),r=E_(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),s=v_._get(this._name)||void 0;s&&T_(this._name,s)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=s)}catch(e){}else try{var n=v_._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?T_(this._name,n):void 0,this._lastSeenMainCookieValue=n}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=v_._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,s=T_(this._name,r);try{i=k_(JSON.parse(r))}catch(e){return!1}if((v_._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r;var n=I_(this._name,r),o=[...b_,...n.properties],a={};if(Object.keys(i).forEach((e=>{var t=i[e];(Y(t)||ee(t)||""===t||e===wn&&t!==Vn&&t!==jn)&&(a[e]=!0,delete i[e])})),Z(i))return!1;var l=ws in i||i[wn]===Vn||i[wn]===jn,u=this.props,c=u[ws],d=u[wn],h=Xr({},u);[...b_,...e.cookie_persisted_properties||[]].forEach((e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||e!==ws&&e!==wn)){var t=h[e];!n.isValid&&-1!==b_.indexOf(e)&&(!1===t||0===t)||delete h[e]}})),this.props=Xr(h,i),Xy.forEach((e=>{var t=e in this.props;e in u===t&&tb(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))})),!l||wn in i||wn in this.props||this._setProp(wn,Vn);var p=this.props[ws],g=this.props[wn];return!l||p===c&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,F_._set(Yy(this._name),!0),this._deleteProp(un),this._deleteProp(en),this._deleteProp(Xs),this._deleteProp(rn),this._deleteProp(sn),this._deleteProp(nn),this._deleteProp(Sn),this._deleteProp(bn),this._deleteProp(mn),g===Vn&&(d===jn||i[wn]===Vn||!Y(c)&&p!==c)&&(ib(this.props,i),this._deleteProp(cn)),g===jn?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(xs)),!0}consumeCookieIdentityChange(){var e=Yy(this._name),t=this._cookieIdentityChangePending||!!F_._get(e);return this._cookieIdentityChangePending=!1,t&&F_._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[Jy],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===Zy.indexOf(t.persistence.toLowerCase())&&(Kr.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=[...b_,...t];return _({},m_,{_parse(e){try{var t,s={};try{t=v_._get(e)||void 0,s=t?k_(JSON.parse(t)):{}}catch(e){}var n,o=JSON.parse(m_._get(e)||"{}");if(r){var a=I_(e,t),l=[...b_,...a.properties],u={};Object.keys(s).forEach((e=>{var t=s[e];ee(t)||""===t||e===wn&&t!==Vn&&t!==jn||(u[e]=t)}));var c=ws in u||u[wn]===Vn||u[wn]===jn;if(Object.keys(u).length>0){var d,h=o[ws],p=null!==(d=o[wn])&&void 0!==d?d:Vn;i.forEach((e=>{if(-1!==l.indexOf(e)&&!(e in s)&&(c||e!==ws&&e!==wn)){var t=o[e];!a.isValid&&-1!==b_.indexOf(e)&&(!1===t||0===t)||delete o[e]}})),!c||wn in s||wn in o||(o[wn]=Vn),!c||(ws in u?u[ws]:o[ws])===h&&(wn in u?u[wn]:o[wn])===p||(y_.forEach((e=>delete o[e])),u[wn]===jn&&ws in u?o.$user_id=u[ws]:delete o.$user_id,u[wn]!==jn&&(delete o[dn],delete o[cn]),delete o.__alias)}n=Xr(o,u)}else n=Xr(s,o);return m_._set(e,n),n}catch(e){}return null},_set(e,i,s,n,o,a){var l=m_._set(e,i,void 0,void 0,a);try{var u=C_(i,t);if(Object.keys(u).length){if(r){var c=S_(e),d=E_(u,t);if(v_._set(c,d,s,n,o,a),v_._get(c)!==JSON.stringify(d)){v_._remove(c,n);var h=C_(i);return v_._set(e,h,s,n,o,a),l}}v_._set(e,u,s,n,o,a)}}catch(e){m_._error(e)}return l},_remove(t,r){try{null==e||e.localStorage.removeItem(t),v_._remove(t,r),v_._remove(S_(t),r)}catch(e){m_._error(e)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&m_._is_supported()?(r=m_,s=!0):"localstorage+cookie"===n&&i._is_supported()?(r=i,s=!0):"sessionstorage"===n&&F_._is_supported()?r=F_:"memory"===n?r=P_:"cookie"===n&&v_._is_supported()?r=v_:i._is_supported()?(r=i,s=!0):r=v_._is_supported()?v_:P_,this._splitStorageEligible=s,r}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return Jr(this.props,((t,r)=>{var i=Qy(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?m_._parse(this._name):null,i={};if(t)try{Jr(i=k_(v_._parse(this._name)),((e,t)=>{(Y(e)||ee(e)||""===e)&&delete i[t]}))}catch(e){}var s=this._storage._parse(this._name);if(s&&(this.props=Xr({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var n,o,a=null==r?void 0:r[ws],l=null!==(n=null==r?void 0:r[wn])&&void 0!==n?n:Vn,u=s[ws],c=null!==(o=s[wn])&&void 0!==o?o:Vn;if(u!==a||c!==l){this._cookieIdentityChangePending=!0,F_._set(Yy(this._name),!0);var d=Xr({},this.props);y_.forEach((e=>delete d[e])),c===Vn&&(l===jn||i[wn]===Vn||!Y(a)&&u!==a)&&(ib(d,i),delete d[cn]),this.props=d;var h=new Set;y_.forEach((e=>{var t,r=null==(t=Qy(e))?void 0:t.storageGroup;r&&h.add(r)})),h.forEach((e=>{var t={};Jr(this.props,((r,i)=>{var s;(null==(s=Qy(i))?void 0:s.storageGroup)===e&&(t[i]=r)})),Z(t)?(m_._remove(this._groupEntryName(e)),this._slotState[e]={}):m_._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}))}}F_._get(Yy(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Vy){var t=m_._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)||Xr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Qy(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=Ky[e];if(!r)return!1;var i=t[r],s=this.props[r];return re(i)&&re(s)&&s>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Qy(e))?void 0:t.storageGroup:void 0,i=r?m_._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var s=this._storage._parse(this._name);if(s&&e in s)return void this._setProp(e,s[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){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||this.syncCookieProperties();var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var r=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Kr.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(r&&this._crossTabFeatureFlagHandlers.forEach((e=>e())));var i=this._writeEntry(this._storage,this._name,this.props,Jy);"written"===i&&this._rememberCurrentCookieProperties(this.props),"failed"!==i&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1),r&&this._crossTabFeatureFlagHandlers.forEach((e=>e()))}}}_writeNowSplit(){var e=this,t=this._partitionProps(),r=t.main,i=t.groups,s=this._writeEntry(this._storage,this._name,r,Jy);"written"===s&&this._rememberCurrentCookieProperties(r),"failed"!==s&&(this._localIdentityChangePending=!1,Xy.forEach((e=>{var t;null!=(t=Qy(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)})));var n=function(t){var r,s=i[t];if(Z(s)&&(null==(r=e._slotState[t])||!r.persisted))return Xy.forEach((r=>{var i;(null==(i=Qy(r))?void 0:i.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(r)})),1;var n=e._writeEntry(m_,e._groupEntryName(t),s,t);"failed"!==n&&Xy.forEach((r=>{var i=Qy(r);(null==i?void 0:i.storageGroup)!==t||"written"!==n&&i.volatile||e._pendingCrossTabFeatureFlagChanges.delete(r)}))};for(var o of Vy)n(o)}_partitionProps(){var e={},t={flags:{},surveys:{}};return Jr(this.props,((r,i)=>{var s,n=null==(s=Qy(i))?void 0:s.storageGroup;n?t[n][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Jy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return Jr(e,((e,t)=>{var i;r[t]=null!=(i=Qy(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var s,n=this._slotWriteState(i);if(i!==Jy&&!n.dirty&&!Y(n.fingerprint))return"skipped";try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){s=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Jy&&(n.persisted=!0),Y(s)||(n.fingerprint=s),this._splitStorageEligible&&(n.storageValue=m_._get(t)),"written"):(this._config.debug&&Kr.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),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 Vy)m_._remove(this._groupEntryName(i));r?delete this._slotState[Jy]: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(Jr(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(Jr(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=Qa(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Z(ii(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==i?void 0:i.referrer)?Za(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Xa(),$referring_domain:null!=i&&i.referrer&&(null==(e=ci(i.referrer))?void 0:e.host)||Ja},void 0)}set_initial_person_info(){this.props[xn]||this.props[En]||this.register_once({[In]:el(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={};Jr([En,xn],(t=>{var r=this.props[t];r&&Jr(r,(function(t,r){e["$initial_"+W(r)]=t}))}));var t=this.props[In];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=tl(e,t),i={};return Jr(r,(function(e,t){i["$initial_"+W(t)]=e})),i}(t,this._config.disable_capture_url_hashes);Xr(e,r)}return e}safe_merge(e){return Jr(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){var i=e.persistence!==t.persistence,s=!((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||[]),n=i||s,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(i||s||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(_({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),l));var u=n||o?this._buildStorage(e):this._storage,c=this._resolveSplitStorage(e),d=n||c!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;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[Jy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,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[Es]||{};r[e]=t,this._setProp(Es,r),this.save()}remove_event_timer(e){var t=this.props[Es]||{},r=t[e];return Y(r)||(delete t[e],this._setProp(Es,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,r){var i;void 0===r&&(r=!0);var s=this.props[e];this.props[e]=t,r&&(e!==ws&&e!==wn||s===t||(this._localIdentityChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,s,t),null!=(i=Qy(e))&&i.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(eb(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,r=null==(t=Qy(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var nb=Zr("[RateLimiter]");class ob{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=>{nb.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void nb.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 s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(Cn))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);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(Cn,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!=s&&s.pathname)return""+(null!==(e=s.origin)&&void 0!==e?e:"")+s.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=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",n?"triggered on "+n: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 "+s+" 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 ab=Zr("[RemoteConfig]");class lb{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 ab.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void ab.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return ab.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){ab.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||ab.warn("Failed to fetch remote config from PostHog."):ab.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){ab.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){ab.error("Error loading feature flags",e)}}}var ub=!!o||!!n,cb="text/plain",db=!1,hb=(e,t)=>{var r=e.split("#"),i=r[1],s=r[0].split("?"),n=s[0],o=s[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(a?"?"+a:"")+(i?"#"+i:"")},pb=function(e,t,r){var i;void 0===r&&(r=!0);var s=e.split("?"),n=s[0],o=s[1],a=_({},t),l=null!==(i=null==o?void 0:o.split("&").map((e=>{var t,i=e.split("="),s=i[0],n=r&&null!==(t=a[s])&&void 0!==t?t:i[1];return delete a[s],s+"="+n})))&&void 0!==i?i:[],u=di(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},gb=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===Ag){var i=pa(ga(ui(t)),{mtime:0});return{contentType:cb,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===Og){var s=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(ui(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:ui(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=ui(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},_b=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:pb(e.url,{compression:Og}),encodedBody:gb(_({},e,{compression:Og,_encodedBody:void 0}))}:{url:hb(e.url,"compression"),encodedBody:gb(_({},e,{compression:void 0,_encodedBody:void 0}))};try{t=gb(e)}catch(t){if(Bt(e.compression,hi(e.url,"compression")))return Kr.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&Bt(e.compression,hi(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?Nt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Nt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(db=!0,i()):{url:e.url,encodedBody:t}},vb=e=>{try{return _b(e)}catch(t){return Kr.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},fb=function(){var e=g((function*(e){var t=ui(e.data),r=yield Ut(t,Gr.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return _({},e,{_encodedBody:{contentType:cb,body:i,estimatedSize:i.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),mb=/Failed to fetch|NetworkError|Load failed/i,yb=e=>"TypeError"===(null==e?void 0:e.name)&&mb.test((null==e?void 0:e.message)||""),bb=e=>{var t=vb(e);if(t){var r=t.url,i=t.encodedBody,s=null!=i?i:{},o=s.contentType,l=s.body,u=s.estimatedSize,c=new Headers;Jr(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(Pt("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))}),e.timeout)}}var g=t=>{h&&"AbortError"===(null==t?void 0:t.name)||yb(t)?Kr.warn(t):Kr.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var v;n(r,_({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(u||0),body:l,signal:null==(v=d)?void 0:v.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){Kr.error(e)}null==e.callback||e.callback(i)})))).catch(g).finally((()=>d?clearTimeout(d.timeout):null))}catch(e){d&&clearTimeout(d.timeout),g(e)}}},Sb=e=>{try{var t,i=_b(e),s=i.url,n=i.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(r.sendBeacon(s,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:_({},e.data,{batch:t});return Sb(_({},e,{data:h(c.slice(0,d))})),void Sb(_({},e,{data:h(c.slice(d))}))}Kr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),bb(_({},e,{_keepaliveDisabled:!0}))}catch(e){Kr.warn("Beacon send failed",e)}},wb=(e,t,r,i)=>{var s="query"===i?"POST"===t?"sent_at":"_":void 0;return pb(r===Ag?hb(e,"compression"):e,_({},s?{[s]:Date.now().toString()}:{},r===Ag?{}:{compression:r}))},kb=[];n&&kb.push({transport:"fetch",method:bb}),o&&kb.push({transport:"XHR",method(e){var t=vb(e);if(t){var r=new o,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var s=null!=i?i:{},n=s.contentType,a=s.body;Jr(e.headers,(function(e,t){r.setRequestHeader(t,e)})),n&&r.setRequestHeader("Content-Type",n),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&&kb.push({transport:"sendBeacon",method:Sb});var Cb=3e3;class xb{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ve((null==t?void 0:t.flush_interval_ms)||Cb,250,5e3,Kr.createLogger("flush interval"),Cb),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(_({},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],s=(new Date).getTime();r.data&&G(r.data)&&Jr(r.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Kr.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Jr(this._queue,(t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;Y(e[s])&&(e[s]=_({},i,{data:[]})),null==(r=e[s].data)||r.push(i.data)})),this._queue=[],e}}var Eb=["retriesPerformedSoFar"];class Ib{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},oi(e,"online",this._onlineListener),oi(e,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,r=v(e,Eb);ie(t)&&(r.url=pb(r.url,{retry_count:t})),this._instance._send_request(_({},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(_({retriesPerformedSoFar:t},r));0===e.statusCode&&Kr.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),s=Math.random()-.5;return Math.ceil(i+s*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),Kr.warn(s),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(_({},r,{transport:"sendBeacon"}))}catch(e){Kr.error(e)}}this._queue=[]}}class Tb{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,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(){oi(e,"scroll",this._updateScrollData,{capture:!0}),oi(e,"scrollend",this._updateScrollData,{capture:!0}),oi(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 Mb=e=>el(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 Pb{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({[kn]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||Mb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[kn]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?tl(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 Jr(ii(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+W(r)]=t})),e}}class Rb{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 Fb=Zr("[SessionId]"),Lb=864e5;class Ab{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 Rb,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===zn)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||d_,this._windowIdGenerator=r||d_;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ve(this._config.session_idle_timeout_seconds||1800,60,36e3,Fb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=F_._parse(this._window_id_storage_key),o=F_._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:F_._remove(this._window_id_storage_key),F_._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&&F_._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&F_._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?F_._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,s=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!i||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Us]:[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(Us):(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({[Us]:[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[Us];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 Fb.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void Fb.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(Kn,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&F_._remove(this._primary_window_exists_storage_key)},oi(e,Kn,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===zn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(ee(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],c=!Y(s)&&l!==s,d=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,g=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>Lb),_=p?g:ie(u)&&Math.abs(i-u)>Lb,v=!1,f=c,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,d);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||Fb.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||_){f=!1;var w=p&&!g;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),Fb.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:_}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,v=!0}else h||(h=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(Fb.info("adopted cross-tab session id",{sessionId:l,windowId:h}),v=!0);var k=ie(d)&&e&&!_?d:i,C=ie(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var x={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:_,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach((e=>e(l,h,x))),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:v?x: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 Ob=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 Db(){return Db=g((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 Kr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),Db.apply(this,arguments)}var Nb="custom",Bb="i.posthog.com",qb=/^\/static\//,Hb=["/s/","/e/","/i/"];class $b{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("."+Bb,".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":Nb),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(qb.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=ci(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ci(r))?void 0:n.href)||r;i=s(new URL(o)).toString()}if(s&&"api"===e&&Hb.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===s||(c={apiHost:u,rewriteRequestPath:s,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===Nb)return this._prepareEndpoint(e,t,this.apiHost+t);var i=Bb+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 Wb=Zr("[PostHog ExternalIntegrations]"),Ub={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class zb{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 Wb.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,s,n=r[0],o=r[1];!o||null!=(t=h.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Ub[n],(()=>{var t;null==(t=h.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)})),!o&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]&&(null==(s=h.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class Vb{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return g((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 jb{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 s=null==t?void 0:t.get_property(i);Y(s)||(r[i]=s)}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 Gb="extensionsRemoteConfig";class Qb{constructor(e){this._disposed=!1,this.instance=e,this._logger=Kr,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new jb(e),this.onEvent=e=>Lg(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 Lg((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(Gb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Lg(r)},this._runtime=new Vb(Kr.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(ks))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(ks);return"string"==typeof e?e:void 0}get library(){return{name:Gr.LIB_NAME,version:Gr.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,s=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==s?void 0:s.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==s?void 0:s.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==s?void 0:s.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 g((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 Lg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(Gb,e))}sendRequest(e,t){var r=this;return g((function*(){var i;void 0===t&&(t={});var s=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),n={method:t.method,url:t.query?pb(s,t.query):s,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(n),{statusCode:202}):new Promise((e=>{n.callback=e,r.instance._send_request(n)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var Kb={},Zb=0,Yb=()=>{},Jb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xb="Surveys module not available",eS="sanitize_properties is deprecated. Use before_send instead",tS="Invalid value for property_denylist config: ",rS=["token","distinct_id",Pn],iS="posthog",sS=!ub&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),nS=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},oS=t=>{var r;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ni(null==i?void 0:i.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Yb,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:s&&J(null==s?void 0:s.search)&&-1!==s.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){Kr.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:Gn,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Cb},error_tracking:{},_onCapture:Yb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Hi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:nS(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))},aS=[["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"]],lS=e=>{var t={};for(var r of aS){var i=r[0],s=r[1];Y(e[i])||(t[s]=e[i])}var n=Xr({},t,e),o=e.__preview_external_dependency_versioned_paths;return Y(o)||(Y(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),J(o)&&Y(e.asset_host)&&(n.asset_host=o)),G(e.property_blacklist)&&(Y(e.property_denylist)?n.property_denylist=e.property_blacklist:G(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Kr.error(tS+e.property_denylist)),n};class uS{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Kr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class cS{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===zn||this.config.cookieless_mode===Un&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!this._hasWarnedAboutVolatileIdentity&&!this.config.segment&&!this._inCookielessMode()){var e,t,r,i="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(i||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(i?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",r="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+r)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&this.get_distinct_id()===Mn){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===Mn){var r=this.config.get_device_id(d_());this.register({distinct_id:r,$device_id:r}),e.set_property(wn,Vn)}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 uS,this._personProcessingSetOncePropertiesSent=!1,this.version=Gr.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Rb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oS(),this.SentryIntegration=Uy,this.sentryIntegration=e=>function(e,t){var r=Wy(e,t);return{name:$y,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 Tb(this),this.pageViewManager=new zy(this),this.rateLimiter=new ob(this),this.requestRouter=new $b(this),this.consent=new Oy(this),this.externalIntegrations=new zb(this);var t=null!==(e=cS.__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=>Kr.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==iS){var i,s=null!==(i=Kb[r])&&void 0!==i?i:new cS;return s._init(e,t,r),Kb[r]=s,Kb[iS][r]=s,s}return this._init(e,t,r)}_init(t,r,i){var s,n,o;void 0===r&&(r={});var a,l=J(t)?t.trim():"";if(!l)return Kr.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 l!==(null==(a=this.config)?void 0:a.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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=oS(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 u=oS(r.defaults),c=lS(r),d=Xr({},u,c,{name:i,token:l});K(u.rageclick)&&K(c.rageclick)&&(d.rageclick=Xr({},u.rageclick,c.rageclick)),K(u.session_recording)&&K(c.session_recording)&&(d.session_recording=Xr({},u.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&Kr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Ag;var h=this._is_persistence_disabled();if(this.persistence=new sb(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sb(_({},this.config,{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&F_._is_supported()){var p=F_._parse(this._sessionRegisteredPropertiesStorageKey);G(p)&&p.forEach((e=>{J(e)&&this._sessionRegisteredPropKeys.add(e)}))}else F_._remove(this._sessionRegisteredPropertiesStorageKey);var g=_({},this.persistence.props),v=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new xb((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Ib(this),this.__request_queue=[];var f=this._inCookielessMode();f||(this.sessionManager=new Ab(this),this.sessionPropsManager=new Pb(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?(Kr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(f)}),0)):(Kr.info("Initializing extensions synchronously"),this._initExtensions(f)),Gr.DEBUG=Gr.DEBUG||this.config.debug,Gr.DEBUG&&Kr.info("Starting in debug mode",{this:this,config:r,thisC:_({},this.config),p:g,s:v}),!this.config.identity_distinct_id||null!=(s=r.bootstrap)&&s.distinctID||(r.bootstrap=_({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=r.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!m&&!X(m),void 0!==(null==(o=r.bootstrap)?void 0:o.distinctID)){var y=r.bootstrap.distinctID,b=this.get_distinct_id(),S=this.persistence.get_property(wn);if(r.bootstrap.isIdentifiedID&&null!=b&&b!==y&&S===Vn)this.identify(y);else if(r.bootstrap.isIdentifiedID&&null!=b&&b!==y&&S===jn)Kr.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 w=this.config.get_device_id(d_()),k=r.bootstrap.isIdentifiedID?w:y;this.persistence.set_property(wn,r.bootstrap.isIdentifiedID?jn:Vn),this.register({distinct_id:y,$device_id:k})}}if(f)this.register_once({distinct_id:Mn,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(d_());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(wn,Vn)}return oi(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()||d_();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(wn,jn)),t()},s=r.user();"then"in s&&Q(s.then)?s.then(i):i(s)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||Hy.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()||(Hy.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Hy.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,Zn),identify:e=>t(e,Jn),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Q(this.config._onCapture)&&this.config._onCapture!==Yb&&(Kr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Kr.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 Db.apply(this,arguments)}().then((e=>{e&&this.register({[Cs]:e})})).catch(Yb),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=>{Kr.error('Failed to dispose browser extension "'+e.name+'"',t)}))})):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,r,i,s,n,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(r=cS.__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==(s=(n=this.featureFlags).initialize)||s.call(n))}_initExtensions(e){var t,r,i,s,n,o,a,l=performance.now(),u=_({},cS.__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!==(s=this.metrics)&&void 0!==s?s:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n: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,By)),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){Kr.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[Rn]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fn]:i}),this.config.__preview_deferred_init_extensions&&Kr.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!i||!i.body)return Kr.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,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=q(s.supportedCompression,Ag)?Ag:q(s.supportedCompression,Og)?Og:void 0),null!=(r=s.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Gn}),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){Kr.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var e=s.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 lb(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()&&Yr(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,s;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Yn),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(Yn,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?sS?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=_({},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,s=_({},e);s.timeout=s.timeout||6e4;var n,o,a,u,c,d=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Y(s.compression)&&s.data&&(s.compression=Og),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(c=(u=(G(n=s.data)?n:[n]).map((e=>_({},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"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),G(e)?e.map((e=>_({},e,{sent_at:t}))):_({},e,{sent_at:t})}(s.data))),s.url=wb(s.url,s.method,s.compression,s.timestampMode);var h=kb.filter((e=>!s.disableTransport||!e.transport||!s.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 g=e=>{try{p(e)}catch(e){yb(e)?Kr.warn(e):Kr.error(e),null==s.callback||s.callback({statusCode:0,error:e})}};"sendBeacon"!==d&&s.data&&s.compression===Ag&&l&&"undefined"!=typeof Promise&&!db?fb(s).then((e=>{g(e)})).catch((t=>{if(qt(t))return db=!0,void g(_({},s,{compression:void 0,url:wb(e.url,e.method,void 0,e.timestampMode)}));Ht(t)&&(db=!0),g(s)})):p(s)})(_({},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){Zb++;try{var t,r=[],i=[],s=[];Yr(e,(e=>{if(e)if(G(t=e[0]))s.push(e);else if(Q(e))try{e.call(this)}catch(t){Kr.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])?s.push(e):i.push(e)}));var n=function(e,t){Yr(e,(function(e){try{if(G(e[0])){var r=t;Jr(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Kr.error("Error executing queued PostHog call",e,t)}}))};n(r,this),n(i,this),n(s,this)}finally{Zb--}}push(e){if(Zb>0&&G(e)&&J(e[0])){var t=cS.prototype[e[0]];Q(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,s,n,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)&&(Kr.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||Kr.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=Mt(null==r?void 0:r.uuid,d_),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===Zn&&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 g="$feature_flag_called"===e&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property(on);(null==r?void 0:r.$set)&&!g&&(p.$set=null==r?void 0:r.$set);var v=null==r?void 0:r.$unset;v&&(p.$unset=v);var f=g?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==Xn,e===Jn);if(f&&(p.$set_once=f),null!=r&&r._noTruncate||(s=this.config.properties_string_max_length,n=p,o=e=>J(e)?e.slice(0,s):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=[],Yr(t,(t=>{i.push(e(t))}));else{var s={};Jr(t,((t,r)=>{a.has(t)||(s[r]=e(t,r))})),i=s}return i}}(n)),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),g&&(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,rS)),e===Vg.DISMISSED||e===Vg.SENT){var m=null==t?void 0:t[jg.SURVEY_ID],y=null==t?void 0:t[jg.SURVEY_ITERATION];t_({id:m,current_iteration:y}),p.$set=_({},p.$set,{[wa({id:m,current_iteration:y},e===Vg.SENT?"responded":"dismissed")]:!0})}else e===Vg.SHOWN&&(p.$set=_({},p.$set,{[jg.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if("product tour shown"===e){var b=null==t?void 0:t.$product_tour_type;b&&(p.$set=_({},p.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var S=_({},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=Mt(p.uuid,d_)}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),x={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(x):this._requestQueue.enqueue(x),p}Kr.critical("This capture call is ignored due to client rate limiting.")}}else Kr.error("No event name provided to posthog.capture")}else Kr.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 Qb(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(wn)===Vn&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,n,o,a){if(n=n||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=_({},r);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this._inCookielessMode()&&(c[Pn]=!0),"$snapshot"===t){var d=_({},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))&&Kr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=function(t,r,i,n){var o,a,l,c;if(void 0===n&&(n=!1),!u)return{};var d,h=t?[...za,...r||[]]:[],p=xt(u),g=p[0],_=p[1],v=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,x=Xr(ii({$os:g,$os_version:_,$browser:St(u,navigator.vendor,v,f),$device:Et(u),$device_type:It(u,m),$timezone:rl(),$timezone_offset:il()}),{$current_url:pi(n?Rt(null==s?void 0:s.href):null==s?void 0:s.href,h,ja),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:kt(u,navigator.vendor,v,f),$browser_language:Ya(),$browser_language_prefix:(C=Ya(),"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:Gr.LIB_NAME,$lib_version:Gr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Gr.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Gr.SDK_DIST_CHANNEL),x}(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 g=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),v=g.windowId;c.$session_id=g.sessionId,c.$window_id=v}this.sessionPropsManager&&Xr(c,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Xr(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===Nb&&(c.$lib_custom_api_host=this.config.api_host),h=t!==Zn||a?t!==Yn||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),c=Xr(c,h),t===Zn&&i&&(c.title=i.title),!Y(l)){var m=n.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();Jr(["$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{Xr(S,w())}catch(e){Kr.error("Failed to produce browser extension event properties",e)}(c=Xr({},p,y,b,_({},S,c))).$is_identified=this._isIdentified(),G(this.config.property_denylist)?Jr(this.config.property_denylist,(function(e){delete c[e]})):Kr.error(tS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Kr.error(eS),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 s=this.persistence.get_initial_props(),n=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Xr({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Kr.error(eS),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||!F_._is_supported())F_._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach((e=>t.push(e))),t.length>0?F_._set(this._sessionRegisteredPropertiesStorageKey,t):F_._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:Xb}),()=>{})}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:Xb})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Xb})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=i_),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:Xb}}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:Xb})}_validateIdentifyId(e){return!e||X(e)?(Kr.critical("Unique user id has not been set in posthog.identify"),!1):e===Mn?(Kr.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())||(Kr.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 Kr.uninitializedWarning("posthog.identify");if(re(e)&&(e=e.toString(),Kr.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(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ks)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property(xs)&&(this.unregister(xs),this.register({distinct_id:e}));var u,c=(this.persistence.get_property(wn)||Vn)===Vn,d=e!==l,h=!d&&c;if(d&&c)this.persistence.set_property(wn,jn),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(Jn,{distinct_id:e,$anon_distinct_id:l},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Aa(e,t,r),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(wn,jn);var p=t||{},g=r||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:g}),this._cachedPersonProperties=Aa(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(mn)):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=Aa(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):Kr.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 s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},s,{[e]:t})}),n||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(Xn,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else Kr.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=se(e)?e:null==e?void 0:e.resetDeviceID,r=se(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,s,n;if(void 0===t&&(t=!1),Kr.info("reset"),!this.__loaded)return Kr.uninitializedWarning("posthog.reset");var o=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(ks),l=this.get_property(Cs),u=this.get_property(Ns),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==(n=this.persistence)||null==n._beginCookieSyncSuppression?void 0:n._beginCookieSyncSuppression(),h=!1;try{var p,g,v,f,m,y,b,S,w,k,C,x,E;if(null==(p=this.persistence)||p.clear(),null==(g=this.sessionPersistence)||g.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Y(u)||null==(k=this.persistence)||k.register({[Ns]:u}),null==(v=this.surveys)||v.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(wn,Vn),null==(w=this.sessionManager)||w.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===zn)this.register_once({distinct_id:Mn,$device_id:null},"");else{var I=this.config.get_device_id(d_());this.register_once({distinct_id:I,$device_id:e?I:a},""),e||Y(l)||this.register({[Cs]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(E=this.persistence)||E.set_property(wn,r.isIdentifiedID?jn:Vn),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(Y(o)||null!=(x=this.sessionManager)&&x.setBootstrapSessionId(o,!0))){var T=_({},r);delete T.sessionID,this.config.bootstrap=T}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 g((function*(){var e,r,i,s,n,o,a;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==(s=t._requestQueue)||s.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){Kr.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else Kr.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 s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-n,0)}return i}alias(e,t){return e===this.get_property(Ss)?(Kr.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(xs,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Kr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(K(e)){var r,i,s,n,o,a,l,u,c,d,h,p;Xr(this.config,lS(e));var g=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sb(_({},this.config,{persistence:"sessionStorage"}),g,!1);var v,f=this._checkLocalStorageForDebug(this.config.debug);se(f)&&(this.config.debug=f),se(this.config.debug)&&(this.config.debug?(Gr.DEBUG=!0,m_._is_supported()&&m_._set("ph_debug",!0),Kr.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(Gr.DEBUG=!1,m_._is_supported()&&m_._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.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==(v=this.historyAutocapture)||v.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){Gr.LIB_NAME=e,Gr.LIB_VERSION=t}startSessionRecording(e){var t,r,i,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(_({},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:cS._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:iS;return t!==iS&&(t=iS+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(wn))===jn||(null==(t=this.sessionPersistence)?void 0:t.get_property(wn))===jn}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Gn&&!this._isIdentified()&&Z(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[xs])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Tn]))}_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?(Kr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Tn,!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!==Un)}_sync_opt_out_with_persistence(){var e,t,r,i,s,n=this._is_persistence_disabled();return this.is_capturing()||null==(r=this.logs)||r._onOptOut(),(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==zn){if(this._inCookielessMode()){var r,i,s,n,o,a;null==(r=this.sessionRecording)||r.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Ab(this),this.pageViewManager=new zy(this),this.persistence&&(this.sessionPropsManager=new Pb(this,this.sessionManager,this.persistence));var l,u=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=cS.__defaultExtensionClasses)?void 0:a.sessionRecording;u&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new u(this)),this._lastRemoteConfig&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._lastRemoteConfig)))}var c,d;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==Un&&(null==(c=this.surveys)||c.loadIfEnabled()),(Y(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(d=null==e?void 0:e.captureEventName)&&void 0!==d?d:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Kr.warn(Jb)}opt_out_capturing(){if(this.config.cookieless_mode!==zn){var e,t,r=this.config.cookieless_mode===Un?this.sessionRecording:void 0;null==r||r.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Un&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Un&&(this.register({distinct_id:Mn,$device_id:null}),this._removeExtension(r),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else Kr.warn(Jb)}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===zn||(this.config.cookieless_mode===Un?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?Ob(r,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){i&&("visible"===i.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Zn,{title:i.title},{send_instantly:!0}),this._visibilityStateListener&&(i.removeEventListener(Qn,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),oi(i,Qn,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?(Kr.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,s){var n=t in e&&!te(e[t]),o=r in e&&!te(e[r]);return n?e[t]:!!o&&(s&&s.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,Kr)}_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],s=e;for(var n of i)try{if(s=n(s),te(s)){var o="Event '"+e.event+"' was rejected in beforeSend function";return oe(e.event)?Kr.warn(o+". This can cause unexpected behavior."):Kr.info(o),null}s.properties&&!Z(s.properties)||Kr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Kr.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(s.properties&&te(s.properties[a]))return Kr.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 s}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=se(e)&&!e,r=m_._is_supported()&&"true"===m_._get("ph_debug");return!t&&(!!r||e)}}cS.__defaultExtensionClasses={},cS._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]]=ri(e.prototype[t[r]])}(cS,["identify"]);class dS{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 hS=Zr("[ExceptionAutocapture]"),pS=Zr("[TracingHeaders]"),gS=Zr("[Web Vitals]"),_S=9e5,vS=["CLS","FCP","INP","LCP"],fS=["INP","LCP"],mS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],yS="[SessionRecording]",bS=Zr(yS),SS=Zr("[Heatmaps]");function wS(e){return K(e)&&"clientX"in e&&"clientY"in e&&re(e.clientX)&&re(e.clientY)}var kS=Zr("[Product Tours]"),CS=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(As))},xS=["$set_once","$set"],ES=Zr("[SiteApps]"),IS="Error while initializing PostHog app with config id ",TS=(e,t)=>null!=e&&e.then?e.then(t):t(e),MS="SDK is not enabled or survey functionality is not yet loaded",PS="Disabled. Not loading surveys.";class RS{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 Qg.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(te(t))return Qg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=se(t)?t:t.length>0,Qg.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}},this._configSource=e,this._initialClientState=t}setup(e){if(!this._disposed)return this._initializingClient=e,TS(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(Yg)||null!=i&&i.startsWith(Jg))&&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)Qg.info("Already initializing surveys, skipping...");else if(e.disableSurveys)Qg.info(PS);else if(e.cookielessMode&&this._configSource.isOptedOut())Qg.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 s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Wn),void(this._isInitializingSurveys=!1);s((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 Qg.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),Qg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){Qg.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 Qg.info(PS),e([]);var s=i.kv.get(hn);if(s&&!t)return e(s,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then((t=>{this._disposed||e(t.surveys,t.context)})).catch((e=>Qg.error("Error in survey callback",e)));else{var n=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 Qg.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}}),(e=>this._handleSurveyResponse(i,{statusCode:0,error:e})));this._getSurveysInFlightPromise=n;var o=()=>{this._getSurveysInFlightPromise===n&&(this._getSurveysInFlightPromise=null)};n.then((t=>{o(),this._disposed||e(t.surveys,t.context)}),o).catch((e=>Qg.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(MS)})))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:MS}};var r=t.statusCode;if(200!==r||!t.json){var i="Surveys API could not be loaded, status: "+r;return 0!==r?Qg.error(i):t.error||Qg.warn(i),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this._lastSurveyRefreshFailedAt=null;var s,n=t.json.surveys||[],o=n.filter((e=>Kg(e)&&(Ta(e)||Zg(e))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),e.kv.set({[hn]:n,[pn]:Date.now()}),{surveys:n,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(pn);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};t_(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){Qg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Qg.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:MS};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:MS};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 Qg.warn("init was not called"),{visible:!1,disabledReason:MS};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return te(this._surveyManager)?(Qg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:MS})):new Promise((r=>{this.getSurveys((t=>{var i,s=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(s){var n=this._checkSurveyRenderability(s);r({visible:n.eligible,disabledReason:n.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var s;if(te(this._surveyManager))Qg.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(r_.includes(n.type)){var o=null==i?void 0:i.querySelector(t);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){Qg.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var e,t;this._renderTimeouts.delete(a),this._disposed||(Qg.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,o,r),Qg.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(a)}else this._surveyManager.renderSurvey(n,o,r);else Qg.warn("Survey element not found")}else Qg.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Qg.warn("Survey not found")}}displaySurvey(e,t){var r;if(te(this._surveyManager))Qg.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var s=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=_({},i,{appearance:_({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Gg&&t.initialResponses&&Qg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this._checkSurveyEligibility(i);if(!n.eligible)return void Qg.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Qg.warn("Survey not found")}}cancelPendingSurvey(e){te(this._surveyManager)?Qg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}function FS(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 LS{constructor(e){this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Rb,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 Rb}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(!FS(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=>FS(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!n&&FS((s=n.match(/(?::|")href="(.*?)"/))?s[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=>FS(e.text,t.text,t.text_matching||"exact")||FS(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(s=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),n=t.text,o=t.text_matching||"exact",s.some((e=>FS(e,n,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var s=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}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||La(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 AS{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&&La(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===Dg?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems((e=>{s=e.filter((e=>null==i?void 0:i.includes(e.id)))})),s.filter((i=>{var s,n=null==(s=i.conditions)||null==(s=s[r])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,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 LS(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,s=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}}))})),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var s;t&&(null==(s=this._actionMatcher)||s.replace([]))}}_mergeItemMaps(e,t){t.forEach(((t,r)=>{var i,s=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach((e=>{s.includes(e)||s.push(e)})),e.set(r,s)}))}_setupEventBasedItems(e,t){var r,i,s=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})),n=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,Dg),a=this._buildEventToItemMap(e,Ng);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==s.length||0!==n.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,s=this._getLogger(),n=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this._activationOutcome(e,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._deactivateItems([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:e,itemId:n}),this._persistActivation(n),void this._clearActivationTimestamps([n])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,Ng);a.length>0&&(s.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)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,Dg);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 s of e)r&&this._shouldPersistArmedActivation(s)?this._persistActivation(s)&&this._recordActivationTimestamp(s):i.push(s);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(_({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var s of Object.entries(t)){var n=s[0],o=s[1];e.includes(n)?i=!0:r[n]=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()],s=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return s&&i===s?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(),s=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter((e=>re(s[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 OS extends AS{constructor(e){super(e)}_getActivatedKey(){return gn}_getActivatedSessionKey(){return _n}_getActivationTimestampsKey(){return vn}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[vn]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(vn)}_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 Vg.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 Qg}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[gn]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[_n]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(_n)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||Ma(r)?e===Vg.SHOWN?"consume":"ignore":e===Vg.SHOWN?"persist":e===Vg.DISMISSED||e===Vg.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class DS{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 NS{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 OS(this._instance)}}var BS=null!=e&&e.location?gi(e.location.hash,"__posthog")||gi(location.hash,"state"):null,qS="_postHogToolbarParams",HS=Zr("[Toolbar]"),$S=Zr("[FeatureFlags]");class WS{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,s,n,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!==(s=e.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==n?n:[],flagKeys:G(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||($S.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)||$S.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}}var US=Zr("[FeatureFlags]"),zS=Zr("[FeatureFlags]",{debugEnabled:!0}),VS="\" failed. Feature flags didn't load in time.",jS="connection_error",GS=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},QS=e=>{var t={};for(var r of ei(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},KS="Refusing to render web experiment since the viewer is a likely bot",ZS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Pa(t,e),not_regex:(e,t)=>!Pa(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class YS{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{YS._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(YS._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 s in e.variants){var n=e.variants[s];YS._matchesTestVariant(n,t._instance)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())YS._logInfo(KS);else if(!this._config.disable_web_experiments){if(te(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();YS._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),s=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=s&&s.variants[i]&&this._applyTransforms(s.name,i,s.variants[i].transforms)}}))}}previewWebExperiment(){var e=YS.getWindowLocation();if(null!=e&&e.search){var t=hi(null==e?void 0:e.search,"__experiment_id"),r=hi(null==e?void 0:e.search,"__experiment_variant");t&&r&&(YS._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&&(YS._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)&&YS._matchUrlConditions(e,t)&&YS._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=YS.getWindowLocation();if(i){var s,n,o,a=fi(t,i.href);return null==(s=e.conditions)||!s.url||ZS[null!==(n=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"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=Qa();if(r.utm_source){var i,s,n,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==r.utm_campaign,h=null==(n=e.conditions)||null==(n=n.utm)||!n.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,g=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&&g&&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];Kr.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?YS._logInfo(KS):"control"!==t?r.forEach((r=>{if(r.selector){var i;YS._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var s=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==s||s.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):YS._logInfo("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?Ob(r,this._config.custom_blocked_useragents):void 0}}var JS=Zr("[Conversations]"),XS="Conversations not available yet.";function ew(e,t){var i,s,n,o,a,l,u,c=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,d=null!==(s=null==e?void 0:e.maxBufferSize)&&void 0!==s?s:100,h=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,p=Y(h)?Math.max(d,2048):Math.max(d,h),g=_({},function(){var e="",t="";try{var i=null==r?void 0:r.userAgent;if(i){var s=xt(i);e=s[0],t=s[1]}}catch(e){}return function(e,t){var r=function(e){if(e)return{}.hasOwnProperty.call(Xt,e)?Xt[e]:e}(e);return _({},r?{"os.name":r}:{},t?{"os.version":t}:{})}(e,t)}(),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==g?void 0:g["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==g?void 0:g["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(u=null==g?void 0:g["deployment.environment"])&&void 0!==u?u:null==e?void 0:e.environment,resourceAttributes:g,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var tw=["debug","log","warn","error","info"],rw="console",iw="__posthogHandledLogsRequestError",sw=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[iw]=!0,r},nw=e=>!!e&&"object"==typeof e&&!0===e[iw],ow={featureFlags:class{constructor(e){this.name=s_,this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=US,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._instance=e,this._mutableConfigSource=new WS(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]"),TS(e.kv.initialize(),(()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))}))}_finishSetup(t){var r;if(this._client===t)return e&&oi(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties((()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues)),this._crossTabPersistenceUnsubscribe=null==(r=this._instance)||null==(r=r.persistence)?void 0:r.onCrossTabFeatureFlagChange((()=>{this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()})),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&&oi(i,Qn,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(Qn,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,r;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,null==(r=this._crossTabPersistenceUnsubscribe)||r.call(this),this._crossTabPersistenceUnsubscribe=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)}))}_markCrossTabFeatureFlagSnapshot(e,t,r){var i;if(null!=(i=this._instance)&&i.persistence&&e[Xs]){var s=this._prop(Xs)||{},n=e[Xs]||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter((e=>{var t=e[1];return!(null!=t&&t.failed)})).map((e=>e[0])):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:r&&!G(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),c=this._prop(sn)||{},d=e[sn]||{},h=l||r?u:Array.from(new Set([...Object.keys(c),...Object.keys(d)])),p=!l&&!r,g=!!p||u,_={[en]:g,[Xs]:g,[sn]:!!p||h};for(var v of(e[rn]&&(_[rn]=g),[nn,Sn,on]))Y(e[v])||(_[v]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}_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[en,sn,nn,an]){var r=this._prop(t);Y(r)||(e[t]=r)}this._baseEventProperties=e;var i=_({},e),s=this._prop(Xs);if(s)for(var n of Object.entries(s))i["$feature/"+n[0]]=n[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(Sn);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 s,n,o=null!==(s=null==(n=r.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},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,s,n=null!=r&&r.merge&&null!==(i=this._prop(Xs))&&void 0!==i?i:{},o=null!=r&&r.merge&&null!==(s=this._prop(sn))&&void 0!==s?s:{},a=_({},n,e),l=_({},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(rn),t=this._prop(an),r=this._prop(ln);if(!r&&!t)return e||{};var i=Xr({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=i[n],u=null==t?void 0:t[n],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[n],p=_({},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=_({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[n]=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(Xs),t=this._prop(an);if(!t)return e||{};for(var r=Xr({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];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(sn),t=this._prop(ln);if(!t)return e||{};for(var r=Xr({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];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(mn)}_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:_({},t.initialPersonProperties,this._prop(un)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(cn),timezone:rl()};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 s=this._getValidFlagKeys();Y(s)||(r.flag_keys=s);var n=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&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({[bn]:[jS]}),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,s=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?jS:"unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var c=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),this._set({[bn]: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(s,o,{partialResponse:n}),l()}}else l()})).catch(u)}catch(e){u(e)}}}_hasStatusZeroCircuitBreakerTripped(){return _i(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=vi(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+VS)}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(),s=e in i,n=i[e],o=this.getFlagPayloads()[e],a=String(n),l=this._prop(nn)||void 0,u=this._prop(Sn)||void 0,c=this._prop(mn)||{};if(this._config.deduplicateCallsPerSession){var d,h=null==(d=this._client)?void 0:d.session.sessionId,p=this._prop(yn);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({[mn]:c,[yn]:r});else{var g,v,f,m,b,S,w,k,C,x,E,I;G(c[e])?c[e].push(a):c[e]=[a],this._set(_({[mn]:c},r?{[yn]:r}:{}));var T=this.getFeatureFlagDetails(e),M=[...null!==(g=this._prop(bn))&&void 0!==g?g:[]];Y(n)&&M.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(v=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==v?v: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==T||null==(S=T.metadata)?void 0:S.has_experiment)||(P.$feature_flag_has_experiment=T.metadata.has_experiment),Y(null==T||null==(w=T.metadata)?void 0:w.version)||(P.$feature_flag_version=T.metadata.version);var R,F=null!==(k=null==T||null==(C=T.reason)?void 0:C.description)&&void 0!==k?k:null==T||null==(x=T.reason)?void 0:x.code;F&&(P.$feature_flag_reason=F),null!=T&&null!=(E=T.metadata)&&E.id&&(P.$feature_flag_id=T.metadata.id),Y(null==T?void 0:T.original_variant)&&Y(null==T?void 0:T.original_enabled)||(P.$feature_flag_original_response=Y(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(I=T.metadata)&&I.original_payload&&(P.$feature_flag_original_payload=null==T||null==(R=T.metadata)?void 0:R.original_payload),M.length&&(P.$feature_flag_error=M.join(",")),this._captureFeatureFlagCalled(P)}else r&&this._set({[mn]:c,[yn]:r});if(s)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:y(o)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+VS)}_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 g((function*(){var i=r._client;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r._getValidEvaluationEnvironments();n.length&&(s.evaluation_contexts=n);var o,a=r._getValidFlagKeys();Y(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,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+VS),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,s,n){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===n&&(n=US);var o=((e,t)=>{var r=e.flags;return r?_({},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!Y(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,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(G(l)){n.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{[en]:l,[Xs]:h,[on]:!1}}var g=l,v=u,f=a;if(null!=s&&s.partialResponse){var m=Object.keys(g),y=v||{};g=_({},t,g),v=_({},r,y),m.forEach((e=>{var t;e in y||null==(t=v)||delete t[e]})),f=_({},i,f)}else if(e.errorsWhileComputingFlags)if(a){var b=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));g=_({},t,Object.fromEntries(Object.entries(g).filter((e=>b.has(e[0])))));var S=Object.fromEntries(Object.entries(v||{}).filter((e=>b.has(e[0]))));v=_({},r,S),b.forEach((e=>{var t;e in S||null==(t=v)||delete t[e]})),f=_({},i,Object.fromEntries(Object.entries(f||{}).filter((e=>b.has(e[0])))))}else g=_({},t,g),v=_({},r,v),f=_({},i,f);return _({[en]:Object.keys(QS(g)),[Xs]:g||{},[sn]:v||{},[rn]:f||{},[on]:!0===e.minimalFlagCalledEvents},c?{[nn]:c}:{},d?{[Sn]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);i&&(this._markCrossTabFeatureFlagSnapshot(i,e,!(null==r||!r.partialResponse)),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([an,ln]),this._fireFeatureFlagsCallbacks(),void zS.info("All overrides cleared");if(G(e))return this._set({[an]:GS(e)}),this._fireFeatureFlagsCallbacks(),void zS.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={},s=r.flags,n=r.payloads;return s&&(i[an]=G(s)?GS(s):s),n&&(i[ln]=n),Object.keys(i).length&&this._set(i),!1===s&&!1===n?this._remove([an,ln]):!1===s?this._remove(an):!1===n&&this._remove(ln),this._fireFeatureFlagsCallbacks(),!1===s?zS.info("Flag overrides cleared"):s&&zS.info("Flag overrides set",{flags:s}),void(!1===n?zS.info("Payload overrides cleared"):n&&zS.info("Payload overrides set",{payloads:n}))}if(e&&"object"==typeof e)return this._set({[an]:e}),this._fireFeatureFlagsCallbacks(),void zS.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,s=(this._prop(tn)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=_({},this.getFlagVariants(),{[e]:t});null==(i=this._instance)||null==(i=i.persistence)||i.markCrossTabFeatureFlagChanges({[en]:[e],[Xs]:[e],[un]:Object.keys(n)}),this._set({[en]:Object.keys(QS(a)),[Xs]:a,[un]:_({},this._prop(un)||{},n)}),this._fireFeatureFlagsCallbacks();try{var l;null==(l=this._client)||l.capture("$feature_enrollment_update",o).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(tn);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return g((function*(){var i=r._client;if(i){var s,n=t?"&"+t.map((e=>"stage="+e)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r._set({[tn]:s=o.json.earlyAccessFeatures})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(s)}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(un)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in r||(n[o]=s[o]));this._set({[un]:_({},r,n,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=_({},this._prop(un)||{});e.forEach((e=>{delete r[e]})),this._set({[un]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(un),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(cn)||{},i=_({},r);for(var s of Object.keys(e))i[s]=_({},r[s],e[s]);this._set({[cn]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(cn)||{};this._set({[cn]:_({},t,{[e]:{}})})}else this._remove(cn)}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}}},aw={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===oo||this._recordingStatus===ao?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=eo,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 bS.error("started without valid sessionManager"),new Error(yS+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===zn)throw new Error(yS+' cannot be used with cookieless_mode="always"');null!=i&&i.addEventListener&&oi(i,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(void 0===e?{}:e).discardBufferedEvents,r=void 0!==t&&t;this._sessionRecordingDisposed=!0,null==i||null==i.removeEventListener||i.removeEventListener("visibilitychange",this._onVisibilityChange),r?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t,r=!(null==(t=this._instance.get_property(Ns))||!t.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&r&&i&&!s}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),bS.info("starting")):(this._recordingStatus=eo,this.stopRecording())}}_lazyLoadAndStart(e){var t,r;if(this._isRecordingEnabled)if(this._recordingStatus!==oo&&this._recordingStatus!==ao&&(this._recordingStatus=no),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=h.__PosthogExtensions__)&&r.initSessionRecording)this._onScriptLoaded(e);else{var i,s=this._instance.sessionManager;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===s)return t?(this._instance.register_for_session({[Ln]:!0}),bS.error("could not load recorder",t)):void this._onScriptLoaded(e);this._recordingStatus=eo}))}}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(e){var t,r;void 0===e&&(e=!1),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=void 0,null==(r=this._lazyLoadedSessionRecording)||r.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(zs),null==(t=this._persistence)||t.unregister(Bs)}_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?(bS.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,s=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=s?s:n;te(o)&&this._resetSampling();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[Ns]:_({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:_({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})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(s)}}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===oo&&(this._recordingStatus=ao,bS.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):bS.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(Ns);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(Ns);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return bS.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<=Tl}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return bS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ln]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(s=h.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ao||this._recordingStatus===oo)return;return this._recordingStatus=oo,bS.info("persisted remote config is stale, requesting fresh config before starting"),void new lb(this._instance).load()}this._recordingStatus=no,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=eo}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({[Hs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[qs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?$s:Ws]:!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))}}},lw={autocapture:class extends ky{constructor(e){super(new dS(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&&(Kr.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,Kr.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;zh(e.history,t,(e=>function(r,s,n){e.call(this,r,s,n),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(Zn,{navigation_type:e}),this._lastLocation=t}catch(t){Kr.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var t=()=>{this._capturePageview("popstate")};oi(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var t=()=>{this._capturePageview("hashchange")};oi(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[Ts]),this.rageclicks=new fy(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;SS.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({[Ts]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){wS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(i)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&i&&(this._flushHandler=this._flush.bind(this),oi(e,Kn,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),oi(i,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),oi(i,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new qy(this.instance,Ny,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),oi(i,Qn,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&i&&(this._flushHandler&&e.removeEventListener(Kn,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(Qn,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(t=this._deadClicksCapture)||t.stop(),this._initialized=!1)}_getProperties(t,r){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(t,r,i){for(var s=t;s&&Ci(s)&&!xi(s,"body");){if(s===i)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:e)?void 0:o.getComputedStyle(s).position}catch(e){return!1}if(q(r,n))return!0;s=Ni(s)}return!1}(Ai(t),["fixed","sticky"],n);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:i),target_fixed:o,type:r}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!ki(e.target)&&wS(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Vi(Ai(e),this.instance.config.rageclick)&&this._capture(_({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!ki(e.target)&&wS(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?Rt(e.location.href):e.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...za,...i||[]]:[],n=pi(r,s,ja);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(t)}}_flush(){this._buffer&&!Z(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:qy,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",_({$current_url:this._buffer.url},this._buffer.metrics.reduce(((e,t)=>_({},e,{["$web_vitals_"+t.name+"_event"]:_({},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))gS.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!Y(i)){var s=re(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Y(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=i),this._buffer.firstMetricTimestamp=Y(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=_({},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 mS){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(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else gS.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,s=!1,n=h.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Y(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!Y(a)){var l=a.withoutAttribution,u=this.attributionMetrics;s=!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=s&&this.attributionMetrics.indexOf("INP")>-1?_({},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 gS.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Fs]),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[Ds])||vS: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 se(e)?e?vS:[]:G(e)?e:fS}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:_S;return e>0&&6e4>=e?_S:e}get isEnabled(){var e=null==s?void 0:s.protocol;if("http:"!==e&&"https:"!==e)return gS.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=K(this._perfConfig)?this._perfConfig.web_vitals:se(this._perfConfig)?this._perfConfig:void 0;return se(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(gS.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({[Fs]:r}),this._instance.persistence.register({[Ds]: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?gS.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?Rt(r):r,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...za,...s||[]]:[];return pi(i,n,ja)}gS.error("Could not determine current URL")}}},uw={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,s=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=s(this.captureException.bind(this)))}catch(e){hS.error("failed to start",e),this._stopCapturing()}}},this._instance=t,this._remoteEnabled=!(null==(r=this._instance.persistence)||!r.props[Ms]),this._rateLimiter=new fe(_({},function(e){var t,r,i,s;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!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:hS})),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=_({},t,e):(Y(e)?this._remoteEnabled:e)&&(t=_({},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?(hS.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 hS.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({[Ms]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,s=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(s)?hS.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=yf(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Ps))&&void 0!==t?t:[],this._exceptionStepsConfig=zr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Vr(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=zr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var s=e.config;if("errorTracking"in s){var n=null!==(t=null==(r=s.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=s.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[Ps]:this._suppressionRules,[Rs]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Rs),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 _f.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)=>Wr.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,s=r.droppedKeys;s.length>0&&_f.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(_({[Hr]:e,[$r]:(new Date).toISOString()},i))}catch(e){_f.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 _f.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 _f.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 _f.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 _f.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(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;i&&(r.$release_id=i);try{var s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return _f.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void _f.error("Failed to process exception event. Ignoring this exception.",e)}var n}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:_({},e,{$exception_steps:t})}catch(t){return _f.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Hr]:e,[$r]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return K(e)?_({},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=Fa[e.operator],i=t[e.key];if(!r||!i)return!1;var s=G(e.value)?e.value:[e.value];return s.length>0&&r(s,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return _f.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:[]})),r=t.filter((e=>{var t=e.filename;return!!t&&ff.some((e=>t.startsWith(e)))}));return 0!==r.length&&(!r.every((e=>{var t=e.filename;return!!t&&t.startsWith(vf)}))||e.some((e=>{var t=e.value;return J(t)&&t.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((e=>{var t=e.filename;return e.in_app&&!(null!=t&&t.startsWith(vf))})))}_isInjectedBrowserScriptException(e){return e.some((e=>{var t=e.value;return J(t)&&mf.some((e=>t.includes(e)))}))}_isPostHogException(e){if(e.length>0){var t,r,i,s,n=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(i=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!te(e)&&G(e)}}},cw=_({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({[As]:!!t.productTours}),!CS(this._instance))return!this._productTourManager&&te(null==(r=this._persistence)?void 0:r.props[fn])||kS.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&&CS(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?kS.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[fn];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(CS(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||kS.warn(s):kS.error(s),void e([],{isLoaded:!1,error:s})}var n=G(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,r&&r.register({[fn]:n}),e(n,{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(fn)}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)}}},ow),dw={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,s,n,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,g=e.$set;return{event:_({},v(e,xS),{properties:_({},e.properties,g?{$set:_({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:_({},null!==(i=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==i?i:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_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)||(ES.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)||(ES.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,s,n,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,g=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push((()=>{e[t]=i}))}},_=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},v=e=>e.map((e=>"string"==typeof e?e:_(e))).filter((e=>!ee(e)));return g(c,"appendChild",(e=>function(t){var r=_(t);return r?e.call(this,r):t})),g(c,"insertBefore",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):t})),g(c,"replaceChild",(e=>function(t,r){var i=_(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==(s=u.DocumentFragment)?void 0:s.prototype].forEach((e=>{g(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,v(r))})),g(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,v(r))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((e=>{g(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,v(r))})),g(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,v(r))})),g(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var s=v(r);return r.length&&!s.length?void 0:e.apply(this,s)}))})),g(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(e=>function(t,r){var i=_(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&&(ES.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,s=s=>{t.errored=!s,t.loaded=!0,ES.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&r()};try{var n=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),s(e)}})),!1).processEvent;n&&(t.processEvent=n),i=!0}catch(t){ES.error(IS+e.id,t),s(!1)}if(i&&t.loaded)try{r()}catch(r){ES.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){ES.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var s of Object.values(this.apps))i(s)}}onRemoteConfig(e){var t,r,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ES.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 n=e.config;if(null!=(i=n.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,r,(e=>{if(e)return ES.error(IS+t,e)}))};for(var a of n.siteApps)o()}else ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},hw={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 pS.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()}}},pw=_({surveys:class extends RS{constructor(e){var t;super(new NS(e),{get projectToken(){return t.config.token},kv:new DS(t=e)}),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?pb(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})}))}}},ow),gw={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,s){if(void 0===t&&(t=void 0),void 0===r&&(r=void 0),void 0===s&&(s=void 0),ai(this.instance.config))return!1;if(!e||!i)return!1;t=null!=t?t:e.location,s=null!=s?s: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 n,o=BS||gi(t.hash,"__posthog")||gi(t.hash,"state"),a=o?ti((()=>JSON.parse(atob(decodeURIComponent(o)))))||ti((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?t.hash=a.desiredHash:s?s.replaceState(s.state,"",t.pathname+t.search):t.hash="")):((n=JSON.parse(r.getItem(qS)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),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):HS.warn("No toolbar load function found")}loadToolbar(t){var r=!(null==i||!i.getElementById(yi));if(!e||r)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=_({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(e.localStorage.setItem(qS,JSON.stringify(_({},n,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(n);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 HS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),oi(e,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(n)}))}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)}}},_w=_({experiments:YS},ow),vw={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)||(se(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||ai(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(Wn);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 JS.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,JS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else JS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){JS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():JS.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":ai(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 g((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(JS.warn(XS),null)}))()}getMessages(e,t){var r=this;return g((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(JS.warn(XS),null)}))()}markAsRead(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(JS.warn(XS),null)}))()}getTickets(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(JS.warn(XS),null)}))()}requestRestoreLink(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(JS.warn(XS),null)}))()}restoreFromToken(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(JS.warn(XS),null)}))()}restoreFromUrlToken(){var e=this;return g((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(JS.warn(XS),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()}}},fw={logs:class{constructor(t){var r,i=this;this.name=n_,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Zr("[logs]"),this._coreLogger=_({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(nw)||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&&oi(e,"online",this._onReconnect)}_buildCore(e,t,r,i){var s,n=ew(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,r);return[new or(this._createHost(e,t),n,this._coreLogger,(()=>this._getSdkContext()),(e=>e()),void 0,i),n]}_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},rw);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,s;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==(s=this._consoleCore)||s.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({[Os]:!!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[Os])}_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=ew(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=function(e){var i;try{i=rf(h.console[e])}catch(e){return 0}if(!i)return 0;t._consoleRecorderUnpatchers.push(zh(h.console,e,(s=>{var n=function(){for(var i=arguments.length,n=new Array(i),o=0;i>o;o++)n[o]=arguments[o];try{t._recordConsoleEntry(e,n,r)}catch(e){}return s.apply(h.console,n)};return n.__rrweb_original__=i,n})))};for(var s of tw)i(s);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){nw(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(Wn),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,s,n=this._takeConsoleBuffer();this._consoleLogsDispose=r.initializeLogs(null!==(i=this._client)&&void 0!==i?i:this._instance),this._isLoaded=!0,n.length>0&&(null==r.replayConsoleBuffer||r.replayConsoleBuffer(null!==(s=this._client)&&void 0!==s?s:this._instance,n))}}}))}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:()=>Gr.LIB_NAME,getLibraryVersion:()=>Gr.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(_i(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:sw(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(s),t(e))},s=setTimeout((()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:sw(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:sw(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=vi(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,Gr.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,rw,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,s){if(0!==t.length){var n=t.map((e=>e.record));s([]);var o=nr(n,sr(r,Gr.LIB_NAME,Gr.LIB_VERSION),i,Gr.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,s=r.sessionStartTimestamp,n=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,te(s)||(t.sessionStartTimestamp=s),te(n)||(t.lastActivityTimestamp=n)}if(null!=h&&null!=(e=h.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Rt(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},mw={metrics:class{constructor(e){this._logger=Zr("[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 cr(this._createHost(),function(e){var t,r,i,s,n,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!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==n?n: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:()=>Gr.LIB_NAME,getLibraryVersion:()=>Gr.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((r=>{var i=!1,s=e=>{i||(i=!0,clearTimeout(n),r(e))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(_({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)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;s({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)}}},yw=_({},ow,aw,lw,uw,cw,dw,pw,hw,gw,_w,vw,fw,mw);cS.__defaultExtensionClasses=_({},yw),function(){Gr.SDK_DIST_CHANNEL="cdn";var t=h.posthog;if(!t||G(t._i)){var r=Kb[iS]=new cS;if(t){var s=[];Jr(t._i,(function(e){if(e&&G(e)){var i=r.init(e[0],e[1],e[2]),n=t[e[2]]||t;i.__loaded&&-1===s.indexOf(n)&&(s.push(n),i._execute_array.call(i.people,n.people),i._execute_array(n))}}))}r.__SV=1,h.posthog=r,function(){function t(){t.done||(t.done=!0,sS=!1,Jr(Kb,(function(e){e._dom_loaded()})))}null!=i&&i.addEventListener?"complete"===i.readyState?t():oi(i,"DOMContentLoaded",t,{capture:!1}):e&&Kr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}();
1
+ !function(){"use strict";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,s=null==t?void 0:t.location,n=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,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,s)}function g(e){return function(){var t=this,r=arguments;return new Promise((function(i,s){var n=e.apply(t,r);function o(e){p(n,i,s,o,a,"next",e)}function a(e){p(n,i,s,o,a,"throw",e)}o(void 0)}))}}function _(){return _=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},_.apply(null,arguments)}function v(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}({}),x="min_length",E="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"],T=["token"],M=20,P=1e3,R=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 s=e.charCodeAt(r+1);56320>s||s>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","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],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()},W=function(e){return e.replace(/^\$/,"")};function U(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,se=e=>"[object Boolean]"===j.call(e),ne=e=>e instanceof FormData,oe=e=>q(I,e),ae=e=>q(T,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"],ge=e=>q(pe,e),_e=[!1,"false",0,"0","no"];function ve(e,t,r,i,s){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: "+s),ve(s||r,t,r,i))}class fe{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ve(e.bucketSize,0,100,e._logger),this._refillRate=ve(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ve(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),s=this._buckets[i];return s?this._applyRefill(s,r):this._buckets[i]=s={tokens:this._bucketSize,lastAccess:r},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}}var me="Mobile",ye="iOS",be="Android",Se="Tablet",we=be+" "+Se,ke="iPad",Ce="Apple",xe=Ce+" Watch",Ee="Safari",Ie="BlackBerry",Te="Samsung",Me=Te+"Browser",Pe=Te+" Internet",Re="Chrome",Fe=Re+" OS",Le=Re+" "+ye,Ae="Internet Explorer",Oe=Ae+" "+me,De="Opera",Ne=De+" Mini",Be="Edge",qe="Microsoft "+Be,He="Firefox",$e=He+" "+ye,We="Nintendo",Ue="PlayStation",ze="Xbox",Ve=be+" "+me,je=me+" "+Ee,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",st="Whale",nt="DuckDuckGo",ot="Pale Moon",at="Waterfox",lt="Brave",ut="Claude",ct="Codex",dt="ChatGPT",ht="Google Search App",pt="(\\d+(\\.\\d+)?)",gt=new RegExp("Version/"+pt),_t=new RegExp("("+ut+"|"+ct+"|"+dt+")\\/"+pt),vt=new RegExp(ze,"i"),ft=new RegExp(Ue+" \\w+","i"),mt=new RegExp(We+" \\w+","i"),yt=new RegExp(Ie+"|PlayBook|BB10","i"),bt={"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"},St=function(e,t,r,i){t=t||"";var s=function(e){return null!=e&&e.brave?lt:null}(r);return s||(null!=i&&i.detectGoogleSearchApp&&q(e,"GSA/")?ht:q(e," OPR/")&&q(e,"Mini")?Ne:q(e," OPR/")?De:yt.test(e)?Ie:q(e,"IE"+me)||q(e,"WPDesktop")?Oe:q(e,"OculusBrowser")?tt:q(e,Me)?Pe:q(e,Be)||q(e,"Edg/")?qe:q(e,rt+"/")?rt:q(e,"YaBrowser/")?it:q(e,st+"/")?st:q(e,nt+"/")||q(e,"Ddg/")?nt:q(e,ut+"/")?ut:q(e,ct+"/")?ct:q(e,dt+"/")?dt:q(e,"FBIOS")?"Facebook "+me:q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?Le:q(e,"CrMo")||q(e,Re)?Re:q(e,be)&&q(e,Ee)?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,Ee)&&!q(e,Re)&&!q(e,be)}(e))(e,t)?q(e,me)?je:Ee:q(e,"PaleMoon/")?ot:q(e,at+"/")?at:q(e,He)?He:q(e,"MSIE")||q(e,"Trident/")?Ae:q(e,"Gecko")?He:"")},wt={[Oe]:[new RegExp("rv:"+pt)],[qe]:[new RegExp(Be+"?\\/"+pt)],[Re]:[new RegExp("("+Re+"|CrMo)\\/"+pt)],[Le]:[new RegExp("CriOS\\/"+pt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pt)],[Ee]:[gt],[je]:[gt],[De]:[new RegExp("(Opera|OPR)\\/"+pt)],[He]:[new RegExp(He+"\\/"+pt)],[$e]:[new RegExp("FxiOS\\/"+pt)],[et]:[new RegExp("Konqueror[:/]?"+pt,"i")],[Ie]:[new RegExp(Ie+" "+pt),gt],[Ve]:[new RegExp("android\\s"+pt,"i")],[Pe]:[new RegExp(Me+"\\/"+pt)],[tt]:[new RegExp("OculusBrowser\\/"+pt)],[rt]:[new RegExp(rt+"\\/"+pt)],[it]:[new RegExp("YaBrowser\\/"+pt)],[st]:[new RegExp(st+"\\/"+pt)],[lt]:[new RegExp(lt+"\\/"+pt)],[ut]:[_t],[ct]:[_t],[dt]:[_t],[nt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pt)],[ot]:[new RegExp("PaleMoon\\/"+pt)],[at]:[new RegExp(at+"\\/"+pt)],[ht]:[new RegExp("GSA\\/"+pt)],[Ae]:[new RegExp("(rv:|MSIE )"+pt)],Mozilla:[new RegExp("rv:"+pt)]},kt=function(e,t,r,i){var s=St(e,t,r,i),n=wt[s];if(Y(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ct=[[new RegExp(ze+"; "+ze+" (.*?)[);]","i"),e=>[ze,e&&e[1]||""]],[new RegExp(We,"i"),[We,""]],[new RegExp(Ue,"i"),[Ue,""]],[yt,[Ie,""]],[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=bt[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",""]]],xt=function(e){for(var t=0;Ct.length>t;t++){var r=Ct[t],i=r[1],s=r[0].exec(e),n=s&&(Q(i)?i(s,e):i);if(n)return n}return["",""]},Et=function(e){return mt.test(e)?We:ft.test(e)?Ue:vt.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)?xe:yt.test(e)?Ie:/(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:""},It=function(e,t){var r,i,s,n,o=Et(e);return o===ke||o===we||"Kobo"===o||"Kindle Fire"===o||o===Xe?Se:o===We||o===ze||o===Ue||o===Ze?"Console":o===xe?"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!==(s=null==t?void 0:t.screenHeight)&&void 0!==s?s:0)/(null!==(n=null==t?void 0:t.devicePixelRatio)&&void 0!==n?n:1)?me:Se:"Desktop"},Tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Mt(e,t){return"string"==typeof(r=e)&&Tt.test(r)?e:t();var r}function Pt(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 Rt(e){return e?e.split("#")[0]:e}function Ft(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}function Lt(e,t,r){return At.apply(this,arguments)}function At(){return(At=g((function*(e,t,r){var i;try{return yield Promise.race([e,new Promise(((e,s)=>{i=Ft((()=>{try{null==r||r(),e()}catch(e){s(e)}}),t)}))])}finally{clearTimeout(i)}}))).apply(this,arguments)}var Ot,Dt="NativeGzipValidationError",Nt=e=>e.length>=2&&31===e[0]&&139===e[1],Bt=(e,t)=>e===C.GZipJS||t===C.GZipJS||"gzip"===t,qt=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Ht=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return qt(e)||t===Dt},$t=e=>{throw Pt(Dt,"Native gzip produced invalid output: "+e)},Wt=function(){var e=g((function*(e,t){18>e.size&&$t("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());Nt(r)&&8===r[2]||$t("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Ot)return Ot;Ot=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Ot[e]=t>>>0}return Ot})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&$t("invalid-crc");var s=t.length>>>0;i.getUint32(4,!0)!==s&&$t("invalid-size")}));return function(t,r){return e.apply(this,arguments)}}();function Ut(e,t,r){return zt.apply(this,arguments)}function zt(){return zt=g((function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(i).then((()=>n.close())).catch(function(){var e=g((function*(e){try{yield n.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield Wt(l,i),l}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})),zt.apply(this,arguments)}var Vt=0x8000000000000000,jt="9223372036854775808",Gt={}.propertyIsEnumerable;function Qt(e,t){try{return Yt(e,t,{ancestors:new WeakSet,remainingNodes:R},0)}catch(e){return[]}}function Kt(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:L};if(r.remainingNodes--,se(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){var r=e.toString(),i=BigInt(jt);return e>=i||-i>e?(null==t||t.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}(e,t);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 s=BigInt(e).toString();return e>=Vt||-Vt>e?(null==t||t.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}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 n=e.getTime(),o=Number.isFinite(n)?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 Kt(a.call(e),t,r,i+1)}catch(e){}return G(e)?{arrayValue:{values:Zt(e,t,r,i+1)}}:{kvlistValue:{values:Yt(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:D(String(e))}}function Zt(e,t,r,i){for(var s=[],n=Math.min(e.length,P),o=0;n>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(te(a))continue;s.push(Kt(a,t,r,i))}catch(e){s.push({stringValue:A})}return e.length>o&&s.push({stringValue:L}),s}function Yt(e,t,r,i){var s=[];for(var n in e)if(Gt.call(e,n)){if(!n){null==t||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=P||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[n];if(ee(o)||Y(o))continue;s.push({key:D(n),value:Kt(o,t,r,i)})}catch(e){s.push({key:D(n),value:{stringValue:A}})}}return s}function Jt(e,t,r){return _({},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})}var Xt={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var er={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},tr=er.info;function rr(e){try{return D(String(e))}catch(e){return A}}function ir(e,t,r,i){var s,n=er[e.level||"info"]||tr,o=n.text,a=n.number,l=(void 0===(s=re(i)?i:void 0)&&(s=Date.now()),String(s)+"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=_({},u),d=e.attributes;if(d){var h=[];try{h=Object.keys(d)}catch(e){h=[]}for(var p of h){var g=void 0;try{g=d[p]}catch(e){g=A}Object.defineProperty(c,p,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var v={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:a,severityText:o,body:{stringValue:rr(e.body)},attributes:Qt(c,r)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),Y(e.trace_flags)||(v.flags=e.trace_flags),v}function sr(e,t,r){return Jt(e,t,r)}function nr(e,t,r,i){return{resourceLogs:[{resource:{attributes:Qt(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let or=class{constructor(e,t,r,i,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=s,this._waitForStoragePersist=n,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 s={record:ir(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(s)))}}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 s of r)try{var n=s(i);if(!n)return this._logger.info("Log was rejected in beforeSend function"),null;i=n}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 g((function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally((()=>{e._flushPromise=null}))),e._flushPromise}))()}_flushInner(){var e=this;return g((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,s=0;r.length>0&&i>s;){var n,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=nr(c,e._buildResourceAttributes(),null!==(n=e._scopeName)&&void 0!==n?n: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:[],s+=u.length,"fatal"===h.kind)throw h.error}}}))()}_persistQueueAdvance(e){var t=this;return g((function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),s=null!==(r=t._instance.getPersistedProperty(k.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(k.LogsQueue,s.slice(i)),yield t._waitForStoragePersist()}))()}_buildResourceAttributes(){return sr(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=Ft((()=>{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 g((function*(){t._clearFlushTimer();var r=t.flush().catch((()=>{}));void 0!==e?yield Lt(r,e):yield r}))()}flushWithTimeout(e){var t=this;return g((function*(){var r=t.flush();yield Lt(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 ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(e){return String(e)+"000000"}function ur(e,t,r,i){var s="";return i&&(s=Object.keys(i).sort().map((e=>JSON.stringify(e)+":"+JSON.stringify(i[e]))).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+s}let cr=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=g((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?_({},t.attributes):void 0,i=ur(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 s=this._series.get(i);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,s)}var n=this._typeByName.get(t.name);void 0===n?this._typeByName.set(t.name,t.type):n===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+n+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,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(ar.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,ar)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=G(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Metric was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=Ft((()=>{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 g((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 Jt(e,t,r)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Qt(r)},scopeMetrics:[{scope:{name:i,version:s},metrics:t}]}]};var t,r,i,s}_buildMetrics(e){var t=lr(Date.now()),r=new Map;for(var i of e.values()){var s,n=ur(i.type,i.name,i.unit,void 0),o=r.get(n);o||(o=_({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(n,o));var a=Qt(null!==(s=i.attributes)&&void 0!==s?s:{},this._logger),l=lr(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:ar})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var s=i[0],n=i[1],o=this._series.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=n.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function dr(e,t){if(e){var r=e.find((e=>e.type===t));return null==r?void 0:r.value}}var hr,pr,gr;function _r(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return gr&&r.length===pr||(pr=r.length,gr=r.reduce(((r,i)=>{hr||(hr={});var s=hr[i];if(s)r[s[0]]=s[1];else for(var n=e(i),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,hr[i]=[l,u];break}}return r}),{})),gr}}class vr{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),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}modifyFrames(e){var t=this;return g((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)),_({},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 g((function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r}))()}convertToExceptionList(e,t){var r,i,s,n={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!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:_r(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 s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return _({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}var fr="?";function mr(e,t,r,i,s){var n={platform:e,filename:t,function:"<anonymous>"===r?fr:r,in_app:!(null!=t&&t.startsWith("webkit-masked-url://"))&&"<anonymous>"!==t};return Y(i)||(n.lineno=i),Y(s)||(n.colno=s),n}var yr=(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]:fr,r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},br=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Sr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wr=/\((\S*)(?::(\d+))(?::(\d+))\)/,kr=(e,t)=>{var r=br.exec(e);if(r)return mr(t,r[1],fr,+r[2],+r[3]);var i=Sr.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var s=wr.exec(i[2]);s&&(i[2]=s[1],i[3]=s[2],i[4]=s[3])}var n=yr(i[1]||fr,i[2]);return mr(t,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},Cr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Er=(e,t)=>{var r=Cr.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=xr.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var s=r[3],n=r[1]||fr,o=yr(n,s);return mr(t,s=o[1],n=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},Ir=/\(error: (.*)\)/,Tr=50;class Mr{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 Pr{match(e){return ce(e)}coerce(e,t){var r,i=this.getStack(e),s=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:s}}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 Rr{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 _({},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,s=null!==(t=i.lineno)&&void 0!==t?t:0,n=null!==(r=i.colno)&&void 0!==r?r:0;if(J(i.filename)&&0!==i.filename.length&&0!==s)return"Error\n at "+i.filename+":"+s+":"+n}}var Fr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Lr{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),s=i[0],n=i[1];return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Fr);return i&&(t=i[1],r=i[2]),[t,r]}}var Ar=["fatal","error","warning","log","info","debug"];function Or(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 s=r.slice(0,i).join(", ");if(t>=s.length)return i===r.length?s:s.length>t?s.slice(0,t)+"...":s}return""}class Dr{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{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: "+Or(e)}isSeverityLevel(e){return J(e)&&!X(e)&&Ar.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 Nr{match(e){return de(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Or(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class Br{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 qr{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 Hr="$message",$r="$timestamp",Wr=new Set([Hr,$r]),Ur={enabled:!0,max_bytes:32768};function zr(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ur.enabled,max_bytes:jr(e.max_bytes,Ur.max_bytes)}:_({},Ur)}class Vr{constructor(e){this._entries=[],this._totalBytes=0,this._config=zr(e)}setConfig(e){this._config=zr(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=U(e)}catch(e){return}try{var r=JSON.parse(t);if(!K(r))return;var i=r,s=i[Hr],n=i[$r];if(!J(s)||0===s.trim().length)return;if(!J(n)&&!re(n))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 jr(e,t){if(!re(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}var Gr={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"},Qr=function(t,r){var i=(void 0===r?{}:r).debugEnabled,s={_log(r){if(e&&(Gr.DEBUG||e.POSTHOG_DEBUG||i)&&!Y(e.console)&&e.console){for(var s=("__rrweb_original__"in e.console[r]?e.console[r].__rrweb_original__:e.console[r]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(t,...o)}},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];s._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){s.error("You must initialize PostHog before calling "+e)},createLogger:(e,r)=>Qr(t+" "+e,r)};return s},Kr=Qr("[PostHog.js]"),Zr=Kr.createLogger;function Yr(e,t){G(e)&&e.forEach(t)}function Jr(e,t){if(!te(e))if(G(e))e.forEach(t);else if(ne(e))e.forEach(((e,r)=>t(e,r)));else for(var r in e)V.call(e,r)&&t(e[r],r)}var Xr=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 s of r)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function ei(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 ti=function(e){try{return e()}catch(e){return}},ri=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){Kr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Kr.critical(e)}}},ii=function(e){var t={};return Jr(e,(function(e,r){(J(e)&&e.length>0||re(e))&&(t[r]=e)})),t};var si=["herokuapp.com","vercel.app","netlify.app"];function ni(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 si)if(r===i)return!1;return!0}function oi(e,t,r,i){var s=null!=i?i:{},n=s.capture,o=s.passive;null==e||e.addEventListener(t,r,{capture:void 0!==n&&n,passive:void 0===o||o})}function ai(e){return"ph_toolbar_internal"===e.name}var li=["localhost","127.0.0.1"],ui=(e,t)=>{try{return JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t)}catch(t){return U(e)}},ci=e=>{var t=null==i?void 0:i.createElement("a");return Y(t)?null:(t.href=e,t)},di=function(e,t){var r,i;void 0===t&&(t="&");var s=[];return Jr(e,(function(e,t){Y(e)||Y(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+r)})),s.join(t)},hi=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var n=i[s].split("=");if(n[0]===t){r=n;break}}if(!G(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){Kr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},pi=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[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!=s&&(h+="#"+s),h},gi=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},_i=(e,t)=>e>=t&&c(),vi=(e,t,r,i)=>{if(0===e){if(c()){var s=t+1;return s===r&&i(),s}return t}return 0};function fi(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!Q(i))return t;try{var s=i(t);return J(s)&&s?s:t}catch(e){return Kr.error("Error in get_current_url, falling back to window.location.href",e),t}}function mi(t){var r,i=null==e||null==(r=e.location)?void 0:r.href;return Y(i)?void 0:fi(t,i)}var yi="__POSTHOG_TOOLBAR__",bi=1,Si=3,wi=11;function ki(e){return e instanceof Element&&(e.id===yi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function Ci(e){return!!e&&e.nodeType===bi}function xi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Ei(e){return!!e&&e.nodeType===Si}function Ii(e){return!!e&&e.nodeType===wi&&Ci(e.host)}var Ti=1e3;function Mi(e){return e?H(e).split(/\s+/):[]}function Pi(e,t){var r=mi(t);return!!(r&&e&&e.some((e=>r.match(e))))}function Ri(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 Mi(t)}function Fi(e){return te(e)?null:H(e).split(/(\s+)/).filter((e=>is(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Li(e){var t="";return Qi(e)&&!Ki(e)&&e.childNodes&&e.childNodes.length&&Jr(e.childNodes,(function(e){var r;Ei(e)&&e.textContent&&(t+=null!==(r=Fi(e.textContent))&&void 0!==r?r:"")})),H(t)}function Ai(e){var t;return Y(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Oi=["a","button","form","input","select","textarea","label"];function Di(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 s of e)if(r=i(s))return r.v;return!1}function Ni(e){var t=e.parentNode;return!(!t||!Ci(t))&&t}var Bi=[".ph-no-autocapture","[data-ph-no-autocapture]"],qi=["next","previous","prev",">","<"],Hi=[...qi,"+","-","−","–"],$i=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Wi=[".ph-no-deadclick",".ph-no-capture"],Ui=[".ph-no-rageclick",".ph-no-capture"],zi=["","text","search","email","password","url","tel","number"];function Vi(t,r){if(!e||ji(t))return!1;var i,s,n,o,a;if(se(r)?(i=!!r&&Ui,s=void 0,n=!1):(i=null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:Ui,s=null==r?void 0:r.content_ignorelist,n=null!==(a=null==r?void 0:r.ignore_text_selection)&&void 0!==a&&a),!1===i)return!1;if(n&&function(e){return!(!e||!Ci(e))&&(!!xi(e,"textarea")||(xi(e,"input")?q(zi,(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=Gi(t,!1).targetElementList;return!function(e,t){if(!1===e||Y(e))return!1;var r;if(!0===e)r=qi;else{if(!G(e))return!1;if(e.length>10)return Kr.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=>$i(t,e)||$i(i,e)))}))}(s,l.map((e=>{var t;return{safeText:Li(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Di(l,i)}var ji=e=>!e||xi(e,"html")||!Ci(e),Gi=(t,r)=>{if(!e||ji(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[t],n=t;n.parentNode&&!xi(n,"body");)if(Ii(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Ni(n);if(!o)break;if(r||Oi.indexOf(o.tagName.toLowerCase())>-1)i=!0;else try{var a=e.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:s}};function Qi(e){for(var t=new Set,r=0,i=e;i.parentNode&&!xi(i,"body");i=i.parentNode){if(r++>=Ti||t.has(i))return!1;t.add(i);var s=Ri(i);if(q(s,"ph-sensitive")||q(s,"ph-no-capture"))return!1}if(q(Ri(e),"ph-include"))return!0;var n=e.type||"";if(J(n))switch(n.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 Ki(e){return!!(xi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xi(e,"select")||xi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Zi=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}))$"),Yi=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ji=[16,15,14,13],Xi=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),es=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ts=/[0-9A-Za-z_]/;function rs(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var s=e.charCodeAt(i)-48;r&&(s*=2)>9&&(s-=9),t+=s,r=!r}return t%10==0}function is(e,t){if(void 0===t&&(t=!0),te(e))return!1;if(J(e)){e=H(e);var r=t?Zi.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Yi.lastIndex=0;t=Yi.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),s=0;i.length>s;s++)for(var n of Ji){var o=s+n;if(i.length>=o){var a=i.slice(s,o);if(Zi.test(a)&&rs(a))return!0}}}return!1}(e);if(r)return!1;var i=t?Xi.test(e):function(e){var t;for(es.lastIndex=0;t=es.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&ts.test(r)&&ts.test(i)))return!0}return!1}(e);if(i)return!1}return!0}function ss(e){var t=Li(e);return is(t=(t+" "+ns(e)).trim())?t:""}function ns(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Jr(e.childNodes,(function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=Li(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+ns(e)).trim())}catch(e){Kr.error("[AutoCapture]",e)}})),t}function os(e){return e.replace(/"|\\"/g,'\\"')}function as(e){var t=e.attr__class;if(t)return G(t)?t:Mi(t)}var ls="[SessionRecording]",us="redacted",cs=1e6;function ds(e){var t;return Math.min(cs,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:cs)}var hs={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:cs,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},ps=["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"],gs=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],_s=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],vs=e=>{te(e)||Jr(Object.keys(e),(t=>{(e=>{var t=e.toLowerCase();return ps.includes(t)||_s.some((e=>t.includes(e)))})(t)&&(e[t]=us)}))},fs=["/s/","/e/","/i/"];function ms(e,t,r,i){if(te(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return J(s)&&(s=parseInt(s)),s>r?ls+" "+i+" body too large to record ("+s+" bytes)":e}function ys(e,t){if(te(e))return e;var r=e;return is(r,!1)||(r=ls+" "+t+" body "+us),Jr(gs,(e=>{var i,s;null!=(i=r)&&i.length&&-1!==(null==(s=r)?void 0:s.indexOf(e))&&(r=ls+" "+t+" body "+us+" as might contain: "+e)})),r}var bs=new WeakSet,Ss="$people_distinct_id",ws="distinct_id",ks="$device_id",Cs="$device_model",xs="__alias",Es="__timers",Is="$autocapture_disabled_server_side",Ts="$heatmaps_enabled_server_side",Ms="$exception_capture_enabled_server_side",Ps="$error_tracking_suppression_rules",Rs="$error_tracking_capture_extension_exceptions",Fs="$web_vitals_enabled_server_side",Ls="$dead_clicks_enabled_server_side",As="$product_tours_enabled_server_side",Os="$logs_capture_enabled_server_side",Ds="$web_vitals_allowed_metrics",Ns="$session_recording_remote_config",Bs="$replay_sample_rate",qs="$replay_override_sampling",Hs="$replay_override_linked_flag",$s="$replay_override_url_trigger",Ws="$replay_override_event_trigger",Us="$sesid",zs="$session_is_sampled",Vs="$session_past_minimum_duration",js="$session_recording_url_trigger_activated_session",Gs="$session_recording_event_trigger_activated_session",Qs="$posthog_sr_group_event_trigger_",Ks="$posthog_sr_group_url_trigger_",Zs="$posthog_sr_group_sampling_",Ys="$debug_first_full_snapshot_timestamp",Js="$sess_rec_flush_size",Xs="$enabled_feature_flags",en="$active_feature_flags",tn="$early_access_features",rn="$feature_flag_details",sn="$feature_flag_payloads",nn="$feature_flag_request_id",on="$minimal_flag_called_events",an="$override_feature_flags",ln="$override_feature_flag_payloads",un="$stored_person_properties",cn="$stored_group_properties",dn="$groups",hn="$surveys",pn="$surveys_loaded_at",gn="$surveys_activated",_n="$surveys_activated_session",vn="$surveys_activated_timestamps",fn="ph_product_tours",mn="$flag_call_reported",yn="$flag_call_reported_session_id",bn="$feature_flag_errors",Sn="$feature_flag_evaluated_at",wn="$user_state",kn="$client_session_props",Cn="$capture_rate_limit",xn="$initial_campaign_params",En="$initial_referrer_info",In="$initial_person_info",Tn="$epp",Mn="$posthog_cookieless",Pn="$cookieless_mode",Rn="$sdk_debug_extensions_init_method",Fn="$sdk_debug_extensions_init_time_ms",Ln="$sdk_debug_recording_script_not_loaded",An="$sdk_debug_replay_event_trigger_status",On="$sdk_debug_replay_linked_flag_trigger_status",Dn="$sdk_debug_replay_matched_recording_trigger_groups",Nn="$sdk_debug_replay_pending_trigger_conditions",Bn="$sdk_debug_replay_remote_trigger_matching_config",qn="$sdk_debug_replay_trigger_groups_count",Hn="$sdk_debug_replay_url_trigger_status",$n="$session_recording_start_reason",Wn="PostHog loadExternalDependency extension not found.",Un="on_reject",zn="always",Vn="anonymous",jn="identified",Gn="identified_only",Qn="visibilitychange",Kn="beforeunload",Zn="$pageview",Yn="$pageleave",Jn="$identify",Xn="$groupidentify",eo="disabled",to="sampled",ro="active",io="buffering",so="paused",no="lazy_loading",oo="awaiting_config",ao="missing_config",lo="rrweb_error",uo="trigger",co=uo+"_activated",ho=uo+"_pending",po=uo+"_"+eo;function go(e,t,r,i,s,n){return 0===t?po:(null==e?void 0:e.get_property(r?i+r:s))===n?co:ho}function _o(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 vo(e){return e.includes(co)?co:e.includes(ho)?ho:po}function fo(e){var t=new Set(e);switch(t.delete(po),t.size){case 0:return po;case 1:return Array.from(t)[0];default:return ho}}class mo{constructor(e){this._matchers=e}triggerStatus(e){return vo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return vo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class yo{constructor(e){this._matchers=e}triggerStatus(e){return fo(this._matchers.map((t=>t.triggerStatus(e))))}triggerStatusNoSideEffects(e){return fo(this._matchers.map((t=>t.triggerStatusNoSideEffects(e))))}stop(){this._matchers.forEach((e=>e.stop()))}}class bo{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return co}stop(){}}var So=e=>"sessionRecording"in e;class wo{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=(So(e)?K(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(So(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){Kr.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){Kr.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return go(this._instance,this._urlTriggers.length,this._groupId,Ks,js,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Hn]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=mi(this._instance);if(!e)return!1;try{return _o(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=mi(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,s=_o(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&s||(s&&!i?e():!s&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var s=mi(this._instance);if(s&&s!==this._lastCheckedUrl){this._lastCheckedUrl=s;var n=this.urlBlocked,o=_o(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!n?e():!o&&n&&t();var a=this._urlTriggerStatus(i)===co,l=_o(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",s)}}stop(){this._lastCheckedUrl=""}}class ko{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{},this._instance=e}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[On]:e}),e}triggerStatusNoSideEffects(){var e=ho;return te(this.linkedFlag)&&(e=po),this.linkedFlagSeen&&(e=co),e}onConfig(e,t){var r;if(this.linkedFlag=(So(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,s=J(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags(((e,r)=>{var n=!1;if(K(r)&&i in r){var o=r[i];n=se(o)?!0===o:s?o===s:!!o}var a=n&&!this.linkedFlagSeen;this.linkedFlagSeen=n,a&&t(i,s)}))}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}}class Co{constructor(e,t){this._eventTriggers=[],this._instance=e,this._groupId=t}onConfig(e){var t;this._eventTriggers=(So(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 go(this._instance,this._eventTriggers.length,this._groupId,Qs,Gs,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[An]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===co,s=this._eventTriggers.includes(e);!i&&s&&t("event",e)}}stop(){}}class xo{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new wo(e,t.id),this._eventTriggerMatching=new Co(e,t.id),this._linkedFlagMatching=new ko(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)),s={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,r);var n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new mo(n):new yo(n)}else this._combinedMatching=new bo}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return this.triggerStatusNoSideEffects(e)!==ho?[]:[{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===ho)).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?Ks+this.group.id:Qs+this.group.id]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}}function Eo(e){if(e.rrwebError)return lo;if(!e.receivedFlags)return io;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return so;var t=!0===e.isSampled,r=new mo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?to:r===co?ro:r===ho?io:!1===e.isSampled?eo:ro}function Io(e){if(e.rrwebError)return lo;if(!e.receivedFlags)return io;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return so;var t=new yo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==po,i=se(e.isSampled);return r&&t===ho?io:r&&t===po||i&&!e.isSampled?eo:!0===e.isSampled?to:ro}function To(){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 Mo(e){var t=JSON.stringify(e,To());return t?new Blob([t]).size:0}function Po(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:Po(i)}return t}var s=e,n=2,o=!0;for(var a in s)if({}.hasOwnProperty.call(s,a)){var l=s[a];Y(l)||(o||(n+=1),o=!1,n+=a.length+3+Po(l))}return n;default:return 0}}function Ro(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),s=e.sizes.slice(r);return[Ro({size:i.reduce(((e,t)=>e+t),0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Ro({size:s.reduce(((e,t)=>e+t),0),data:e.data.slice(r),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap((e=>e))}return[e]}var Fo=Uint8Array,Lo=Uint16Array,Ao=Uint32Array,Oo=new Fo([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]),Do=new Fo([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]),No=new Fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bo=function(e,t){for(var r=new Lo(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var s=new Ao(r[30]);for(i=1;30>i;++i)for(var n=r[i];r[i+1]>n;++n)s[n]=n-r[i]<<5|i;return[r,s]},qo=Bo(Oo,2),Ho=qo[1];qo[0][28]=258,Ho[258]=28;for(var $o=Bo(Do,0)[1],Wo=new Lo(32768),Uo=0;32768>Uo;++Uo){var zo=(43690&Uo)>>>1|(21845&Uo)<<1;Wo[Uo]=((65280&(zo=(61680&(zo=(52428&zo)>>>2|(13107&zo)<<2))>>>4|(3855&zo)<<4))>>>8|(255&zo)<<8)>>>1}var Vo=function(e,t,r){for(var i=e.length,s=0,n=new Lo(t);i>s;++s)++n[e[s]-1];var o,a=new Lo(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(r){o=new Lo(1<<t);var l=15-t;for(s=0;i>s;++s)if(e[s])for(var u=s<<4|e[s],c=t-e[s],d=a[e[s]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[Wo[d]>>>l]=u}else for(o=new Lo(i),s=0;i>s;++s)o[s]=Wo[a[e[s]-1]++]>>>15-e[s];return o},jo=new Fo(288);for(Uo=0;144>Uo;++Uo)jo[Uo]=8;for(Uo=144;256>Uo;++Uo)jo[Uo]=9;for(Uo=256;280>Uo;++Uo)jo[Uo]=7;for(Uo=280;288>Uo;++Uo)jo[Uo]=8;var Go=new Fo(32);for(Uo=0;32>Uo;++Uo)Go[Uo]=5;var Qo=Vo(jo,9,0),Ko=Vo(Go,5,0),Zo=function(e){return(e/8>>0)+(7&e&&1)},Yo=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof Lo?Lo:e instanceof Ao?Ao:Fo)(r-t);return i.set(e.subarray(t,r)),i},Jo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Xo=function(e,t,r){var i=t/8>>0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},ea=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var s=r.length,n=r.slice();if(!s)return[new Fo(0),0];if(1==s){var o=new Fo(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!=s-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=n[0].s;for(i=1;s>i;++i)n[i].s>h&&(h=n[i].s);var p=new Lo(h+1),g=ta(r[c-1],p,0);if(g>t){i=0;var _=0,v=g-t,f=1<<v;for(n.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));s>i;++i){var m=n[i].s;if(t>=p[m])break;_+=f-(1<<g-p[m]),p[m]=t}for(_>>>=v;_>0;){var y=n[i].s;t>p[y]?_-=1<<t-p[y]++-1:++i}for(;i>=0&&_;--i){var b=n[i].s;p[b]==t&&(--p[b],++_)}g=t}return[new Fo(p),g]},ta=function(e,t,r){return-1==e.s?Math.max(ta(e.l,t,r+1),ta(e.r,t,r+1)):t[e.s]=r},ra=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Lo(++t),i=0,s=e[0],n=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[r.subarray(0,i),t]},ia=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},sa=function(e,t,r){var i=r.length,s=Zo(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;i>n;++n)e[s+n+4]=r[n];return 8*(s+4+i)},na=function(e,t,r,i,s,n,o,a,l,u,c){Jo(t,c++,r),++s[256];for(var d=ea(s,15),h=d[0],p=d[1],g=ea(n,15),_=g[0],v=g[1],f=ra(h),m=f[0],y=f[1],b=ra(_),S=b[0],w=b[1],k=new Lo(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var x=ea(k,7),E=x[0],I=x[1],T=19;T>4&&!E[No[T-1]];--T);var M,P,R,F,L=u+5<<3,A=ia(s,jo)+ia(n,Go)+o,O=ia(s,h)+ia(n,_)+o+14+3*T+ia(k,E)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return sa(t,c,e.subarray(l,l+u));if(Jo(t,c,1+(A>O)),c+=2,A>O){M=Vo(h,p,0),P=h,R=Vo(_,v,0),F=_;var D=Vo(E,I,0);for(Jo(t,c,y-257),Jo(t,c+5,w-1),Jo(t,c+10,T-4),c+=14,C=0;T>C;++C)Jo(t,c+3*C,E[No[C]]);c+=3*T;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Jo(t,c,D[H=31&q[C]]),c+=E[H],H>15&&(Jo(t,c,q[C]>>>5&127),c+=q[C]>>>12)}}else M=Qo,P=jo,R=Ko,F=Go;for(C=0;a>C;++C)if(i[C]>255){var H;Xo(t,c,M[257+(H=i[C]>>>18&31)]),c+=P[H+257],H>7&&(Jo(t,c,i[C]>>>23&31),c+=Oo[H]);var W=31&i[C];Xo(t,c,R[W]),c+=F[W],W>3&&(Xo(t,c,i[C]>>>5&8191),c+=Do[W])}else Xo(t,c,M[i[C]]),c+=P[i[C]];return Xo(t,c,M[256]),c+P[256]},oa=new Ao([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aa=function(){for(var e=new Ao(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),la=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=aa[255&r^t[i]]^r>>>8;e=r},d:()=>4294967295^e}},ua=function(e,t,r,i,s){return function(e,t,r,i,s,n){var o=e.length,a=new Fo(i+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(i,a.length-s),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=sa(l,u,e.subarray(c,d)):(l[c]=true,u=sa(l,u,e.subarray(c,o)))}else{for(var h=oa[t-1],p=h>>>13,g=8191&h,_=(1<<r)-1,v=new Lo(32768),f=new Lo(_+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&_},S=new Ao(25e3),w=new Lo(288),k=new Lo(32),C=0,x=0,E=(c=0,0),I=0,T=0;o>c;++c){var M=b(c),P=32767&c,R=f[M];if(v[P]=R,f[M]=P,c>=I){var F=o-c;if((C>7e3||E>24576)&&F>423){u=na(e,l,0,S,w,k,x,E,T,c-T,u),E=C=x=0,T=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=g,N=P-R&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&&P!=R;){if(e[c+A]==e[c+A-N]){for(var W=0;H>W&&e[c+W]==e[c+W-N];++W);if(W>A){if(A=W,O=N,W>B)break;var U=Math.min(N,W-2),z=0;for(L=0;U>L;++L){var V=c-N+L+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,R=V)}}}N+=(P=R)-(R=v[P])+32768&32767}if(O){S[E++]=268435456|Ho[A]<<18|$o[O];var G=31&Ho[A],Q=31&$o[O];x+=Oo[G]+Do[Q],++w[257+G],++k[Q],I=c+A,++C}else S[E++]=e[c],++w[e[c]]}}u=na(e,l,true,S,w,k,x,E,T,c-T,u)}return Yo(a,0,i+Zo(u)+s)}(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)},ca=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},da=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&&ca(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)}},ha=function(e){return 10+(e.filename&&e.filename.length+1||0)};function pa(e,t){void 0===t&&(t={});var r=la(),i=e.length;r.p(e);var s=ua(e,t,ha(t),8),n=s.length;return da(s,t),ca(s,n-8,r.d()),ca(s,n-4,i),s}function ga(e,t){var r=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Fo(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},o=0;r>o;++o){if(s+5>i.length){var a=new Fo(s+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Yo(i,0,s)}function _a(e,t){for(var r="",i=0;e.length>i;){var s=e[i++];r+=String.fromCharCode(s)}return r}class va{constructor(e,t){var r,i,s,n;void 0===t&&(t={}),this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{var e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},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,s,n,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(s=e.attributes)?void 0:s.length)&&void 0!==i?i:0)+(null!==(n=null==(o=e.texts)?void 0:o.length)&&void 0!==n?n: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 s,n,o=i-t.attributes.length;o>0&&(null==(s=(n=this._options).onDroppedAttributeMutations)||s.call(n,o))}var a=this._numberOfChanges(t);if(0!==a||r===a){if(this._byteBudgetDisabled)return e;this._refillByteBudget();var l,u,c=Po(e);return c>this._byteTokens?(null==(l=(u=this._options).onDroppedOversizedMutation)||l.call(u,c),void this._scheduleResync()):(this._byteTokens-=c,e)}},this._scheduleResync=()=>{if(!this._resyncTimer){var e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout((()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null==(e=(t=this._options).requestFullSnapshot)||e.call(t)}),e)}},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:Kr}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(n=this._options.bytesRefillRate)&&void 0!==n?n:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;var o=this._options.resyncIntervalMs;this._resyncIntervalMs=re(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}}Gr.DEBUG=!1,Gr.LIB_VERSION="1.424.1",Gr.LIB_NAME="web";class fa{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(Js,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(Js);return K(t=r)&&J(t.sessionId)&&re(t.size)&&r.sessionId===e?r.size:0}}function ma(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<ve(100*t,0,100,Kr)}function ya(e){return"$survey_response_"+e}function ba(e,t){if(!t)return null;var r=e[ya(t)];return G(r)?[...r]:r}function Sa(e,t,r){void 0===e&&(e={});var i={};return t.questions.forEach((t=>{if(!Y(t.originalQuestionIndex)){var r,s=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,n=ba(e,t.id);Y(n)||(i[s]=n)}})),_({$survey_questions:t.questions.map((t=>{var i,s;return{id:t.id,question:null!==(i=null==r?void 0:r[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==i?i:t.question,response:ba(e,t.id)}}))},e,i)}function wa(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 ka(e){return"string"==typeof e&&e.trim()?e.trim():null}function Ca(e){return e.toLowerCase()}function xa(e,t,r){if(!e||!t)return null;var i=Ca(t),s=Object.keys(e).find((e=>Ca(e)===i));if(s)return null==r||r.debug("Found exact translation match: "+s),s;if(i.includes("-")){var n=i.split("-")[0],o=Object.keys(e).find((e=>Ca(e)===n));if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var Ea=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ia(e,t,r){var i,s=xa(e.translations,t,r),n=_({},e),o=!1;if(s){var a,l=null==(a=e.translations)?void 0:a[s];if(l)if(null==r||r.info("Applying survey-level translation for language: "+s),Y(l.name)||(n.name=l.name,o=!0),n.appearance){var u=_({},n.appearance);for(var c of Ea){var d=l[c];Y(d)||(u[c]=d,o=!0)}n.appearance=u}else(function(e){return Ea.some((t=>!Y(e[t])))})(l)&&(o=!0)}var h=e.questions.map((e=>function(e,t,r){var i,s=xa(e.translations,t,r);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var n=null==(i=e.translations)?void 0:i[s];if(!n)return{question:e,matchedKey:null,hasChanges:!1};var o=_({},e),a=!1;return Y(n.question)||(o.question=n.question,a=!0),Y(n.description)||(o.description=n.description,a=!0),Y(n.buttonText)||(o.buttonText=n.buttonText,a=!0),"link"in o&&!Y(n.link)&&(o.link=n.link,a=!0),"lowerBoundLabel"in o&&!Y(n.lowerBoundLabel)&&(o.lowerBoundLabel=n.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Y(n.upperBoundLabel)&&(o.upperBoundLabel=n.upperBoundLabel,a=!0),"choices"in o&&function(e){return G(e.choices)}(n)&&(o.choices=n.choices,a=!0),{question:a?o:e,matchedKey:a?s:null,hasChanges:a}}(e,t,r))),p=h.map((e=>e.question)),g=h.some((e=>e.hasChanges)),v=null;return s||(v=(null==(i=h.find((e=>e.matchedKey)))?void 0:i.matchedKey)||null),g&&(n.questions=p,o=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:n,matchedKey:o?s||v:null}}function Ta(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function Ma(e){var t;return Ta(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var Pa=(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}},Ra=e=>e.toLowerCase(),Fa={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=>Pa(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Pa(t,e))))),icontains:(e,t)=>t.map(Ra).some((t=>e.map(Ra).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Ra).every((t=>e.map(Ra).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 La(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 s=Fa[r.operator];return!!s&&s(r.values,[String(i)])}))}function Aa(e,t,r){return ui({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var Oa=new Set(["is_not","not_icontains","not_regex"]);function Da(e,t,r){return!e||0===e.length||e.every((e=>{var i="person"===e.type?r:t,s=null==i?void 0:i[e.key],n=e.operator||"exact";if(Y(s)||ee(s))return Oa.has(n);var o=Fa[n];return!!o&&!Y(e.value)&&!ee(e.value)&&o(G(e.value)?e.value.map(String):[String(e.value)],G(s)?s.map(String):[String(s)])}))}var Na=Zr("[SessionRecording]");function Ba(e,t){return t?e:"!"+e}function qa(e,t){return e===t||e!=="!"+t&&null}class Ha{constructor(e,t,r,i,s,n,o){this._sampleRate=null,this._recordingStatusFunction=Io,this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=s,this._tryTakeFullSnapshot=n,this._onTriggerActivated=o}onRemoteConfig(e){this._sampleRate=re(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new mo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Eo):(this._triggerStatusMatcher=new yo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Io),this._instance.register_for_session({[Bn]: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){Na.error("Could not activate event trigger",e)}})),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,s=this._sampleRate;if(!re(s))return null==(r=this._instance.persistence)||r.unregister(zs),void(null==(i=this._instance.persistence)||i.unregister(Bs));var n=this._instance.get_property(zs),o=this._instance.get_property(Bs),a=qa(n,e),l=re(o)&&o!==s,u=Y(o)&&n===e,c=l||u||!se(a),d=c?ma(e,s):a;c&&(d?this._reportStarted("sampled"):Na.warn("Sample rate ("+s+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[zs]:Ba(e,d),[Bs]:ee(o)&&n===e?null:s})}ensureSamplingDecision(e){if(re(this._sampleRate)){var t=this._instance.get_property(zs);se(qa(t,e))||this.makeSamplingDecisions(e)}}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,s;null==(e=this._instance.persistence)||e.unregister(Gs),null==(t=this._instance.persistence)||t.unregister(js),null==(r=this._instance.persistence)||r.unregister(zs),null==(i=this._instance.persistence)||i.unregister(Bs),null==(s=this._instance.persistence)||s.unregister(Vs)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===ho}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===ho)).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 $a{constructor(e,t,r,i,s){this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1,this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=s}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Bn]:"v2_trigger_groups",[qn]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):Na.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return lo;if(e.urlTriggerMatching.urlBlocked)return so;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return eo;var i=!1,s=!1;for(var n of t){var o=n.triggerStatus(e.sessionId);if(o===co){var a=n.group.id,l=r.get(a);Y(l)?Kr.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(s=!0)}else o===ho&&(i=!0)}return s?to:i?io:eo}({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 s=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var n=function(i){i.checkUrlTriggerConditions(t,r,(t=>{s._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),s.updateActiveTriggers(e),s._onTriggerActivated(t))}),e)};for(var o of this._triggerGroupMatchers)n(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e((e=>{var r;if(this._hasCompletedInitialFlush)return Na.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var s=function(r){r.checkEventTriggerConditions(e.event,(s=>{if(i._checkGroupLevelProperties(r,e.properties)){var n=(r.group.conditions.events||[]).filter((t=>t.name===e.event)),o=i._instance.get_property(un),a=n.some((t=>!t.properties||0===t.properties.length||Da(t.properties,e.properties,o)));a&&(r.activateTrigger(s,t),i.updateActiveTriggers(t),i._onTriggerActivated(s))}}),t)};for(var n of this._triggerGroupMatchers)s(n)}catch(e){Na.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,s=i.id,n=i.sampleRate,o=Zs+s,a=this._instance.get_property(o),l=null,u=!1,c=!1,d=!1;if(K(a)){var h=a.sessionId,p=a.sampleRate,g=a.sampled;u="string"==typeof h&&h!==e,c=re(p)&&p!==n,l=h===e&&re(p)&&p===n&&se(g)?g:null}else l=a===e||null,u="string"==typeof a&&a!==e,d=a===e;var _=u||c||d||!se(l),v=_?ma(e+s,n):l;_&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:i.name,sampleRate:n,isSampled:v}),this._triggerGroupSamplingResults.set(s,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:n,sampled:v}})}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(zs),null==(t=this._instance.persistence)||t.unregister(Bs),null==(r=this._instance.persistence)||r.unregister(Vs),this._triggerGroupMatchers)){var s,n,o,a=i.group.id;null==(s=this._instance.persistence)||s.unregister(Qs+a),null==(n=this._instance.persistence)||n.unregister(Ks+a),null==(o=this._instance.persistence)||o.unregister(Zs+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,s=i.id,n="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);n&&t.push({id:s,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[Dn]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if(t.triggerStatus(e)===ho)return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap((t=>t.triggerStatusNoSideEffects(e)!==ho?[]: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||Da(r,t,this._instance.get_property(un))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach((e=>e.stop())),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new xo(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 Wa=e=>{if(i){try{for(var t=e+"=",r=i.cookie.split(";").filter((e=>e.length)),s=0;r.length>s;s++){for(var n=r[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},Ua="https?://(.*)",za=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Va=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...za],ja="<masked>",Ga=["li_fat_id"];function Qa(e,t,r){if(!i)return{};var s,n=t?[...za,...r||[]]:[],o=Ka(pi(i.URL,n,ja),e),a=(s={},Jr(Ga,(function(e){var t=Wa(e);s[e]=t||null})),s);return Xr(a,o)}function Ka(e,t){var r=Va.concat(t||[]),i={};return Jr(r,(function(t){var r=hi(e,t);i[t]=r||null})),i}function Za(e){var t=function(e){return e?0===e.search(Ua+"google.([^/?]*)")?"google":0===e.search(Ua+"bing.com")?"bing":0===e.search(Ua+"yahoo.com")?"yahoo":0===e.search(Ua+"duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",s={};if(!ee(t)){s.$search_engine=t;var n=i?hi(i.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function Ya(){return navigator.language||navigator.userLanguage}var Ja="$direct";function Xa(){return(null==i?void 0:i.referrer)||Ja}function el(e,t,r){void 0===r&&(r=!1);var i=e?[...za,...t||[]]:[],n=r?Rt(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:Xa().substring(0,1e3),u:o?pi(o,i,ja):void 0}}function tl(e,t){var r;void 0===t&&(t=!1);var i=e.r,s=e.u,n=t?Rt(s):s,o={$referrer:i,$referring_domain:null==i?void 0:i==Ja?Ja:null==(r=ci(i))?void 0:r.host};if(n){o.$current_url=n;var a=ci(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Ka(n);Xr(o,l)}if(i){var u=Za(i);Xr(o,u)}return o}function rl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function il(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var sl=1e5,nl="https://schema.org",ol=[],al="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(" "),ll="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),ul="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(" "),cl="Accommodation AdministrativeArea Country Place State".split(" "),dl={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:ll,publisher:ul},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:ol},Offer:{seller:ul},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:ul,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:ul,areaServed:cl,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:ol}},hl={},pl=[[ll,hl],["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(" "),dl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),dl.Event],[ul,dl.Organization],[cl,dl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),dl.Product],["AggregateRating EmployerAggregateRating Rating".split(" "),hl]],gl="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 _l(e,t){return V.call(e,t)?e[t]:void 0}function vl(e){var t=typeof e;return ee(e)||"string"===t||"number"===t||"boolean"===t}function fl(e){return vl(e)||G(e)&&e.every(vl)?e:void 0}function ml(e){if(V.call(dl,e))return dl[e];for(var t of pl){var r=t[1];if(t[0].includes(e))return r}return gl.includes(e)?hl:void 0}function yl(e,t){if(!K(e))return null;var r=_l(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=>!!ml(e)))}(r).filter((e=>!t||!t.length||t.includes(e)));if(!i.length)return null;var s={"@type":"string"==typeof r?i[0]:i},n=fl(_l(e,"@id"));for(var o of(Y(n)||(s["@id"]=n),al)){var a=fl(_l(e,o));Y(a)||(s[o]=a)}for(var l of i){var u=ml(l),c=function(){var t=_l(e,d),r=u[d];if(!0===r){var i=fl(t);Y(i)||(s[d]=i)}else if(G(t)){var n=t.map((e=>yl(e,r))).filter(K);n.length&&(s[d]=n)}else{var o=yl(t,r);o&&(s[d]=o)}};for(var d of Object.keys(u))c()}return s}function bl(e){if(!K(e))return null;var t=_l(e,"@context");if("string"!=typeof t||!/^https?:\/\/schema\.org\/?$/.test(t))return null;var r=yl(e);if(r)return _({"@context":nl},r);var i=_l(e,"@graph");if(!G(i))return null;var s=i.map((e=>yl(e))).filter(K);return s.length?{"@context":nl,"@graph":s}:null}function Sl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function wl(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 kl(e){return Sl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Sl)}function Cl(e){return Y(e)?void 0:Math.round(e)}function xl(e){return K(e)?e.network_timing:e}var El,Il,Tl=36e5,Ml=943718.4,Pl="[SessionRecording]",Rl=Zr(Pl),Fl=[m.MouseMove,m.MouseInteraction,m.Scroll,m.ViewportResize,m.Input,m.TouchMove,m.MediaInteraction,m.Drag],Ll=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Al(){var e;return null==h||null==(e=h.__PosthogExtensions__)?void 0:e.rrweb}function Ol(){var e;return null==(e=Al())?void 0:e.record}function Dl(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,To())}}function Nl(e){return _a(pa(ga(Dl(e))))}function Bl(e){return ql.apply(this,arguments)}function ql(){return(ql=g((function*(e){var t=Dl(e),r=yield Ut(t,Gr.DEBUG,{rethrow:!0});return _a(new Uint8Array(yield r.arrayBuffer()))}))).apply(this,arguments)}var Hl="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,$l=!1;function Wl(e){return G(e)&&0===e.length?El=null!=El?El:Nl([]):Nl(e)}function Ul(e){return zl.apply(this,arguments)}function zl(){return(zl=g((function*(e){return G(e)&&0===e.length?El||(Il=null!=Il?Il:Bl([]).then((e=>(El=e,e))).catch((e=>{throw El=void 0,Il=void 0,e}))):Bl(e)}))).apply(this,arguments)}function Vl(e){return Hl&&!$l&&function(e){return e.type===f.FullSnapshot||e.type===f.IncrementalSnapshot&&(e.data.source===m.Mutation||e.data.source===m.StyleSheetRule)}(e)}function jl(e){return{event:e,size:Po(e)}}function Gl(e,t){return _({},e,{data:t,cv:"2024-10"})}function Ql(e,t){return _({},e,{cv:"2024-10",data:_({},e.data,t)})}function Kl(e){try{if(e.type===f.FullSnapshot)return jl(Gl(e,Nl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation)return jl(Ql(e,{texts:Wl(e.data.texts),attributes:Wl(e.data.attributes),removes:Wl(e.data.removes),adds:Wl(e.data.adds)}));if(e.type===f.IncrementalSnapshot&&e.data.source===m.StyleSheetRule)return jl(Ql(e,{adds:e.data.adds?Nl(e.data.adds):void 0,removes:e.data.removes?Nl(e.data.removes):void 0}))}catch(e){Rl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:Mo(e)}}function Zl(){return Zl=g((function*(e){try{if(e.type===f.FullSnapshot)return jl(Gl(e,yield Bl(e.data)));if(e.type===f.IncrementalSnapshot&&e.data.source===m.Mutation){var t=yield Promise.all([Ul(e.data.texts),Ul(e.data.attributes),Ul(e.data.removes),Ul(e.data.adds)]);return jl(Ql(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?Bl(e.data.adds):void 0,e.data.removes?Bl(e.data.removes):void 0]);return jl(Ql(e,{adds:r[0],removes:r[1]}))}}catch(t){return Ht(t)&&($l=!0),Rl.error("could not compress event asynchronously - trying synchronous compression",t),Kl(e)}return{event:e,size:Mo(e)}})),Zl.apply(this,arguments)}function Yl(e,t){return e.type===f.Custom&&e.data.tag===t}function Jl(e){return Yl(e,"sessionIdle")}function Xl(e){return Yl(e,"$session_ending")}function eu(e){return Yl(e,"$session_starting")}class tu{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error(Pl+" 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 qa(this._instance.get_property(zs),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._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=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,s,n;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(Ys),this._maxDepthExceeded=!1,null==(s=Al())||null==s.resetMaxDepthState||s.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==(n=this._strategy)||n.makeSamplingDecisions(e)}},this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Vs])===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 s,n=this._getBufferDuration();return!!ee(n)||r>n||(null==(s=this._instance.persistence)||s.register({[Vs]:this._sessionId}),!1)},this._onBeforeUnload=()=>{this.status!==io?(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(),s=r.windowId;this._sessionId=r.sessionId,this._windowId=s,this._linkedFlagMatching=new ko(this._instance),this._urlTriggerMatching=new wo(this._instance),this._eventTriggerMatching=new Co(this._instance),this._buffer=this._clearBuffer(),this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||Rl.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 fa(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,s,n,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==(s=this._instance.config.session_recording)?void 0:s.maskAllElementAttributes},d=null!==(n=null==c?void 0:c.maskAllInputs)&&void 0!==n?n: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,g=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(g)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:g}}_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],s=t[e];return!Y(i)&&i!==s}));0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,Rl.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 ve(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,Zr("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,s,n,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!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==i?i:4,d=null!==(n=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==n?n:.4;if("string"==typeof d){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:u,fps:ve(c,0,12,Zr("canvas recording fps"),4),quality:ve(d,0,1,Zr("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,s={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},n=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),a=xl(this._instance.config.capture_performance),l=xl(null==i?void 0:i.capturePerformance),u=!!(se(a)?a:l);return n||o||u?{recordHeaders:n,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 n=null==(t=h.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&Q(n))if(!li.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){var o=Q(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(n(((e,t,r)=>{var i,s={payloadSizeLimitBytes:hs.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...hs.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...hs.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,o=!1!==e.session_recording.recordBody&&t.recordBody,a=!1!==e.capture_performance&&t.recordPerformance,l=(i=ds(s),e=>(null!=e&&e.requestBody&&(e.requestBody=ms(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=ms(e.responseBody,e.responseHeaders,i,"Response")),e)),u=t=>{return l(((e,t,r)=>{var i;if(null==r||!r(e.name)){var s=ci(e.name),n=0===t.indexOf("http")?null==(i=ci(t))?void 0:i.pathname:t;"/"===n&&(n="");var o=null==s?void 0:s.pathname.replace(n||"","");if(!(s&&o&&fs.some((e=>0===o.indexOf(e)))))return e}})((vs((i=t).requestHeaders),vs(i.responseHeaders),i),e.api_host,r));var i},c=Q(e.session_recording.maskNetworkRequestFn);return c&&Q(e.session_recording.maskCapturedNetworkRequestFn)&&Kr.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:_({},t,{name:null==r?void 0:r.url})}),s.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,s=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return te(s)&&i?(bs.add(i),i):null!=s?s:void 0}}:e=>function(e){if(!Y(e))return e.requestBody=ys(e.requestBody,"Request"),e.responseBody=ys(e.responseBody,"Response"),e}(u(e)),_({},hs,s,{recordHeaders:n,recordBody:o,recordPerformance:a,recordInitialRequests:a,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else Rl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?Rt(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?Rt(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...za,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(pi(r,i,ja))}_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 s=t.maskNetworkRequestFn({url:e});return null==s?void 0:s.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}):Rl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Ll((()=>Ol().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=Ol();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(Ll((()=>Ol().takeFullSnapshot())))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,s=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return re(s)&&Number.isFinite(s)&&s>=1e3&&36e5>=s?s: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),Rl.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"}),Rl.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,s;null==(i=this._instance.persistence)||i.register({["url"===e?js:Gs]:this.sessionId}),null==(s=this._strategy)||s.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(Ns);if(e){var t;try{t=K(e)?e:JSON.parse(e)}catch(e){return void Rl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted){var r,i,s=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-s>Tl)return Rl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(Ns))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(t){var r,s,n=this._remoteConfig;if(n){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(Ys),null!=n&&n.endpoint&&(this._endpoint=null==n?void 0:n.endpoint),this._strategy=2===(null==n?void 0:n.version)&&(null==n?void 0:n.triggerGroups)&&n.triggerGroups.length>0?new $a(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new Ha(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(n),null==(s=this._removeEventTriggerCaptureHook)||s.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,((e,t)=>this._activateTrigger(e,t))),this._checkOverride(qs,(()=>{this.overrideSampling()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(qs)})),this._checkOverride(Hs,(()=>{this.overrideLinkedFlag()}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Hs)})),this._checkOverride(Ws,(()=>{this.overrideTrigger("event")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(Ws)})),this._checkOverride($s,(()=>{this.overrideTrigger("url")}),(()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister($s)})),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(oi(e,"beforeunload",this._onBeforeUnload),oi(e,"pagehide",this._onPageHide),oi(e,"offline",this._onOffline),oi(e,"online",this._onOnline),oi(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)||Rl.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){Rl.error("Could not add $pageview to rrweb session",e)}}))),this.status===ro&&this._reportStarted(t||"recording_initialized"))}else Rl.info("remote config must be stored in persistence before recording can start")}_teardown(){var t,r,s,n,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==(s=this._onSessionIdListener)||s.call(this),this._onSessionIdListener=void 0,null==(n=this._onSessionIdleResetForcedListener)||n.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(),Rl.info("stopped"))})).catch((()=>{this._isStoppingAfterCompression=!1,this._teardown(),Rl.info("stopped")})),!0}stop(){this._stopRecordingProducers(),this._stopAfterCompressionQueueDrains()||(this._flushBuffer(),this._clearBuffer(),this._teardown(),Rl.info("stopped"))}_restartForSessionIdChange(e){var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null==(t=Al())||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(e){var t=(void 0===e?{}:e).discardProducerEvents;void 0!==t&&t&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),Rl.info("discarded")}_captureProcessedEvent(e,t,r,i,s){var n={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:s};this.status!==eo?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(n)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Rl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=Al())||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||Rl.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,Rl.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?Kl(e.event):{event:e.event,size:Mo(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 s=this,n={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(n),this._queuedCompressionEvents+=1;var o=function(){var r=g((function*(){try{if(n.processed)return;var r,i;try{var o=t?Vl(e)?yield function(e){return Zl.apply(this,arguments)}(e):Kl(e):{event:e,size:Mo(e)};r=o.event,i=o.size}catch(t){Rl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=Mo(e)}s._captureQueuedCompressionEvent(n,r,i)}finally{s._finishQueuedCompressionEvent(n)}}));return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch((()=>{})).then(o):o()}onRRwebEmit(e){var t,r,i,s,n,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=Al())&&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({[Ys]:e.timestamp},void 0));var g=e.type===f.FullSnapshot&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();var _=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(_){var v=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}(_),y=function(e){return Xl(e)?e.data.payload:null}(v),b=function(e){return eu(e)?e.data.payload:null}(v),S=function(e){return Jl(e)?e.data.payload:null}(v);y||b?null!=y&&y.lastActivityTimestamp&&(v.timestamp=y.lastActivityTimestamp):null!=S&&S.sessionId||this._updateWindowAndSessionIds(v),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!==(s=null!==(n=null==y?void 0:y.currentSessionId)&&void 0!==n?n:null==b?void 0:b.nextSessionId)&&void 0!==s?s: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 Jl(e)||Xl(e)||eu(e)}(v)){v.type===f.FullSnapshot&&(this._eventsDroppedWhileIdle=0),S&&(v.timestamp=S.lastActivityTimestamp+S.threshold);var C=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):C||this._scheduleJsonLdScan();var x=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(this._queuedCompressionEvents>0||x&&Vl(v))this._enqueueCompression(v,x,w,k);else{var E=x?Kl(v):{event:v,size:Mo(v)};this._captureProcessedEvent(v,E.event,E.size,w,k)}}else(function(e){return e.type===f.FullSnapshot||e.type===f.Meta||e.type===f.IncrementalSnapshot&&e.data.source!==m.CanvasMutation})(v)&&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}):eo}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({[zs]:this.sessionId,[Bs]: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&&!Xl(e)&&!eu(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!==io)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Nn]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return Y(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Nn]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[Nn]:t}),Rl.info("buffering: "+r))}_flushBuffer(){var e;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>Ml?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===io||i===so||i===eo||r)return this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==t)return this._buffer;if(t.data.length>0){var s,n=this._currentMaskedHostname();Ro(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:Gr.LIB_NAME,$lib_version:Gr.LIB_VERSION,$snapshot_host:n})})),null==(s=this._strategy)||s.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,s=this._buffer.sessionId!==i;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>Ml){var n=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==n)return;s&&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>Ml)?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({[$n]:e}),Rl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",_({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Fl.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 s=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),n=s.windowId,o=s.sessionId,a=this._sessionId!==o,l=this._windowId!==n;if(this._windowId=n,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,s,n,o,a,l,u=this._sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp,c=null==(e=Al())||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:Cl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Cl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(s=this._slowestFullSnapshot)?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this._slowestFullSnapshot)?void 0:n.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:Cl(null==c?void 0:c.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Cl(null==c?void 0:c.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Cl(null==(a=Al())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=Al())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$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,s,n,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=_({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=_({},a.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(a.recordCanvas=!0,a.sampling=_({},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,Rl.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!==(s=this._masking.maskTextSelector)&&void 0!==s?s:void 0,a.blockSelector=null!==(n=this._masking.blockSelector)&&void 0!==n?n: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,Rl.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 g=Ol();if(g){this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new va(g,{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";Rl.info(r,{node:t}),this.log(Pl+" "+r,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log(Pl+" Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});var v=this._gatherRRWebPlugins();if(this._stopRrweb=g(_({emit:e=>{this.onRRwebEmit(e)},plugins:v,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Rl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},a)),!this._stopRrweb)return this._rrwebError=!0,void Rl.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,s=r.getCaptureState||(()=>!0),n=sl,o=t=>{try{var o=s();if(!n||!1===o||!t.isConnected||t.ownerDocument!==e||function(e,t){for(var r=e;r;){if(wl(r,t.blockClass,t.blockSelector)||wl(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>sl)return null;try{var t=JSON.parse(e),r=G(t)?t.map(bl):bl(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>n)return void(n=0);r.emit(l)&&(i.set(t,u),n-=u.length)}}catch(e){return}};try{var a=new t((e=>{try{if(!n||!1===s())return;var t=e=>{for(var t of kl(e))o(t)};for(var r of e)if("childList"===r.type)Sl(r.target)&&o(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&Sl(i)&&o(i)}else"attributes"===r.type&&Sl(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),n&&!1!==s()&&kl(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=se(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:a,activePlugins:v.map((e=>null==e?void 0:e.name))}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Rl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}}var ru,iu=["type"],su=Object.defineProperty,nu=(e,t,r)=>((e,t,r)=>t in e?su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),ou=(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))(ou||{}),au=(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))(au||{}),lu=(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))(lu||{}),uu=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(uu||{}),cu=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(cu||{}),du=(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))(du||{}),hu=(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))(hu||{});function pu(e,t){return-1!==e.indexOf(t)}var gu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},_u={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},vu={};function fu(e){if(vu[e])return vu[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 gu?gu[e]:void 0,s=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]"))}))),n=e in _u?_u[e]:void 0,o=Boolean(n&&n.every((e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))})));if(s&&o)return vu[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 pu(e,"AppleWebKit")&&!pu(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),vu[e]=c):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var mu={};function yu(e,t,r){var i,s=e+"."+String(r);if(mu[s])return mu[s].call(t);var n=fu(e),o=null==(i=Object.getOwnPropertyDescriptor(n,r))?void 0:i.get;return o?(mu[s]=o,o.call(t)):t[r]}var bu={};function Su(e,t,r){var i=e+"."+String(r);if(bu[i])return bu[i].bind(t);var s=fu(e)[r];return"function"!=typeof s?t[r]:(bu[i]=s,s.bind(t))}function wu(){return fu("MutationObserver").constructor}function ku(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],s={next:i},n=r((function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return s.next.apply(this,t)}));return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]!==n)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===n)return void(o.next=s.next);o=r(i=o.next)}else e[t]=s.next}}catch(e){return()=>{}}}var Cu={childNodes:e=>yu("Node",e,"childNodes"),parentNode:e=>yu("Node",e,"parentNode"),parentElement:e=>yu("Node",e,"parentElement"),textContent:e=>yu("Node",e,"textContent"),contains:(e,t)=>Su("Node",e,"contains")(t),getRootNode:e=>Su("Node",e,"getRootNode")(),host:e=>e&&"host"in e?yu("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?yu("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Su("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Su("Element",e,"querySelectorAll")(t),mutationObserver:wu,patch:ku},xu=()=>({durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0});function Eu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Iu=0,Tu=6e4;function Mu(){Iu+=1}function Pu(){return Iu}function Ru(e,t){return t!==Iu||e>Tu}var Fu=0,Lu=0,Au=0,Ou=xu(),Du=null,Nu=null,Bu=[],qu=0,Hu=0,$u={slowestBatchMs:0},Wu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0},Uu=e=>e&&e>0?e:null;function zu(e){(Fu+=1)>1||(Ou=xu(),Bu=[],qu=0,Nu=Uu(e),Lu=Eu(),Au=Iu)}function Vu(){return 0===Fu?Du||xu():(Fu-=1)>0?Ou:(Ou.durationMs=Eu()-Lu,Ou.deferredStylesheetCount=qu,Wu.deferredCount+=qu,Nu=null,Ru(Ou.durationMs,Au)?Ou:Du=Ou)}var ju=32;function Gu(e,t,r){var i=e.length;if(r>=ju)return i;for(var s=0;e.length>s;s++){var n=e[s];try{var o=n.cssRules;if(o&&o.length)i+=Gu(o,t,r+1);else if(t&&n.styleSheet){var a=n.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=Gu(l,t,r+1))}}}catch(e){}}return i}function Qu(e){if(0!==Fu){var t=Gu(e,null,0);Ou.cssRuleCount+=t,Hu>0&&(Ou.nonDeferrableCssRuleCount+=t)}}function Ku(e){Hu+=1;try{return e()}finally{Hu-=1}}function Zu(e){Fu>0&&(Ou.stylesheetMs+=e)}function Yu(e){if(0===Fu||null===Nu)return!1;var t=Ou.cssRuleCount-Ou.nonDeferrableCssRuleCount;return t>=Nu||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),Gu(t,r,0)}catch(e){return 0}}(e)>Nu}function Ju(){Wu.failedCount+=1}function Xu(e){e>0&&(Wu.abandonedCount+=e)}function ec(e){return e.nodeType===e.ELEMENT_NODE}function tc(e){var t=e&&"host"in e&&"mode"in e&&Cu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Cu.shadowRoot(t)===e)}function rc(e){return"[object ShadowRoot]"==={}.toString.call(e)}function ic(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 sc(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 nc=0;function oc(e){var t=0===nc,r=t?Eu():0;nc+=1;try{var i=e.rules||e.cssRules;if(!i)return null;Qu(i);var s=e.href;return!s&&e.ownerNode&&(s=e.ownerNode.baseURI),ic(Array.from(i,(e=>ac(e,s))).join(""))}catch(e){return null}finally{nc-=1,t&&Zu(Eu()-r)}}function ac(e,t){var r;if(uc(e)){var i;try{i=oc(e.styleSheet)||sc(e)}catch(t){i=e.cssText}try{if(i&&(null==(r=e.styleSheet)?void 0:r.href))return xc(i,e.styleSheet.href)}catch(e){}return i}var s=e.cssText;return cc(e)&&e.selectorText.includes(":")&&(s=lc(s)),t?xc(s,t):s}function lc(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function uc(e){return"styleSheet"in e}function cc(e){return"selectorText"in e}var dc=/^-?[A-Za-z_][\w-]*$/,hc=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function pc(e){var t=[],r=!1,i=null,s=new Map;function n(e){var s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void n(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!s.importRule)return r=!0,void(i=e);o(t[t.length-1],s.importRule,e)}function o(e,t,r){var i;try{var s;try{s=r||sc(t)}catch(e){s=t.cssText}try{s&&(null==(i=t.styleSheet)?void 0:i.href)&&(s=xc(s,t.styleSheet.href))}catch(e){}s&&e.parts.push(s),e.index+=1}catch(e){n(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&uc(r)){var i=s.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(cc(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&&!dc.test(r.containerName)?null:"@container "+(r.containerName?r.containerName+" ":"")+r.containerQuery+" {";if("string"==typeof r.conditionText){var s="";try{s=(null==(t=e.constructor)?void 0:t.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?"@supports "+r.conditionText+" {":null}return"string"==typeof r.name?"keyText"in r.cssRules[0]?dc.test(r.name)?"@keyframes "+r.name+" {":null:""===r.name?"@layer {":hc.test(r.name)?"@layer "+r.name+" {":null:null}(e);if(null===i)return!1;var s=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?xc(i,s):i,fixColons:"sheet"===r.kind&&cc(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var n=r.cssText;"sheet"===e.kind&&cc(r)&&r.selectorText.includes(":")&&(n=lc(n)),e.parts.push(e.sheetHref?xc(n,e.sheetHref):n),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;Qu(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var n=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:n,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,!uc(t)||s.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return s.set(t,null),0}if(!i||r.some((e=>e.sheet===i)))return 0;try{var n=i.rules||i.cssRules;if(!n)return 0;Qu(n);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(n);s.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(n,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var s=Eu(),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){n(null)}}else{var u=null;try{if("group"===l.kind){var c=l.prelude+l.parts.join("")+"}";u=l.fixColons?lc(c):c}else u=ic(l.parts.join(""))}catch(e){}n(u)}}}catch(e){r=!0,i=null}finally{Zu(Eu()-s)}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 gc{constructor(){nu(this,"idNodeMap",new Map),nu(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))),ec(e)){var r=Cu.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 _c(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,s=e.type,n=e.maskInputFn,o=e.value||"",a=s&&vc(s);return(r[i.toLowerCase()]||a&&r[a])&&(o=n?n(o,t):"*".repeat(o.length)),o}function vc(e){return e.toLowerCase()}var fc=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 mc(e){var t=e.element,r=e.name,i=e.value,s=e.maskAttributeFn,n=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==n&&n&&fc.has(vc(r))?i:"*".repeat(i.length):s?s(r,i,t):i:i}var yc="__rrweb_original__";function bc(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?vc(t):null}catch(e){return null}}var Sc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wc=/^(?:[a-z+]+:)?\/\//i,kc=/^www\..*/i,Cc=/^(data:)([^,]*),(.*)/i;function xc(e,t){return(e||"").replace(Sc,((e,r,i,s,n,o)=>{var a,l=i||n||o,u=r||s||"";if(!l)return e;if(wc.test(l)||kc.test(l))return"url("+u+l+u+")";if(Cc.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 Ec,Ic,Tc="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==",Mc=4096,Pc=1e5,Rc=10,Fc=new Map,Lc=1,Ac=new RegExp("[^a-z0-9-_:]"),Oc=-2;function Dc(){return Lc++}var Nc=/^[^ \t\n\r\u000c]+/,Bc=/^[, \t\n\r\u000c]+/,qc=new WeakMap;function Hc(e,t){return t&&""!==t.trim()?$c(e,t):t}function $c(e,t){var r=qc.get(e);if(r||(r=e.createElement("a"),qc.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Wc(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?Tc:e}(e,t.maxBase64ImageLength):e}function Uc(e,t,r,i,s,n){var o;if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&s){var a=null==(o=s.sheet)?void 0:o.href;if(a)return a}var l=Hc(e,i);if(l.startsWith("data:")){if("img"===t&&s){var u=l;return((null==n?void 0:n.type)||void 0!==(null==n?void 0:n.quality))&&(u=function(e,t,r,i){if(Pc>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>Mc||e.naturalHeight>Mc)return t;var s=Fc.get(t);if(s&&s.type===r&&s.quality===i)return s.result;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var o=n.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=n.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(Fc.size>=Rc){var u=Fc.keys().next().value;void 0!==u&&Fc.delete(u)}return Fc.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(s,l,n.type,n.quality)),Wc(u,n)}if("image"===t)return Wc(l,n)}return l}if("xlink:href"===r&&"#"!==i[0]){var c=Hc(e,i);return"image"===t&&c.startsWith("data:")?Wc(c,n):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,s=e.exec(t.substring(r));return s?(r+=(i=s[0]).length,i):""}for(var s=[];i(Bc),t.length>r;){var n=i(Nc);if(","===n.slice(-1))n=Hc(e,n.substring(0,n.length-1)),s.push(n);else{var o="";n=Hc(e,n);for(var a=!1;;){var l=t.charAt(r);if(""===l){s.push((n+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,s.push((n+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return s.join(", ")}(e,i):"style"===r?xc(i,$c(e)):"object"===t&&"data"===r?Hc(e,i):i:Hc(e,i)}function zc(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function Vc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&Vc(Cu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&Vc(Cu.parentNode(e),t,r)}function jc(e,t,r,i){var s;if(ec(e)){if(!Cu.childNodes(s=e).length)return!1}else{if(null===Cu.parentElement(e))return!1;s=Cu.parentElement(e)}try{if("string"==typeof t){if(i){if(s.closest("."+t))return!0}else if(s.classList.contains(t))return!0}else if(Vc(s,t,i))return!0;if(r)if(i){if(s.closest(r))return!0}else if(s.matches(r))return!0}catch(e){}return!1}function Gc(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var Qc=new Map;function Kc(e,t){return Array.from(e.styleSheets).find((e=>e.href===t))}function Zc(e){return null==e?"":e.toLowerCase()}var Yc=50,Jc=!1,Xc=!1;function ed(e,t){var r=t.doc,i=t.mirror,s=t.blockClass,n=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,g=t.maskTextFn,_=t.maskInputFn,v=t.maskAllElementAttributes,f=void 0!==v&&v,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,x=void 0!==C&&C,E=t.canvasMaskingConfigured,I=t.onSerialize,T=t.onIframeLoad,M=t.iframeLoadTimeout,P=void 0===M?5e3:M,R=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,W=t.maxDepth,U=void 0===W?Yc:W,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=U)return Xc=!0,Jc||(Jc=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+U+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=jc(e,o,a,void 0===z)),Fu>0&&(Ou.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,s=t.blockSelector,n=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,g=t.dataURLOptions,_=void 0===g?{}:g,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:hu.Document,childNodes:[],compatMode:e.compatMode}:{type:hu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:hu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r,i,s,n=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,g=void 0===p?{}:p,_=t.inlineImages,v=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=vc(e.tagName);return Ac.test(t)?"div":t}(e),C=new Set,x={},E=e.attributes.length,I=0;E>I;I++){var T=e.attributes[I];zc(k,T.name)||(x[T.name]=Uc(n,k,vc(T.name),T.value,e,g))}if("link"===k&&o&&!w){var M=e.sheet;if(!M){var P=function(e){return e.href}(e);P&&!(M=Kc(n,P))&&P.includes(".css")&&(M=Kc(n,window.location.origin+"/"+P.replace(window.location.href,"")))}var R=null;M&&(Yu(M)?Fu>0&&(Bu.push(e),qu+=1):R=oc(M)),R&&(delete x.rel,delete x.href,x._cssText=R)}if("style"===k&&e.sheet&&!(e.innerText||Cu.textContent(e)||"").trim().length){var F=Ku((()=>oc(e.sheet)));F&&(x._cssText=F)}if("input"===k||"textarea"===k||"select"===k){var L=e.value,A=e.checked;"radio"!==x.type&&"checkbox"!==x.type&&"submit"!==x.type&&"button"!==x.type&&L?x.value=_c({element:e,type:bc(e),tagName:k,value:L,maskInputOptions:l,maskInputFn:u}):A&&(x.checked=A)}if("option"===k&&(e.selected&&!l.select?x.selected=!0:delete x.selected),"dialog"===k&&e.open){try{x.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){x.rr_open_mode="modal",x.ph_rr_could_not_detect_modal=!0}C.add("rr_open_mode")}if("canvas"===k&&v&&!(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 s=t.getImageData;if(new Uint32Array((yc in s?s[yc]:s).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)||(x.rr_dataURL=e.toDataURL(g.type,g.quality));else if(!("__context"in e)){var O=e.toDataURL(g.type,g.quality),D=n.createElement("canvas");D.width=e.width,D.height=e.height,O!==D.toDataURL(g.type,g.quality)&&(x.rr_dataURL=O)}var N,B,q=!1;if("img"===k&&_){Ec||(Ec=n.createElement("canvas"),Ic=Ec.getContext("2d"));var H=e,W=H.currentSrc||H.getAttribute("src")||"<unknown-src>",U=H.crossOrigin,z=(t,r)=>q?mc({element:e,name:t,value:r,maskAllElementAttributes:d,maskAttributeFn:h}):r,V=()=>{Gc(H,"load",V);try{Ec.width=H.naturalWidth,Ec.height=H.naturalHeight,Ic.drawImage(H,0,0);var e=Ec.toDataURL(g.type,g.quality);x.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="+W+"! Error: "+e)}"anonymous"===H.crossOrigin&&(U?x.crossOrigin=z("crossOrigin",U):H.removeAttribute("crossorigin"))};H.complete&&0!==H.naturalWidth?V():H.addEventListener("load",V)}if("audio"===k||"video"===k){var j=x;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&&(x.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(x.rr_scrollTop=e.scrollTop)),w){var G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null==(r=n.defaultView)?void 0:r.getComputedStyle(e);x={class:x.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null==(i=n.defaultView)?void 0:i.scrollX)||0))+"px",rr_top:Math.floor(Y+((null==(s=n.defaultView)?void 0:s.scrollY)||0))+"px"},C.add("rr_width"),C.add("rr_height"),C.add("rr_left"),C.add("rr_top"),J&&(x.rr_position=J.position||"static",C.add("rr_position"),J.transform&&"none"!==J.transform&&(x.rr_transform=J.transform,C.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(x.rr_display=J.display,C.add("rr_display")))}if("iframe"!==k||m(x.src)||(e.contentDocument||(x.rr_src=x.src),delete x.src),d||h)for(var X of Object.entries(x)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(x[ee]=mc({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:hu.Element,tagName:k,attributes:x,childNodes:[],isSVG:(B=e,Boolean("svg"===B.tagName||B.ownerSVGElement)||void 0),needBlock:w,rootId:S,isCustom:N}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:c,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:_,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r,i=t.needsMask,s=t.maskTextFn,n=t.rootId,o=Cu.parentNode(e),a=o&&o.tagName,l=Cu.textContent(e),u="STYLE"===a||void 0,c="SCRIPT"===a||void 0;if(u&&l){try{if(e.nextSibling||e.previousSibling);else if(Yu(o.sheet));else if(null==(r=o.sheet)?void 0:r.cssRules){var d=oc(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=xc(l,$c(t.doc))}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&i&&(l=s?s(l,Cu.parentElement(e)):l.replace(/[\S]/g,"*")),{type:hu.Text,textContent:l||"",isStyle:u,rootId:n}}(e,{doc:r,needsMask:n,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:hu.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:hu.Comment,textContent:Cu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,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===hu.Comment)return!0;if(e.type===hu.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 s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(r=null==s?void 0:s[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&&(Zc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Zc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Zc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Zc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Zc(e.attributes.property).match(/^(og|twitter|fb):/)||Zc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Zc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(Zc(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(Zc(e.attributes.name))||Zc(e.attributes.property).match(/^article:/)||Zc(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(Zc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===hu.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?Oc:Dc();var K=Object.assign(Q,{id:G});if(i.add(e,K),G===Oc)return null;I&&I(e);var Z=!u;if(K.type===hu.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=Cu.shadowRoot(e);Y&&rc(Y)&&(K.isShadowHost=!0)}if((K.type===hu.Document||K.type===hu.Element)&&Z){y.headWhitespace&&K.type===hu.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onIframeListenerRegistered:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:U};if(K.type===hu.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(Cu.childNodes(e))){var ee=ed(X,J);ee&&K.childNodes.push(ee)}var te=null;if(ec(e)&&(te=Cu.shadowRoot(e)))for(var re of Array.from(Cu.childNodes(te))){var ie=ed(re,J);ie&&(rc(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var se=Cu.parentNode(e);if(se&&tc(se)&&rc(se)&&(K.isShadow=!0),K.type===hu.Element&&"iframe"===K.tagName){var ne=function(e,t,r){var i,s=()=>{},n=e.contentWindow;if(!n)return s;try{i=n.document.readyState}catch(e){return s}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),Gc(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?Gc(e,"load",o):(a=!0,Gc(e,"load",c))}}var d,h="about:blank";try{d=n.location.href}catch(e){return s}if(d!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),Gc(e,"load",o)}}return e.addEventListener("load",o),()=>{Gc(e,"load",o)}}(e,(()=>{var t=e.contentDocument;if(t&&T){var r=ed(t,{doc:t,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onIframeListenerRegistered:R,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:U});r&&T(e,r)}}),P);null==R||R(e,ne)}return K.type===hu.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!Qc.has(t)){var c;try{c=t.sheet}catch(e){return}if(!c){var h=new AbortController,v=!1,b=()=>{if(!v){v=!0;try{(()=>{if(F){var t=ed(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:g,maskInputFn:_,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:x,canvasMaskingConfigured:E,preserveWhiteSpace:j,onSerialize:I,onIframeLoad:T,iframeLoadTimeout:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:U});t&&F(e,t)}})()}finally{Qc.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}),Qc.set(t,h)}}}(e,0,A),K}function td(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 rd{constructor(){nu(this,"parentElement",null),nu(this,"parentNode",null),nu(this,"ownerDocument"),nu(this,"firstChild",null),nu(this,"lastChild",null),nu(this,"previousSibling",null),nu(this,"nextSibling",null),nu(this,"ELEMENT_NODE",1),nu(this,"TEXT_NODE",3),nu(this,"nodeType"),nu(this,"nodeName"),nu(this,"RRNodeType")}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof rd))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 id(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>sd(r,e,t,i)}function sd(e,t,r,i){nd((()=>{var s=e.removeEventListener;"function"==typeof s&&(void 0!==i?s.call(e,t,r,i):s.call(e,t,r))}))}function nd(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}var od="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.",ad={map:{},getId(){return console.error(od),-1},getNode(){return console.error(od),null},removeNodeFromMap(){console.error(od)},has(){return console.error(od),!1},reset(){console.error(od)}};function ld(e,t,r){void 0===r&&(r={});var i=null,s=0;return function(){for(var n=arguments.length,o=new Array(n),a=0;n>a;a++)o[a]=arguments[a];var l=Date.now();s||!1!==r.leading||(s=l);var u=t-(l-s),c=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),s=l,e.apply(c,o)):i||!1===r.trailing||(i=setTimeout((()=>{s=!1===r.leading?0:Date.now(),i=null,e.apply(c,o)}),u))}}function ud(e,t,r,i,s){void 0===s&&(s=window);var n=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout((()=>{try{r.set.call(this,e)}catch(e){}}),0),n&&n.set){if(n.get)try{n.get.call(this)}catch(e){return}n.set.call(this,e)}}}),()=>ud(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ad=new Proxy(ad,{get(e,t,r){return"map"===t&&console.error(od),Reflect.get(e,t,r)}}));var cd=Date.now;function dd(e){var t,r,i,s,n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null==(t=Cu.parentElement(n.body))?void 0:t.scrollLeft)||(null==(r=null==n?void 0:n.body)?void 0:r.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null==(i=Cu.parentElement(n.body))?void 0:i.scrollTop)||(null==(s=null==n?void 0:n.body)?void 0:s.scrollTop)||0}}function hd(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function pd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function gd(e){return e?e.nodeType===e.ELEMENT_NODE?e:Cu.parentElement(e):null}function _d(e,t,r,i){if(!e)return!1;var s=gd(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(Vc(s,t,i))return!0}catch(e){}if(r){if(s.matches(r))return!0;if(i&&null!==s.closest(r))return!0}return!1}function vd(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||t.getId(e)===Oc}function fd(e,t){if(tc(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=Cu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||fd(i,t))}function md(e){return Boolean(e.changedTouches)}function yd(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function bd(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Sd(e){return!!e&&(e instanceof rd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Cu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(cd=()=>(new Date).getTime());class wd{constructor(){nu(this,"id",1),nu(this,"styleIDMap",new WeakMap),nu(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 kd(e){var t,r=null;return"getRootNode"in e&&(null==(t=Cu.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Cu.host(Cu.getRootNode(e))&&(r=Cu.host(Cu.getRootNode(e))),r}function Cd(e){var t=e.ownerDocument;return!!t&&(Cu.contains(t,e)||function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=kd(r);)r=t;return r}(e);return Cu.contains(t,r)}(e))}function xd(e){return"__ln"in e}class Ed{constructor(){nu(this,"length",0),nu(this,"head",null),nu(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&&xd(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&&xd(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 Id,Td=(e,t)=>e+"@"+t;class Md{constructor(){nu(this,"frozen",!1),nu(this,"locked",!1),nu(this,"texts",[]),nu(this,"attributes",[]),nu(this,"attributeMap",new WeakMap),nu(this,"generatedAttributes",new WeakMap),nu(this,"removes",[]),nu(this,"mapRemoves",[]),nu(this,"movedMap",{}),nu(this,"addedSet",new Set),nu(this,"movedSet",new Set),nu(this,"droppedSet",new Set),nu(this,"removesSubTreeCache",new Set),nu(this,"mutationCb"),nu(this,"blockClass"),nu(this,"blockSelector"),nu(this,"maskTextClass"),nu(this,"maskTextSelector"),nu(this,"inlineStylesheet"),nu(this,"maskInputOptions"),nu(this,"maskTextFn"),nu(this,"maskInputFn"),nu(this,"maskAllElementAttributes"),nu(this,"maskAttributeFn"),nu(this,"keepIframeSrcFn"),nu(this,"recordCanvas"),nu(this,"canvasMaskingConfigured"),nu(this,"inlineImages"),nu(this,"slimDOMOptions"),nu(this,"dataURLOptions"),nu(this,"doc"),nu(this,"mirror"),nu(this,"iframeManager"),nu(this,"stylesheetManager"),nu(this,"shadowDomManager"),nu(this,"canvasManager"),nu(this,"processedNodeManager"),nu(this,"unattachedDoc"),nu(this,"canvasManagerReleased",!1),nu(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),nu(this,"emit",(()=>{if(!this.frozen&&!this.locked){var e,t,r=Eu(),i=Pu();try{this.processBufferedMutations()}finally{e=Eu()-r,t=i,Fu>0||Ru(e,null!=t?t:Iu)||e>$u.slowestBatchMs&&($u.slowestBatchMs=e)}}})),nu(this,"processBufferedMutations",(()=>{for(var e=[],t=new Set,r=new Ed,i=e=>{for(var t=e,r=Oc;r===Oc;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},s=s=>{var n=Cu.parentNode(s);if(n&&Cd(s)&&"TEXTAREA"!==n.tagName){var o=tc(n)?this.mirror.getId(kd(s)):this.mirror.getId(n),a=i(s);if(-1===o||-1===a)return r.addNode(s);var l=ed(s,{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=>{yd(e,this.mirror)&&this.iframeManager.addIframe(e),bd(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Sd(e)&&!_d(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Cu.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 n of this.movedSet)Rd(this.removesSubTreeCache,n)&&!this.movedSet.has(Cu.parentNode(n))||s(n);for(var o of this.addedSet)Fd(this.droppedSet,o)||Rd(this.removesSubTreeCache,o)?Fd(this.movedSet,o)?s(o):this.droppedSet.add(o):s(o);for(var a=null;r.length;){var l=null;if(a){var u=this.mirror.getId(Cu.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(Cu.parentNode(h.value));if(-1===i(h.value))continue;if(-1!==p){l=h;break}var g=Cu.parentNode(h.value);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var _=Cu.host(g);if(-1!==this.mirror.getId(_)){l=h;break}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}a=l.previous,r.removeNode(l.value),s(l.value)}var v={texts:this.texts.map((e=>{var t=e.node,r=Cu.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),s=JSON.stringify(e._unchangedStyles);r.style.length>i.length&&(i+s).split("var(").length===r.style.split("var(").length&&(r.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var n of Object.entries(r)){var o=n[0],a=n[1];"string"!=typeof a&&null!==a||(r[o]=mc({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};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={},(v.texts.length||v.attributes.length||v.removes.length||v.adds.length)&&this.mutationCb(v)})),nu(this,"bufferBelongsToIframe",(e=>this.doc===e.contentDocument)),nu(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(Cu.childNodes(e),(e=>Cu.textContent(e)||"")).join("");t.attributes.value=_c({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:bc(e),value:r,maskInputFn:this.maskInputFn})})),nu(this,"processMutation",(e=>{var t;if(!vd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var r=Cu.textContent(e.target);_d(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue||this.texts.push({value:jc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,gd(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break;case"attributes":var i,s=e.target,n=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 s=e.lookupPrefix(r);return s?s+":"+t:t}(s,n,o),l=o?s.getAttributeNS(o,n):e.target.getAttribute(n);if("value"===a){var u=s,c=bc(u);l=_c({element:u,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:c,value:l,maskInputFn:this.maskInputFn})}if(_d(e.target,this.blockClass,this.blockSelector,!1)||l===e.oldValue)return;var d=this.attributeMap.get(e.target),h="IFRAME"===s.tagName&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&s.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===a&&"INPUT"===s.tagName&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!zc(s.tagName,a)){var p=Uc(this.doc,vc(s.tagName),vc(a),l,s,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 g=this.unattachedDoc.createElement("span"),_=s.style;for(var v of(e.oldValue&&(g.style.cssText=e.oldValue),Array.from(_))){var f=_.getPropertyValue(v),m=_.getPropertyPriority(v);f!==g.style.getPropertyValue(v)||m!==g.style.getPropertyPriority(v)?d.styleDiff[v]=""===m?f:[f,m]:d._unchangedStyles[v]=[f,m]}for(var y of Array.from(g.style))""===_.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===a&&"DIALOG"===s.tagName){d.attributes.rr_open_mode=s.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(_d(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=tc(e.target)?this.mirror.getId(Cu.host(e.target)):this.mirror.getId(e.target);_d(e.target,this.blockClass,this.blockSelector,!1)||vd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Pd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||fd(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Td(r,i)]?Pd(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!tc(e.target)||!rc(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),Cu.childNodes(i).forEach((e=>r.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),nu(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(vd(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[Td(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);_d(e,this.blockClass,this.blockSelector,!1)||(Cu.childNodes(e).forEach((e=>this.genAdds(e))),Sd(e)&&Cu.childNodes(Cu.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 Pd(e,t){for(var r=[t];r.length;){var i=r.pop();e.delete(i),Cu.childNodes(i).forEach((e=>r.push(e)))}}function Rd(e,t,r){return 0!==e.size&&function(e,t,r){var i=Cu.parentNode(t);return!!i&&e.has(i)}(e,t)}function Fd(e,t){if(0===e.size)return!1;for(var r=Cu.parentNode(t);r;){if(e.has(r))return!0;r=Cu.parentNode(r)}return!1}var Ld=function(e,t){return void 0===t&&(t="rrweb"),Id?function(){try{return e(...arguments)}catch(e){if(Id&&!0===Id(e,t))return;throw e}}:e},Ad=[];function Od(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 Dd(e,t){var r,i=new Md;i.init(e);try{r=new(wu())(Ld(i.processMutations.bind(i)));var s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),r.observe(t,s),Ad.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function Nd(e){var t=e.scrollCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Od(e);if(o&&!_d(o,s,n,!0)){var l,u,c=i.getId(o);if(o===r&&r.defaultView){var d=dd(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=[id("scroll",Ld(ld(Ld((e=>l(e))),o.scroll||100)),r)];return"onscrollend"in r&&u.push(id("scrollend",Ld(l),r)),()=>u.forEach((e=>e()))}function Bd(e,t){for(var r=Ad.length-1;r>=0;r--){var i=Ad[r];if(i){var s=i.bufferBelongsToIframe(e);!s&&t&&t.has(i.bufferDoc())&&(s=!0),s&&(i.reset(),Ad.splice(r,1))}}}var qd=["INPUT","TEXTAREA","SELECT"],Hd=new WeakMap;function $d(e){return function e(t,r){if(jd("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||jd("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||jd("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||jd("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 s=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(s)}return r}(e,[])}function Wd(e,t,r){var i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:i}):{}}var Ud=5e3;function zd(e,t){var r,i,s,n,o=e.stylesheetManager;n=e.mirror.getId("#document"===t.nodeName?t:Cu.host(t));var a="#document"===t.nodeName?null==(r=t.defaultView)?void 0:r.Document:null==(s=null==(i=t.ownerDocument)?void 0:i.defaultView)?void 0:s.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==n&&-1!==n&&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!==n&&-1!==n)try{o.adoptStyleSheets(e,n)}catch(e){}return r}}),Ld((()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function Vd(e,t){void 0===t&&(t={});var r,i,s=e.doc.defaultView;if(!s)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,s=e.mouseInteractionCb,n=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,g=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),s(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),n(...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),g(...arguments)}}(e,t);var n,o,a,l,u,c,d,h,p=[],g=Ld((()=>{if(i){i.destroy(),i.reset();var t=Ad.indexOf(i);-1!==t&&Ad.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect(),p.forEach((e=>e()))}));try{if(e.recordDOM){var v=Dd(e,e.doc);r=v.observer,i=v.buffer}if(p.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,s=e.mirror;if(!1===r.mousemove)return()=>{};var n,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=ld(Ld((e=>{var r=Date.now()-n;t(l.map((e=>(e.timeOffset-=r,e))),e),l=[],n=null})),a),c=Ld(ld(Ld((e=>{var t=Od(e),r=md(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;n||(n=cd()),l.push({x:i,y:o,id:s.getId(t),timeOffset:cd()-n}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?au.Drag:e instanceof MouseEvent?au.MouseMove:au.TouchMove)})),o,{trailing:!1})),d=[id("mousemove",c,i),id("touchmove",c,i),id("drag",c,i)];return Ld((()=>{d.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,s=e.blockClass,n=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(lu).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==a[e])).forEach((e=>{var o=vc(e),a=(e=>r=>{var o=Od(r);if(!_d(o,s,n,!0)){var a=null,l=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=uu.Mouse;break;case"touch":a=uu.Touch;break;case"pen":a=uu.Pen}a===uu.Touch&&(lu[e]===lu.MouseDown?l="TouchStart":lu[e]===lu.MouseUp&&(l="TouchEnd"))}else md(r)&&(a=uu.Touch);null!==a?(u=a,(l.startsWith("Touch")&&a===uu.Touch||l.startsWith("Mouse")&&a===uu.Mouse)&&(a=null)):lu[e]===lu.Click&&(a=u,u=null);var c=md(r)?r.changedTouches[0]:r;if(c){var d=i.getId(o),h=c.clientX,p=c.clientY;Ld(t)(_({type:lu[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))}}})(e);if(window.PointerEvent)switch(lu[e]){case lu.MouseDown:case lu.MouseUp:o=o.replace("mouse","pointer");break;case lu.TouchStart:case lu.TouchEnd:return}l.push(id(o,a,r))})),Ld((()=>{l.forEach((e=>e()))}))}(e)),p.push(Nd(e)),p.push(function(e,t){var r=e.viewportResizeCb,i=t.win,s=-1,n=-1;return id("resize",Ld(ld(Ld((()=>{var e=hd(),t=pd();s===e&&n===t||(r({width:Number(t),height:Number(e)}),s=e,n=t)})),200)),i)}(e,{win:s})),p.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.ignoreClass,a=e.ignoreSelector,l=e.maskInputOptions,u=e.maskInputFn,c=e.userTriggeredOnInput;function d(e){var t=Od(e),i=e.isTrusted,d=r.defaultView;if(!t||!d||t instanceof d.HTMLElement){var p=t&&t.tagName;if(t&&"OPTION"===p&&(t=Cu.parentElement(t)),t&&p&&qd.indexOf(p)>=0&&!_d(t,s,n,!0)&&!(t.classList.contains(o)||a&&t.matches(a))){var g=t.value,_=!1,v=bc(t)||"";"radio"===v||"checkbox"===v?_=t.checked:(l[p.toLowerCase()]||l[v])&&(g=_c({element:t,maskInputOptions:l,tagName:p,type:v,value:g,maskInputFn:u})),h(t,c?{text:g,isChecked:_,userTriggered:i}:{text:g,isChecked:_});var f=t.name;"radio"===v&&f&&_&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach((e=>{if(e!==t){var r=e.value;h(e,c?{text:r,isChecked:!_,userTriggered:!1}:{text:r,isChecked:!_})}}))}}}function h(e,r){var s=Hd.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Hd.set(e,r);var n=i.getId(e);Ld(t)(_({},r,{id:n}))}}var p=("last"===e.sampling.input?["change"]:["input","change"]).map((e=>id(e,Ld(d),r))),g=r.defaultView;if(!g)return()=>{p.forEach((e=>e()))};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&p.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map((e=>ud(e[0],e[1],{set(){Ld(d)({target:this,isTrusted:!1})}},!1,g)))),Ld((()=>{p.forEach((e=>e()))}))}(e)),p.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,s=e.mirror,n=e.sampling,o=e.doc,a=Ld((e=>ld(Ld((n=>{var o=Od(n);if(o&&!_d(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,c=o.playbackRate,d=o.loop;t({type:e,id:s.getId(o),currentTime:a,volume:l,muted:u,playbackRate:c,loop:d})}})),n.media||500))),l=[id("play",a(du.Play),o),id("pause",a(du.Pause),o),id("seeked",a(du.Seeked),o),id("volumechange",a(du.VolumeChange),o),id("ratechange",a(du.RateChange),o)];return Ld((()=>{l.forEach((e=>e()))}))}(e)),e.recordDOM){var f=function(e){var t=new Map,r=new Set,i=!0,s=e=>{if(i)try{e()}catch(e){}},n=e=>{var r,i=t.get(e);if(i){for(;null==(r=i[0])?void 0:r.ready;){var n=i.shift();(null==n?void 0:n.emit)&&s(n.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}),n(e)):s(r)}else s(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,g=()=>{h||p||(h=!0,void 0!==d&&r.delete(d),c.ready=!0,c.emit=void 0,n(o))};try{d=e.setTimeout(g,Ud),h||p?e.clearTimeout(d):r.add(d)}catch(e){g()}return t=>{!p&&i&&(p=!0,void 0!==d&&(e.clearTimeout(d),r.delete(d)),h?t&&s(l):(c.ready=!0,t||(c.emit=void 0),n(o)))}},reset(){i=!1,r.forEach((t=>e.clearTimeout(t))),r.clear(),t.clear()}}}(s);p.push(f.reset),p.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,s=e.stylesheetManager,n=t.win,o=t.mutationQueue;if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};var a=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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")}),n.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),n.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,c=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(c,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;s.onCssomSheetMutation(t);var c=Wd(t,i,s.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=oc(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")})),n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Wd(t,i,s.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={};Gd("CSSGroupingRule")?d.CSSGroupingRule=n.CSSGroupingRule:(Gd("CSSMediaRule")&&(d.CSSMediaRule=n.CSSMediaRule),Gd("CSSConditionRule")&&(d.CSSConditionRule=n.CSSConditionRule),Gd("CSSSupportsRule")&&(d.CSSSupportsRule=n.CSSSupportsRule));var h={};return Object.entries(d).forEach((e=>{var t=e[0],n=e[1];h[t]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Wd(t.parentStyleSheet,i,s.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...$d(t),l];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,adds:[{rule:a,index:h}]})))}return l}),"host")}),n.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Ld(((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Wd(t.parentStyleSheet,i,s.styleMirror),c=u.id,d=u.styleId;if(t.parentStyleSheet&&(c&&-1!==c||d&&-1!==d)){var h=[...$d(t),a];o.queueMutation(t.parentStyleSheet,(()=>r({id:c,styleId:d,removes:[{index:h}]})))}return l}),"host")})})),Ld((()=>{n.CSSStyleSheet.prototype.insertRule=a,n.CSSStyleSheet.prototype.deleteRule=c,l&&(n.CSSStyleSheet.prototype.replace=l),u&&(n.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:s,mutationQueue:f})),p.push(zd(e,e.doc)),p.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,s=e.ignoreCSSAttributes,n=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:Ld(((e,t,o)=>{var l,u=o[0],c=o[1],d=o[2],h=e.apply(t,o);if(s.has(u))return h;var p=null==(l=t.parentRule)?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);var g=Wd(p,i,n.styleMirror),_=g.id,v=g.styleId;if(_&&-1!==_||v&&-1!==v){var f=$d(t.parentRule);a.queueMutation(p,(()=>r({id:_,styleId:v,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:Ld(((e,t,o)=>{var l,u=o[0],c=e.apply(t,o);if(s.has(u))return c;var d=null==(l=t.parentRule)?void 0:l.parentStyleSheet;n.onCssomSheetMutation(d);var h=Wd(d,i,n.styleMirror),p=h.id,g=h.styleId;if(p&&-1!==p||g&&-1!==g){var _=$d(t.parentRule);a.queueMutation(d,(()=>r({id:p,styleId:g,remove:{property:u},index:_})))}return c}),"host")}),Ld((()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u}))}(e,{win:s,mutationQueue:f})),e.collectFonts&&p.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var s=[],n=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return n.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=ku(r.fonts,"add",(function(e){return function(r){return setTimeout(Ld((()=>{var e=n.get(r);e&&(t(e),n.delete(r))})),0),e.apply(this,[r])}}));return s.push((()=>{i.FontFace=o})),s.push(a),Ld((()=>{s.forEach((e=>e()))}))}(e))}for(var m of(p.push((o=(n=e).doc,a=n.mirror,l=n.blockClass,u=n.blockSelector,c=n.selectionCb,d=!0,(h=Ld((()=>{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 s=e.getRangeAt(i),n=s.startContainer,h=s.startOffset,p=s.endContainer,g=s.endOffset;_d(n,l,u,!0)||_d(p,l,u,!0)||t.push({start:a.getId(n),startOffset:h,end:a.getId(p),endOffset:g})}c({ranges:t})}})))(),id("selectionchange",h))),p.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?ku(r.customElements,"define",(function(e){return function(r,i,s){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,s])}})):()=>{}}(e)),e.plugins))p.push(m.observer(m.callback,s,m.options))}catch(e){try{g()}catch(e){}throw e}return g}function jd(e){return void 0!==window[e]}function Gd(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Qd{constructor(e){nu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),nu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var s=r||this.getRemoteIdToLocalIdMap(e),n=i||this.getLocalIdToRemoteIdMap(e),o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),n.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 Kd{constructor(e){nu(this,"iframes",new WeakMap),nu(this,"crossOriginIframeMap",new WeakMap),nu(this,"crossOriginIframeMirror",new Qd(Dc)),nu(this,"crossOriginIframeStyleMirror"),nu(this,"crossOriginIframeRootIdMap",new WeakMap),nu(this,"mirror"),nu(this,"mutationCb"),nu(this,"wrappedEmit"),nu(this,"loadListener"),nu(this,"pageHideListener"),nu(this,"stylesheetManager"),nu(this,"recordCrossOriginIframes"),nu(this,"messageHandler"),nu(this,"nestedIframeListeners",new Map),nu(this,"attachedWindows",new WeakMap),nu(this,"attachedDocuments",new WeakMap),nu(this,"attachedIframes",new Map),nu(this,"loadListenerDisposers",new WeakMap),nu(this,"iframeElementsById",new Map),nu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Qd(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=>nd(e))),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach((e=>{sd(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 s=this.attachedDocuments.get(e);s||this.attachedDocuments.set(e,s=new Set),s.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){var o=this.handleMessage.bind(this);nd((()=>{n.addEventListener("message",o),this.nestedIframeListeners.set(n,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(n)}))}nd((()=>{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 s=()=>{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",s),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:s})}})),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 ou.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:ou.IncrementalSnapshot,data:{source:au.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case ou.Meta:case ou.Load:case ou.DomContentLoaded:return!1;case ou.Plugin:return t;case ou.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case ou.IncrementalSnapshot:switch(t.data.source){case au.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 au.Drag:case au.TouchMove:case au.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case au.ViewportResize:return!1;case au.MediaInteraction:case au.MouseInteraction:case au.Scroll:case au.CanvasMutation:case au.Input:return this.replaceIds(t.data,e,["id"]),t;case au.StyleSheetRule:case au.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case au.Font:return t;case au.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case au.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 s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(r,t[s]):e.getId(r,t[s]));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===hu.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,s=this.attachedWindows.get(r);s&&(s.forEach((e=>{var t=this.nestedIframeListeners.get(e);t&&(sd(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)})),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(sd(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 n=this.attachedDocuments.get(r);n&&(n.forEach((e=>{nd((()=>this.mirror.removeNodeFromMap(e)))})),nd((()=>Bd(r,n))),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&&sd(window,"message",this.messageHandler),this.nestedIframeListeners.forEach(((e,t)=>{sd(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 Zd{constructor(e){nu(this,"shadowDoms",new WeakSet),nu(this,"mutationCb"),nu(this,"scrollCb"),nu(this,"bypassOptions"),nu(this,"mirror"),nu(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(rc(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(r=null==(i=Cu.host(e))?void 0:i.ownerDocument)&&void 0!==r?r:t,n=Dd(_({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),o=n.observer,a=n.buffer;this.restoreHandlers.push({doc:s,handler(){o.disconnect(),a.destroy(),a.releaseCanvasManager();var e=Ad.indexOf(a);-1!==e&&Ad.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Nd(_({},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(Cu.host(e))),this.restoreHandlers.push({doc:s,handler:zd({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:ku(e.prototype,"attachShadow",(function(e){return function(i){var s=e.call(this,i),n=Cu.shadowRoot(this);return n&&Cd(this)&&r.addShadowRoot(n,t),s}}))})}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 Yd="skip-frame";function Jd(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 Xd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),th=0;64>th;th++)eh[Xd.charCodeAt(th)]=th;var rh=new Map,ih=(e,t,r)=>{if(e&&(oh(e,t)||"object"==typeof e)){var i=function(e,t){var r=rh.get(e);return r||rh.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s}};function sh(e,t,r,i){if(e instanceof Array)return e.map((e=>sh(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 s=e.constructor.name,n=function(e){var t,r=new Uint8Array(e),i=r.length,s="";for(t=0;i>t;t+=3)s+=Xd[r[t]>>2],s+=Xd[(3&r[t])<<4|r[t+1]>>4],s+=Xd[(15&r[t+1])<<2|r[t+2]>>6],s+=Xd[63&r[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e);return{rr_type:s,base64:n}}return e instanceof DataView?{rr_type:e.constructor.name,args:[sh(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:[sh(e.data,t,r,i),e.width,e.height]}:oh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ih(e,t,r)}:e}var nh=(e,t,r,i)=>e.map((e=>sh(e,t,r,i))),oh=(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])))},ah=["webgl","webgl2"];function lh(e){return"nodeType"in e}function uh(e,t,r,i){var s=[];try{if(i){var n=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return ku(i.prototype,"configure",(function(i){return function(s){var n=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!n||lh(n)&&_d(n,t,r,!0))return i.call(this,s);lh(n)&&!("__context"in n)&&(n.__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&&s?_({},s,{usage:"number"==typeof s.usage?s.usage|o:o}):s)}}))}(e,t,r);n&&s.push(n)}var o=ku(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(s){for(var n=function(e){return"experimental-webgl"===e?"webgl":e}(s),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!_d(this,t,r,!0)&&("__context"in this||(this.__context=n),i&&ah.includes(n)))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,[s,...a])}}));s.push(o)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function ch(e,t,r,i,s,n,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=ku(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(ih(d,n,this),this.canvas&&"tagName"in this.canvas&&!_d(this.canvas,i,s,!0)){var h=nh(u,n,this,o);r(this.canvas,{type:t,property:l,args:h})}return d}}));a.push(u)}catch(n){var c=ud(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!_d(this.canvas,i,s,!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 dh,hh,ph,gh='(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',_h="undefined"!=typeof self&&self.Blob&&new Blob([gh],{type:"text/javascript;charset=utf-8"});function vh(e){var t;try{if(!(t=_h&&(self.URL||self.webkitURL).createObjectURL(_h)))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(gh),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class fh{constructor(e){nu(this,"pendingCanvasMutations",new Map),nu(this,"rafStamps",{latestId:0,invokeId:null}),nu(this,"mirror"),nu(this,"mutationCb"),nu(this,"resetObservers"),nu(this,"frozen",!1),nu(this,"locked",!1),nu(this,"rafIdTimestamp",null),nu(this,"rafIdFlush",null),nu(this,"refCount",0),nu(this,"torndown",!1),nu(this,"resetFrameDedup",null),nu(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,s=e.blockClass,n=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,s,n,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,s,n,{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,s){var n=this;if("OffscreenCanvas"in t){var o,a="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,l=uh(t,r,i,!0),u=new Map;try{o=new vh}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,s=r.displayHeight;this.mutationCb({id:t,type:cu["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,s]}],displayWidth:i,displayHeight:s})}};var d,h=1e3/e,p=0,_=e=>{var l,v;c||(p&&h>e-p||(p=e,(l=[],v=e=>{try{e.querySelectorAll("canvas").forEach((e=>{_d(e,r,i,!0)||l.push(e)})),e.querySelectorAll("*").forEach((e=>{e.shadowRoot&&v(e.shadowRoot)}))}catch(e){}},v(t.document),l).forEach(function(){var e=g((function*(e){var t,r,i=n.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)),g=function(e,t,r,i,s,n){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return Yd}if(void 0!==o){if(!Array.isArray(o)||!o.every(Jd))return Yd;var a=r/s,l=i/n;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}}))}}}(s.canvasMasking,e,h,p,c,d);if(g===Yd)return void u.set(i,!1);var _=yield createImageBitmap(e,1>a?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:i,bitmap:_,width:h,height:p,displayWidth:c,displayHeight:d,dataURLOptions:s.dataURLOptions,maskRegions:g},[_])}catch(e){u.set(i,!1)}}}));return function(t){return e.apply(this,arguments)}}())),d=requestAnimationFrame(_))};d=requestAnimationFrame(_),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 s=uh(e,t,r,!1),n=function(e,t,r,i,s){var n=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=ku(t.CanvasRenderingContext2D.prototype,o,(function(n){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return _d(this.canvas,r,i,!0)||setTimeout((()=>{var r=nh(l,t,this,s);e(this.canvas,{type:cu["2D"],property:o,args:r})}),0),n.apply(this,l)}}));n.push(a)}catch(s){var l=ud(t.CanvasRenderingContext2D.prototype,o,{set(t){_d(this.canvas,r,i,!0)||e(this.canvas,{type:cu["2D"],property:o,args:[t],setter:!0})}});n.push(l)}};for(var l of o)a(l);return()=>{n.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,s){var n=[];return void 0!==t.WebGLRenderingContext&&n.push(...ch(t.WebGLRenderingContext.prototype,cu.WebGL,e,r,i,t,s)),void 0!==t.WebGL2RenderingContext&&n.push(...ch(t.WebGL2RenderingContext.prototype,cu.WebGL2,e,r,i,t,s)),()=>{n.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{s(),n(),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=>v(e,iu)));this.mutationCb({id:t,type:r[0].type,commands:i}),this.pendingCanvasMutations.delete(e)}}}}class mh{constructor(e){var t;nu(this,"trackedLinkElements",new WeakSet),nu(this,"pendingDeferredSheets",new Set),nu(this,"mutationCb"),nu(this,"adoptedStyleSheetCb"),nu(this,"maskAllElementAttributes"),nu(this,"maskAttributeFn"),nu(this,"styleMirror",new wd),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=pc(i))}catch(e){}if(!r||!i)return Ju(),null;var s=r,n=!1,o={sheet:i,invalidate(){n=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,c=Eu(),d=Pu(),h=!0;try{if(n)return a=!0,Ju(),!0;if(!s.advance(r))return h=!1,!1;a=!0;var p=s.text();if(!e.isConnected)return!0;var g=null;try{g=e.sheet}catch(e){}return g!==i?(Ju(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(Ju(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),Ru(l=Eu()-c,null!=(u=d)?u:Iu)||(Wu.totalMs+=l,l>Wu.slowestSliceMs&&(Wu.slowestSliceMs=l))}},remainingRules:()=>s.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:mc({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:[]},s=[],n=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var n=r.styleMirror.add(e);t=n;var o=Eu();try{Ku((()=>{try{var t=e.rules||e.cssRules;t&&Qu(t)}catch(e){}s.push({styleId:n,rules:Array.from(e.rules||CSSRule,((t,r)=>({rule:ac(t,e.href),index:r})))})}))}finally{Zu(Eu()-o)}}i.styleIds.push(t)};for(var o of e)n(o);s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Qc.forEach((e=>e.abort())),Qc.clear()}trackStylesheetInLinkElement(e){}}class yh{constructor(){nu(this,"nodeMap",new WeakMap),nu(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 bh=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){var Sh=document.createElement("iframe");document.body.appendChild(Sh),Array.from=(null==(ru=Sh.contentWindow)?void 0:ru.Array.from)||Array.from,document.body.removeChild(Sh)}}catch(e){console.debug("Unable to override Array.from",e)}var wh=new gc,kh=new Set([au.Mutation,au.MediaInteraction,au.StyleSheetRule,au.CanvasMutation,au.Font,au.Log,au.StyleDeclaration,au.AdoptedStyleSheet]);function Ch(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 xh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,s=r.checkoutEveryNms,n=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,g=r.maskTextClass,v=void 0===g?"rr-mask":g,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,x=r.maskInputFn,E=r.maskTextFn,I=r.maskAllElementAttributes,T=void 0!==I&&I,M=r.maskAttributeFn,P=r.hooks,R=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,W=r.recordCanvas,U=void 0!==W&&W,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,se=void 0===ie?new Set([]):ie,ne=r.attributeFilter;Id=r.errorHandler;var oe=_({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),wh.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=td(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,ge=0,_e=new Map,ve=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return R&&!le&&(e=R(e)),e};dh=(e,t)=>{var r,o=e;if(o.timestamp=cd(),!(null==(r=Ad[0])?void 0:r.isFrozen())||o.type===ou.FullSnapshot||o.type===ou.IncrementalSnapshot&&kh.has(o.data.source)||Ad.forEach((e=>e.unfreeze())),ae)null==i||i(ve(o),t);else if(le){var a={type:"rrweb",event:ve(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(o.type===ou.FullSnapshot)ue=o,ge=0;else if(o.type===ou.IncrementalSnapshot){if(o.data.source===au.Mutation&&o.data.isAttachIframe)return;ge++,(n&&ge>=n||s&&o.timestamp-ue.timestamp>s)&&hh(!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 s=wh.getNode(i.node.id);s&&"IFRAME"===s.nodeName&&r.add(s)}e.removes.forEach((e=>{var i=e.id;if(!t||!t.has(i)){var s=Se.getIframeElementById(i);s&&r.has(s)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}})),null==pe||pe(),Se.cleanupDetachedIframes()}dh({type:ou.IncrementalSnapshot,data:_({source:au.Mutation},e)})},me=e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Scroll},e)}),ye=e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.CanvasMutation},e)}),be=new mh({mutationCb:fe,adoptedStyleSheetCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.AdoptedStyleSheet},e)}),maskAllElementAttributes:T,maskAttributeFn:M}),Se=new Kd({mirror:wh,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:dh});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:wh,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new yh,Ce=null==N?void 0:N.configured;ph=new fh({recordCanvas:U,mutationCb:ye,win:window,blockClass:a,blockSelector:u,mirror:wh,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var xe=new Zd({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:a,blockSelector:u,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:ce,dataURLOptions:oe,maskTextFn:E,maskInputFn:x,maskAllElementAttributes:T,maskAttributeFn:M,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:de,iframeManager:Se,stylesheetManager:be,canvasManager:ph,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:ne},mirror:wh});hh=function(e){if(void 0===e&&(e=!1),H){zu(S);try{dh({type:ou.Meta,data:{href:window.location.href,width:pd(),height:hd()}},e),null==t||t.cancel(),t=void 0,be.reset(),xe.init(),Ad.forEach((e=>e.lock()));var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,s=void 0===i?new gc:i,n=r.blockClass,o=void 0===n?"rr-block":n,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,g=void 0===p||p,_=r.inlineImages,v=void 0!==_&&_,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,x=void 0!==C&&C,E=r.maskAttributeFn,I=r.slimDOM,T=r.dataURLOptions,M=r.preserveWhiteSpace,P=r.onSerialize,R=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,W=td(void 0!==I&&I);zu(q);try{return ed(e,{doc:e,mirror:s,blockClass:o,blockSelector:l,maskTextClass:c,maskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:x,maskAttributeFn:E,slimDOMOptions:W,dataURLOptions:T,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:P,onIframeLoad:R,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{Vu()}}(document,{mirror:wh,blockClass:a,blockSelector:u,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:ce,inlineStylesheetBudgetRules:S,maskTextFn:E,maskInputFn:x,maskAllElementAttributes:T,maskAttributeFn:M,slimDOM:de,dataURLOptions:oe,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){yd(e,wh)&&Se.addIframe(e),bd(e,wh)&&be.trackLinkElement(e),Sd(e)&&xe.addShadowRoot(Cu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),xe.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{n=Bu,Bu=[],r=n}if(!i)return console.warn("Failed to snapshot the document");if(dh({type:ou.FullSnapshot,data:{node:i,initialOffset:dd(window)}},e),Ad.forEach((e=>e.unlock())),ph.onFullSnapshot(),r.length){var s=function(e,t,r){var i=!1,s=null,n=0,o=null,a=()=>null!==o||e.length>n,l=()=>{var r=e[n];e[n]=null,n+=1,r&&nd((()=>{o=t.beginDeferredLinkInlining(r,wh.getId(r))}))},u=()=>{if(o){var e=o,t=!0;nd((()=>{t=e.advance(200)})),t&&(o=null)}},c=e=>{if(s=null,!i){var t=0;do{try{o||l(),u()}catch(e){null==o||o.discard(),o=null,Xu(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?s=Ch(c):r())}};return s=Ch(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(!i){i=!0,null==s||s.cancel(),s=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=n;e.length>p;p++)null!==e[p]&&(h+=1);Xu(h),null==o||o.discard(),o=null}r()}}}}(r,be,(()=>{t===s&&(t=void 0)}));t=s}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,wh.getId(document))}finally{Vu()}var n}};try{var Ee=[];for(var Ie of(Ee.push(id("pagehide",(()=>{try{null==t||t.flush()}catch(e){}t=void 0}),window)),["visibilitychange","freeze","resume"]))Ee.push(id(Ie,Mu,document));he=e=>{var t=_e.get(e);t&&(t.forEach((e=>{nd(e);var t=Ee.indexOf(e);-1!==t&&Ee.splice(t,1)})),_e.delete(e))},pe=()=>{for(var e of _e){var t=e[0],r=wh.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 Te=e=>{var t;return Ld(Vd)({mutationCb:fe,mousemoveCb:(e,t)=>dh({type:ou.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.ViewportResize},e)}),inputCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Input},e)}),mediaInteractionCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.MediaInteraction},e)}),styleSheetRuleCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.StyleSheetRule},e)}),styleDeclarationCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>dh({type:ou.IncrementalSnapshot,data:_({source:au.Font},e)}),selectionCb(e){dh({type:ou.IncrementalSnapshot,data:_({source:au.Selection},e)})},customElementCb(e){dh({type:ou.IncrementalSnapshot,data:_({source:au.CustomElement},e)})},blockClass:a,ignoreClass:d,ignoreSelector:p,maskTextClass:v,maskTextSelector:m,maskInputOptions:ce,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:U,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:x,maskTextFn:E,maskAllElementAttributes:T,maskAttributeFn:M,keepIframeSrcFn:re,blockSelector:u,slimDOMOptions:de,dataURLOptions:oe,mirror:wh,iframeManager:Se,stylesheetManager:be,shadowDomManager:xe,processedNodeManager:ke,canvasManager:ph,ignoreCSSAttributes:se,attributeFilter:ne,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=>dh({type:ou.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},P)};Se.addLoadListener((e=>{try{var t=wh.getId(e),r=Te(e.contentDocument);if("function"==typeof r&&(Ee.push(r),-1!==t)){var i=_e.get(t);i||_e.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}})),Se.addPageHideListener((e=>{var t=wh.getId(e);null==he||he(t),Bd(e)}));var Me=-1,Pe=e=>dh({type:ou.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Re=()=>{var e,t,r,i,s=document,n=null!==(e=null!==(t=null!==(r=null!==(i=s.fullscreenElement)&&void 0!==i?i:s.webkitFullscreenElement)&&void 0!==r?r:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,o=n?wh.getId(n):-1;o!==Me&&(-1!==Me&&Pe({id:Me,enter:!1}),Me=o,-1!==o&&Pe({id:o,enter:!0}))},Fe=()=>{hh();var e=Te(document);"function"==typeof e&&Ee.push(e),Ee.push(id("fullscreenchange",Re)),Ee.push(id("webkitfullscreenchange",Re)),Ee.push(id("mozfullscreenchange",Re)),Ee.push(id("MSFullscreenChange",Re)),bh=!0};return["interactive","complete"].includes(document.readyState)?Fe():(Ee.push(id("DOMContentLoaded",(()=>{dh({type:ou.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()}))),Ee.push(id("load",(()=>{dh({type:ou.Load,data:{}}),"load"===G&&Fe()}),window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Ee.forEach((e=>nd(e))),ke.destroy(),Se.removeLoadListener(),Se.destroy(),_e.clear(),xe.reset(),wh.reset(),bh=!1,Id=void 0}}catch(e){console.warn(e)}}xh.addCustomEvent=(e,t)=>{if(!bh)throw new Error("please add custom event after start recording");dh({type:ou.Custom,data:{tag:e,payload:t}})},xh.freezePage=()=>{Ad.forEach((e=>e.freeze()))},xh.takeFullSnapshot=e=>{if(!bh)throw new Error("please take full snapshot after start recording");hh(e)},xh.mirror=wh;var Eh=Object.defineProperty,Ih=(e,t,r)=>((e,t,r)=>t in e?Eh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);class Th{constructor(e){Ih(this,"fileName"),Ih(this,"functionName"),Ih(this,"lineNumber"),Ih(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 Mh=/(^|@)\S+:\d+/,Ph=/^\s*at .*(\S+:\d+|\(native\))/m,Rh=/^(eval@)?(\[native code])?$/,Fh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Ph)?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(Ph)}),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),s=this.extractLocation(r?r[1]:i.pop()),n=i.join(" ")||void 0,o=["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0];return new Th({functionName:n,fileName:o,lineNumber:s[1],columnNumber:s[2]})}),this)},parseFFOrSafari(e){return e.stack.split("\n").filter((function(e){return!e.match(Rh)}),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 Th({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,s=this.extractLocation(e.replace(t,""));return new Th({functionName:i,fileName:s[0],lineNumber:s[1],columnNumber:s[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=[],s=2,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new Th({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=[],s=0,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new Th({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(Mh)&&!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 Th({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}),this)}};function Lh(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,s=[];if(i.children&&i.children.length>0)for(var n=0;i.children.length>n;n++){var o=i.children[n];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&s.push(o)}s.length>1&&(r+=":eq("+s.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function Ah(e){return Array.isArray(e)}function Oh(e){return"object"==typeof e&&null!==e&&!Ah(e)}function Dh(e,t){if(0===t)return!0;var r=Object.keys(e);for(var i of r)if(Oh(e[i])&&Dh(e[i],t-1))return!0;return!1}function Nh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],s=[];return JSON.stringify(e,(function(e,t){if(i.length>0){var n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?s.splice(n,1/0,e):s.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Oh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Oh(o)&&Dh(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]=Ah(u)?Lh(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 Bh={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 qh(e,t,r){var i,s=r?Object.assign({},Bh,r):Bh,n=s.logger;if(!n)return()=>{};i="string"==typeof n?t[n]:n;var o=0,a=!1,l=[];if(s.level.includes("error")){var u=t=>{var r=t.message,i=Fh.parse(t.error).map((e=>e.toString())),n=[Nh(r,s.stringifyOptions)];e({level:"error",trace:i,payload:n})};t.addEventListener("error",u),l.push((()=>{t.removeEventListener("error",u)}));var c=t=>{var r,i;t.reason instanceof Error?i=[Nh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,s.stringifyOptions)]:(r=new Error,i=[Nh("Uncaught (in promise)",s.stringifyOptions),Nh(t.reason,s.stringifyOptions)]);var n=Fh.parse(r).map((e=>e.toString()));e({level:"error",trace:n,payload:i})};t.addEventListener("unhandledrejection",c),l.push((()=>{t.removeEventListener("unhandledrejection",c)}))}for(var d of s.level)l.push(h(i,d));return()=>{l.forEach((e=>e()))};function h(t,r){var i=this;return t[r]?function(t,n,l){try{if(!(n in t))return()=>{};var u=t[n],c={next:u},d=(t=>function(){for(var n=arguments.length,l=new Array(n),u=0;n>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var c=Fh.parse(new Error).map((e=>e.toString())).splice(1),d=("assert"===r?l.slice(1):l).map((e=>Nh(e,s.stringifyOptions)));o++,s.lengthThreshold>o?e({level:r,trace:c,payload:d}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[Nh("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[n]=d,()=>{if(t[n]!==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[n],i=e(r);i;){if(i.next===d)return void(i.next=c.next);i=e(r=i.next)}else t[n]=c.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Hh=e=>({name:"rrweb/console@1",observer:qh,options:e}),$h=e=>"undefined"!=typeof Document&&e instanceof Document,Wh=()=>{},Uh=e=>{var t;if(Q(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function zh(e,t,r){try{if(!(t in e))return Wh;var i={next:e[t]},s=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(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t],n=Uh(r);n;){if(n.next===s)return void(n.next=i.next);n=Uh(r=n.next)}else e[t]=i.next}}catch(e){return Wh}}function Vh(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),s={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return s;for(var n of t.payloadHostDenyList)if(i.endsWith(n))return{hostname:i,isHostDenied:!0};return s}var jh=Zr("[Recorder]"),Gh=e=>"navigation"===e.entryType,Qh=e=>"resource"===e.entryType;function Kh(e,t){return!!t&&(se(t)||t[e])}function Zh(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 Yh=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function Jh(e){var t=e.type,r=e.recordBody,i=e.headers;function s(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:!!Zh(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(s(Yh))return!1;if(se(r))return!0;if(G(r))return s(r);var n=r[t];return se(n)?n:s(n)}function Xh(e,t,r,i,s,n){return ep.apply(this,arguments)}function ep(){return ep=g((function*(e,t,r,i,s,n){if(void 0===n&&(n=0),n>10)return jh.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null;var o=function(e,r){for(var n=e.length-1;n>=0;n-=1)if(Qh(o=e[n])&&o.initiatorType===t&&(Y(i)||o.startTime>=i)&&(Y(s)||s>=o.startTime))return e[n];var o}(e.performance.getEntriesByName(r));return o||(yield new Promise((e=>setTimeout(e,50*n))),Xh(e,t,r,i,s,n+1))})),ep.apply(this,arguments)}function tp(e){var t=e.body,r=e.options,i=e.url;if(te(t))return null;var s=Vh(i,r);if(s.isHostDenied)return s.hostname+" is in deny list";if(J(t))return t;if($h(t))return t.textContent;if(ne(t))return di(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 rp=e=>!ee(e)&&("navigation"===e.entryType||"resource"===e.entryType);function ip(e){var t=e.entry,r=e.method,i=e.status,s=e.networkRequest,n=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=[_({},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:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(rp(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 sp=["video/","audio/"];function np(e){return K(e)&&Q(e.getReader)&&Q(e.tee)}var op=500,ap="[SessionReplay] Timeout while trying to read body",lp="[SessionReplay] Failed to read body";function up(e){return lp+": "+e}function cp(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function dp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise((t=>{var r=setTimeout((()=>t(ap)),op);try{e.clone().text().then((e=>t(e)),(e=>t(up(e)))).finally((()=>clearTimeout(r)))}catch(e){clearTimeout(r),t(lp)}}))}(e);var r=ds(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 s=parseInt(i,10);return Number.isFinite(s)&&s>t}catch(e){return!1}}(e,r)?Promise.resolve(cp(r)):function(e,t){return new Promise((r=>{var i,s=!1;function n(){try{var e;null==(e=i)||e.cancel().catch((()=>{}))}catch(e){}}function o(e){s||(s=!0,clearTimeout(l),n(),r(e))}var a,l=setTimeout((()=>o(ap)),op);try{a=e.clone()}catch(e){return void o(lp)}var u=a.body;if(np(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(lp)}var c=[],d=0;!function e(){i.read().then((r=>{var i=r.done,a=r.value;if(s)n();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var s of e)r.set(s,i),i+=s.byteLength;return r}(c,d)));else{if(a){if(d+a.byteLength>t)return void o(cp(t));d+=a.byteLength,c.push(a)}e()}}),(e=>o(up(e))))}()}else try{a.text().then((e=>o(e)),(e=>o(up(e))))}catch(e){o(lp)}}))}(e,r)}function hp(){return hp=g((function*(e){var t=e.r,r=e.options,i=Vh(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):dp(t,r)})),hp.apply(this,arguments)}function pp(){return pp=g((function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,s=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var n=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=sp.some((e=>null==n?void 0:n.startsWith(e)));if(n&&o)return"Content-Type "+n+" is not supported";var a=Vh(s,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return ee(i)?dp(t,r):Promise.resolve(i)})),pp.apply(this,arguments)}var gp=null;function _p(e,t,r){if(!("performance"in t))return()=>{};if(gp)return jh.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},hs,r):hs,s=t=>{var r=[],s=!1;t.requests.forEach((e=>{var t="serverTiming"===e.entryType;if(!t||!s){var n=i.maskRequestFn(e);t||(s=!n||(e=>!!e&&bs.has(e))(n)),n&&r.push(n)}})),r.length>0&&e(_({},t,{requests:r}))},n=function(e,t,r){if(r.recordInitialRequests){var i=t.performance.getEntries().filter((e=>Gh(e)||Qh(e)&&r.initiatorTypes.includes(e.initiatorType)));e({requests:i.flatMap((e=>ip({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0}))),isInitial:!0})}var s=new t.PerformanceObserver((t=>{var i=t.getEntries().filter((e=>Gh(e)||Qh(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)));e({requests:i.flatMap((e=>ip({entry:e,method:void 0,status:void 0,networkRequest:{}})))})})),n=PerformanceObserver.supportedEntryTypes.filter((e=>r.performanceEntryTypeToObserve.includes(e)));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(s,t,i),o=()=>{},a=()=>{};return(i.recordHeaders||i.recordBody)&&(o=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=Kh("request",r.recordHeaders),s=Kh("response",r.recordHeaders),n=zh(t.XMLHttpRequest.prototype,"open",(n=>function(o,a,l,u,c){void 0===l&&(l=!0);var d=this;try{var h,p,g=new Request(a),_={},v={},f=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(_.requestHeaders=v);var m=d.send.bind(d);d.send=e=>(Jh({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(_.requestBody=tp({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(),s=t.join(": ");r&&(i[r]=s)})),s&&(_.responseHeaders=i),Jh({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(_.responseBody=tp({body:d.response,options:r,url:a})),Xh(t,"xmlhttprequest",g.url,h,p).then((t=>{var r=ip({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:_,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){jh.error("Failed to instrument XHR for network capture",e)}n.call(d,o,a.toString(),l,u,c)}));return()=>{n()}}(s,t,i),a=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=Kh("request",r.recordHeaders),s=Kh("response",r.recordHeaders),n=zh(t,"fetch",(n=>function(){var o=g((function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return jh.error("Failed to instrument fetch for network capture",e),n(o,a)}var c,d,h={};try{try{var p={};l.headers.forEach(((e,t)=>{p[t]=e})),i&&(h.requestHeaders=p),!np(null==a?void 0:a.body)&&Jh({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return hp.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){jh.error("Failed to record fetch request for network capture",e)}c=t.performance.now(),u=Zh(o)?yield n(l):yield n(o,a),d=t.performance.now();var g={};u.headers.forEach(((e,t)=>{g[t]=e})),s&&(h.responseHeaders=g);try{Jh({type:"response",headers:g,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return pp.apply(this,arguments)}({r:u,options:r,url:o}))}catch(e){jh.error("Failed to record fetch response for network capture",e)}return u}finally{Xh(t,"fetch",l.url,c,d).then((t=>{var r,i=ip({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()=>{n()}}(s,t,i)),gp=()=>{n(),o(),a(),gp=null}}var vp=e=>({name:"rrweb/network@1",observer:_p,options:e});h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Hh,getRecordNetworkPlugin:vp},h.__PosthogExtensions__.rrweb={record:xh,version:"v2",wasMaxDepthReached:()=>Xc,resetMaxDepthState(){Xc=!1,Jc=!1},getLastSnapshotCost:()=>Du,getMutationCost:()=>_({},$u),resetSnapshotCostState(){Fu=0,Lu=0,Au=0,Iu=0,Ou=xu(),Du=null,Nu=null,Bu=[],qu=0,Hu=0,$u={slowestBatchMs:0},Wu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:xh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:Hh},h.getRecordNetworkPlugin=vp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new tu(e,t);var fp,mp,yp,bp,Sp,wp,kp,Cp,xp,Ep,Ip,Tp,Mp,Pp,Rp,Fp={},Lp=[],Ap=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Op=Array.isArray;function Dp(e,t){for(var r in t)e[r]=t[r];return e}function Np(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Bp(e,t,r){var i,s,n,o={};for(n in t)"key"==n?i=t[n]:"ref"==n?s=t[n]:o[n]=t[n];if(arguments.length>2&&(o.children=arguments.length>3?fp.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return qp(e,o,i,s,null)}function qp(e,t,r,i,s){var n={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++yp:s,__i:-1,__u:0};return null==s&&null!=mp.vnode&&mp.vnode(n),n}function Hp(e){return e.children}function $p(e,t){this.props=e,this.context=t}function Wp(e,t){if(null==t)return e.__?Wp(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?Wp(e):null}function Up(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],s=[],n=Dp({},t);n.__v=t.__v+1,mp.vnode&&mp.vnode(n),Xp(e.__P,n,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?Wp(t):r,!!(32&t.__u),s),n.__v=t.__v,n.__.__k[n.__i]=n,tg(i,n,s),t.__e=t.__=null,n.__e!=r&&zp(n)}}function zp(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})),zp(e)}function Vp(e){(!e.__d&&(e.__d=!0)&&bp.push(e)&&!jp.__r++||Sp!=mp.debounceRendering)&&((Sp=mp.debounceRendering)||wp)(jp)}function jp(){try{for(var e,t=1;bp.length;)bp.length>t&&bp.sort(kp),e=bp.shift(),t=bp.length,Up(e)}finally{bp.length=jp.__r=0}}function Gp(e,t,r,i,s,n,o,a,l,u,c){var d,h,p,g,_,v,f,m=i&&i.__k||Lp,y=t.length;for(l=function(e,t,r,i,s){var n,o,a,l,u,c=r.length,d=c,h=0;for(e.__k=new Array(s),n=0;s>n;n++)null!=(o=t[n])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[n]=qp(null,o,null,null,null):Op(o)?o=e.__k[n]=qp(Hp,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[n]=qp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[n]=o,l=n+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=Kp(o,r,l,d))&&(d--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>c?h--:c>s&&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[n]=null;if(d)for(n=0;c>n;n++)null!=(a=r[n])&&0==(2&a.__u)&&(a.__e==i&&(i=Wp(a)),sg(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]||Fp,p.__i=d,v=Xp(e,p,h,s,n,o,a,l,u,c),g=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&ig(h.ref,null,p),c.push(p.ref,p.__c||g,p)),null==_&&null!=g&&(_=g),(f=!!(4&p.__u))||h.__k===p.__k?(l=Qp(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:g&&(l=g.nextSibling),p.__u&=-7);return r.__e=_,l}function Qp(e,t,r,i){var s,n;if("function"==typeof e.type){for(s=e.__k,n=0;s&&s.length>n;n++)s[n]&&(s[n].__=e,t=Qp(s[n],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=Wp(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Kp(e,t,r,i){var s,n,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(s=r-1,n=r+1;s>=0||t.length>n;)if(null!=(u=t[o=0>s?n++:s--])&&0==(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Zp(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Ap.test(t)?r:r+"px"}function Yp(e,t,r,i,s){var n,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||Zp(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||Zp(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])n=t!=(t=t.replace(Ip,"$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+n]=r,r?i?r[Ep]=i[Ep]:(r[Ep]=Tp,e.addEventListener(t,n?Pp:Mp,n)):e.removeEventListener(t,n?Pp:Mp,n);else{if("http://www.w3.org/2000/svg"==s)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 Jp(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[xp])t[xp]=Tp++;else if(r[Ep]>t[xp])return;return r(mp.event?mp.event(t):t)}}}function Xp(e,t,r,i,s,n,o,a,l,u){var c,d,h,p,g,_,v,f,m,y,$,b,S,w,k,C,x=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),n=[a=t.__e=r.__e]),(c=mp.__b)&&c(t);e:if("function"==typeof x){d=o.length;try{if(m=t.props,y=x.prototype&&x.prototype.render,$=(c=x.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 x(m,b):(t.__c=h=new $p(m,b),h.constructor=x,h.render=ng),$&&$.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!=x.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Dp({},h.__s)),Dp(h.__s,x.getDerivedStateFromProps(m,h.__s))),g=h.props,_=h.state,h.__v=t,p)y&&null==x.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==x.getDerivedStateFromProps&&m!==g&&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)})),Lp.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(g,_,v)}))}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=mp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),c=h.render(h.props,h.state,h.context),Lp.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=Dp(Dp({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),k=null!=c&&c.type===Hp&&null==c.key?rg(c.props.children):c,a=Gp(e,Op(k)?k:[k],t,r,i,s,n,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!=n)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=n&&(n[n.indexOf(a)]=null),t.__e=a}else{if(null!=n)for(C=n.length;C--;)Np(n[C]);eg(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||eg(t);mp.__e(e,t,r)}}else null==n&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,s,n,o,a,l){var u,c,d,h,p,g,_,v=r.props||Fp,f=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=n)for(u=0;n.length>u;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(s,m,f.is&&f),a&&(mp.__m&&mp.__m(t,n),a=!1),n=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(n="textarea"==m&&null!=f.defaultValue?null:n&&fp.call(e.childNodes),!a&&null!=n)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?d=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||Yp(e,u,null,p,s);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?c=p:"value"==u?g=p:"checked"==u?_=p:a&&"function"!=typeof p||v[u]===p||Yp(e,u,p,v[u],s);if(c)a||d&&(c.__html==d.__html||c.__html==e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(d&&(e.innerHTML=""),Gp("template"==t.type?e.content:e,Op(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:r.__k&&Wp(r,0),a,l),null!=n)for(u=n.length;u--;)Np(n[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==g?e.removeAttribute("value"):null!=g&&(g!==e[u]||"progress"==m&&!g||"option"==m&&g!=v[u])&&Yp(e,u,g,v[u],s),u="checked",null!=_&&_!=e[u]&&Yp(e,u,_,v[u],s))}return e}(r.__e,t,r,i,s,n,o,l,u);return(c=mp.diffed)&&c(t),128&t.__u?void 0:a}function eg(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(eg))}function tg(e,t,r){for(var i=0;r.length>i;i++)ig(r[i],r[++i],r[++i]);mp.__c&&mp.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){mp.__e(e,t.__v)}}))}function rg(e){return"object"!=typeof e||null==e||e.__b>0?e:Op(e)?e.map(rg):void 0!==e.constructor?null:Dp({},e)}function ig(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){mp.__e(e,r)}}function sg(e,t,r){var i,s;if(mp.unmount&&mp.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ig(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){mp.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(s=0;i.length>s;s++)i[s]&&sg(i[s],t,r||"function"!=typeof e.type);r||Np(e.__e),e.__c=e.__=e.__e=void 0}function ng(e,t,r){return this.constructor(e,r)}function og(e,t,r){var i,s,n;t==document&&(t=document.documentElement),mp.__&&mp.__(e,t),i=t.__k,s=[],n=[],Xp(t,e=t.__k=Bp(Hp,null,[e]),i||Fp,Fp,t.namespaceURI,i?null:t.firstChild?fp.call(t.childNodes):null,s,i?i.__e:t.firstChild,!1,n),tg(s,e,n),e.props.children=null}fp=Lp.slice,mp={__e(e,t,r,i){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},yp=0,$p.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Dp({},this.state),"function"==typeof e&&(e=e(Dp({},r),this.props)),e&&Dp(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),Vp(this))},$p.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Vp(this))},$p.prototype.render=Hp,bp=[],wp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kp=function(e,t){return e.__v.__b-t.__v.__b},jp.__r=0,Cp=Math.random().toString(8),xp="__d"+Cp,Ep="__a"+Cp,Ip=/(PointerCapture)$|Capture$/i,Tp=0,Mp=Jp(!1),Pp=Jp(!0),Rp=0;var ag,lg,ug,cg,dg=0,hg=[],pg=mp,gg=pg.__b,_g=pg.__r,vg=pg.diffed,fg=pg.__c,mg=pg.unmount,yg=pg.__;function bg(e,t){pg.__h&&pg.__h(lg,e,dg||t),dg=0;var r=lg.__H||(lg.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Sg(e){return dg=1,function(e,t,r){var i=bg(ag++,2);if(i.t=e,!i.__c&&(i.__=[Fg(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=lg,!lg.__f)){var s=function(e,t,r){if(!i.__c.__H)return!0;var s=!1,o=i.__c.props!==e;if(i.__c.__H.__.some((function(e){if(e.__N){s=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),n){var a=n.call(this,e,t,r);return s?a||o:a}return!s||o};lg.__f=!0;var n=lg.shouldComponentUpdate,o=lg.componentWillUpdate;lg.componentWillUpdate=function(e,t,r){if(this.__e){var i=n;n=void 0,s(e,t,r),n=i}o&&o.call(this,e,t,r)},lg.shouldComponentUpdate=s}return i.__N||i.__}(Fg,e)}function wg(e,t){var r=bg(ag++,3);!pg.__s&&Rg(r.__H,t)&&(r.__=e,r.u=t,lg.__H.__h.push(r))}function kg(e){return dg=5,Cg((function(){return{current:e}}),[])}function Cg(e,t){var r=bg(ag++,7);return Rg(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function xg(e){var t=lg.context[e.__c],r=bg(ag++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(lg)),t.props.value):e.__}function Eg(){for(var e;e=hg.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Mg),t.__h.some(Pg),t.__h=[]}catch(r){t.__h=[],pg.__e(r,e.__v)}}}pg.__b=function(e){lg=null,gg&&gg(e)},pg.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yg&&yg(e,t)},pg.__r=function(e){_g&&_g(e),ag=0;var t=(lg=e.__c).__H;t&&(ug===lg?(t.__h=[],lg.__h=[],t.__.some((function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0}))):(t.__h.length&&Eg(),ag=0)),ug=lg},pg.diffed=function(e){vg&&vg(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==hg.push(t)&&cg===pg.requestAnimationFrame||((cg=pg.requestAnimationFrame)||Tg)(Eg)),t.__H.__.some((function(e){e.u&&(e.__H=e.u,e.u=void 0)}))),ug=lg=null},pg.__c=function(e,t){t.some((function(e){try{e.__h.some(Mg),e.__h=e.__h.filter((function(e){return!e.__||Pg(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],pg.__e(r,e.__v)}})),fg&&fg(e,t)},pg.unmount=function(e){mg&&mg(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some((function(e){try{Mg(e)}catch(e){t=e}})),r.__H=void 0,t&&pg.__e(t,r.__v))};var Ig="function"==typeof requestAnimationFrame;function Tg(e){var t,r=function(){clearTimeout(i),Ig&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);Ig&&(t=requestAnimationFrame(r))}function Mg(e){var t=lg,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),lg=t}function Pg(e){var t=lg;e.__c=e.__(),lg=t}function Rg(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Fg(e,t){return"function"==typeof t?t(e):t}function Lg(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&Q(r.then)&&r.then(void 0,(()=>{}))}}}}var Ag="gzip-js",Og="base64",Dg="events",Ng="cancelEvents",Bg={Tab:"tab",Selector:"selector"},qg={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"},Hg={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},$g={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Wg={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ug={End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},zg="always",Vg={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},jg={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",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_COMPLETED:"$survey_completed",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Gg="popover",Qg=Zr("[Surveys]");function Kg(e){return!(!e.start_date||e.end_date)}function Zg(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var Yg="seenSurvey_",Jg="inProgressSurvey_",Xg=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),e_=e=>Xg(Yg,e),t_=e=>{try{var t=e_(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){Qg.error("Failed to persist survey seen state",e)}},r_=[$g.Popover,$g.Widget,$g.API],i_={ignoreConditions:!1,ignoreDelay:!1,displayType:Gg},s_="featureFlags",n_="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 o_{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 s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new o_(s)}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 o_(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 a_{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 o_.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 c_}}var l_,u_=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&&(u_=e=>crypto.getRandomValues(e));class c_{nextUint32(){return this._buffer.length>this._cursor||(u_(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var d_=()=>h_().toString(),h_=()=>(l_||(l_=new a_)).generate(),p_="",g_=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var __=null,v_={_is_supported(){if(!ee(__))return __;if(__=!1,i)try{var e="__ph_cookie_support_"+d_();v_._set(e,"xyz"),__='"xyz"'===Wa(e),v_._remove(e)}catch(e){__=!1}return __},_error(e){Kr.error("cookieStore error: "+e)},_get:Wa,_parse(e){var t;try{t=JSON.parse(v_._get(e))||{}}catch(e){}return t},_set(e,t,r,s,n){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),p_)return p_;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),s=Math.min(r.length,8),n="dmn_chk_"+d_();!p_&&s--;){var o=r.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(n)&&(t.cookie=a+";max-age=0",p_=o)}return p_}(e);if(!r){var s=(e=>{var t=e.match(g_);return t?t[0]:""})(e);s!==r&&Kr.info("Warning: cookie subdomain discovery mismatch",s,r),r=s}return r?"; domain=."+r:""}return""}(i.location.hostname,s);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),o="; expires="+u.toUTCString()}n&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Kr.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{v_._set(e,"",-1,t)}catch(e){return}}},f_=null,m_={_is_supported(){if(!ee(f_))return f_;var t=!0;if(Y(e))t=!1;else try{var r="__mplssupport__";m_._set(r,"xyz"),'"xyz"'!==m_._get(r)&&(t=!1),m_._remove(r)}catch(e){t=!1}return t||Kr.error("localStorage unsupported; falling back to cookie store"),f_=t,t},_error(e){Kr.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){m_._error(e)}return null},_parse(e){try{return JSON.parse(m_._get(e))||{}}catch(e){}return null},_set(t,r){try{return null==e||e.localStorage.setItem(t,JSON.stringify(r)),!0}catch(e){m_._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){m_._error(e)}}},y_=[un,en,Xs,rn,sn,nn,Sn,bn,mn],b_=[ks,ws,Us,zs,Tn,In,wn],S_=e=>e+"_cpm",w_=["__proto__","constructor","prototype"],k_=e=>{if(!K(e))return{};var t={};return Object.keys(e).forEach((r=>{-1===w_.indexOf(r)&&(t[r]=e[r])})),t},C_=function(e,t){void 0===t&&(t=[]);var r={};return[...b_,...t].forEach((t=>{var i=e[t];Y(i)||ee(i)||""===i||(r[t]=i)})),r},x_=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var s=e.charCodeAt(i);t=33*t^s,r=Math.imul(r^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},E_=(e,t)=>({p:t,f:x_(JSON.stringify(e))}),I_=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=v_._parse(S_(e)),i=(null==r?void 0:r.f)===x_(t)&&G(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},T_=(e,t)=>t+"|"+(v_._get(S_(e))||""),M_={},P_={_is_supported:()=>!0,_error(e){Kr.error("memoryStorage error: "+e)},_get:e=>e in M_?M_[e]:null,_parse:e=>e in M_?M_[e]:null,_set:(e,t)=>(M_[e]=t,!0),_remove(e){delete M_[e]}},R_=null,F_={_is_supported(){if(!ee(R_))return R_;if(R_=!0,Y(e))R_=!1;else try{var t="__support__";F_._set(t,"xyz"),'"xyz"'!==F_._get(t)&&(R_=!1),F_._remove(t)}catch(e){R_=!1}return R_},_error(e){Kr.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){F_._error(e)}return null},_parse(e){try{return JSON.parse(F_._get(e))||null}catch(e){}return null},_set(t,r){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(r)),!0}catch(e){F_._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){F_._error(e)}}},L_=Zr("[Stylesheet Loader]"),A_=e,O_=i,D_="#020617",N_={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:qg.Right,widgetType:Bg.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:D_,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},B_=[qg.Center,qg.Left,qg.Right];function q_(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 H_(e){var t;void 0===e&&(e=N_.backgroundColor),"#"===e[0]&&(t=q_(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=q_(r)),!t)return D_;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var s=parseInt(i[1]),n=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(s*s*.299+n*n*.587+o*o*.114)>127.5?D_:"white"}return D_}var $_=(e,t,r)=>{var i=ov(e),s=O_.querySelector("."+i);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var n=O_.createElement("div");((e,t,r)=>{var i=_({},N_,r),s=e.style,n=!B_.includes(i.position)||t===$g.Widget&&(null==r?void 0:r.widgetType)===Bg.Tab;s.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)),s.setProperty("--ph-survey-box-padding",i.boxPadding),s.setProperty("--ph-survey-max-width",i.maxWidth),s.setProperty("--ph-survey-z-index",i.zIndex),s.setProperty("--ph-survey-border-color",i.borderColor),n?(s.setProperty("--ph-survey-border-radius",i.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",i.borderRadius+" "+i.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",i.backgroundColor),s.setProperty("--ph-survey-box-shadow",i.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||H_(i.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",H_(i.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||H_(i.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),s.setProperty("--ph-widget-color",i.widgetColor),s.setProperty("--ph-widget-text-color",H_(i.widgetColor)),s.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"),s.setProperty("--ph-survey-input-background",a);var l=(null==r?void 0:r.inputTextColor)||H_(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",i.outlineColor)})(n,e.type,e.appearance),n.className=i;var o=n.attachShadow({mode:"open"}),a=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var s=(e=>{var t;return Q(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return s&&(i=s(i)),i||(L_.error("prepare_external_dependency_stylesheet returned null"),null)})(O_,':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 O_.body.appendChild(n),{shadow:o,isNewlyCreated:!0}},W_=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,s=e.posthog,n=e.isSurveyCompleted,o=e.properties,a=e.surveyLanguage,l=e.questionSnapshots;s?(t_(r),s.capture(Vg.SENT,_({[jg.SURVEY_NAME]:r.name,[jg.SURVEY_ID]:r.id,[jg.SURVEY_ITERATION]:r.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[jg.SURVEY_SUBMISSION_ID]:i,[jg.SURVEY_COMPLETED]:n},a&&{[jg.SURVEY_LANGUAGE]:a},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Sa(t,r,l),o,{$set:{[wa(r,"responded")]:!0}})),n&&(A_.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),nv(r),s.reloadFeatureFlags())):Qg.error("[survey sent] event not captured, PostHog instance not found.")},U_=(e,t,r)=>{return _({[jg.SURVEY_NAME]:e.name,[jg.SURVEY_ID]:e.id,[jg.SURVEY_ITERATION]:e.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[jg.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)&&{[jg.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[jg.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Sa(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots));var i},z_=(e,t,r,i)=>{if(t){if(!r){var s=iv(e),n=s?s.surveyLanguage:i;t.capture(Vg.DISMISSED,_({},U_(e,s,t),n&&{[jg.SURVEY_LANGUAGE]:n},{$set:{[wa(e,"dismissed")]:!0}})),nv(e),t_(e),A_.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else Qg.error("[survey dismissed] event not captured, PostHog instance not found.")},V_=(e,t)=>{if(t){var r=(e=>Xg("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=iv(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(Vg.ABANDONED,U_(e,i,t),{transport:"sendBeacon"})}}else Qg.error("[survey abandoned] event not captured, PostHog instance not found.")},j_=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,t)=>e.sort-t.sort)).map((e=>e.value)),G_=(e,t)=>e.length===t.length&&e.every(((e,r)=>e===t[r]))?t.reverse():t,Q_=e=>{var t=e.map((e=>e.id));return t.every((e=>!!e))?t:void 0},K_=(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 s of t){var n=r.get(s);if(!n)return null;i.push(n)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?G_(e.questions,j_(e.questions)):e.questions;var r},Z_=e=>Ma(e)||sv(e),Y_=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,Vp(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"+Rp++,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}),J_=()=>xg(Y_),X_=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,s,n,o,a=Dp({},e.props);for(n in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==n?i=t[n]:"ref"==n?s=t[n]:a[n]=void 0===t[n]&&null!=o?o[n]:t[n];return arguments.length>2&&(a.children=arguments.length>3?fp.call(arguments,2):r),qp(e.type,a,i||e.key,s||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function ev(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var s=mi(t);if(!s)return!1;var n=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null==(i=e.conditions)?void 0:i.urlMatchType);return Fa[o](n,[s])}var tv=e=>Xg(Jg,e),rv=(e,t)=>{try{localStorage.setItem(tv(e),JSON.stringify(t))}catch(e){Qg.error("Error setting in-progress survey state in localStorage",e)}},iv=e=>{try{var t=localStorage.getItem(tv(e));if(t)return JSON.parse(t)}catch(e){Qg.error("Error getting in-progress survey state from localStorage",e)}return null},sv=e=>{var t=iv(e);return!te(null==t?void 0:t.surveySubmissionId)},nv=e=>{try{localStorage.removeItem(tv(e))}catch(e){Qg.error("Error clearing in-progress survey state from localStorage",e)}};function ov(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function av(e,t,r){if(void 0===t&&(t=qg.Right),e===$g.ExternalSurvey)return{};switch(t){case qg.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case qg.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case qg.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case qg.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case qg.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case qg.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case qg.Left:return{left:"30px"};case qg.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===$g.Widget&&r===Bg.Tab?"60px":"30px"}}}var lv=0;function uv(e,t,r,i,s,n){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:--lv,__i:-1,__u:0,__source:s,__self:n};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return mp.vnode&&mp.vnode(u),u}var cv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),dv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),hv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),pv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),gv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:uv("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"})}),_v=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:uv("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"})}),vv=uv("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:uv("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"})}),fv=function(e){var t=(void 0===e?{}:e).fill,r=void 0===t?"currentColor":t;return uv("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:[uv("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),uv("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})]})},mv=uv("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[uv("g",{"clip-path":"url(#clip0_2415_6911)",children:[uv("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:uv("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),uv("g",{mask:"url(#mask0_2415_6911)",children:[uv("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"}),uv("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"}),uv("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"}),uv("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"}),uv("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"}),uv("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"})]})]}),uv("defs",{children:uv("clipPath",{id:"clip0_2415_6911",children:uv("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function yv(e){var t=e.urlParams,r=t?Object.entries(t).map((e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)})).join("&"):"";return uv("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",mv]})}function bv(t){var r=t.text,i=t.submitDisabled,s=t.appearance,n=t.onSubmit,o=t.link,a=t.onPreviewSubmit,l=t.skipSubmitButton,u=t.canGoBack,c=t.onBack,d=xg(Y_).isPreviewMode,h=!!u&&!!c,p=!l&&uv("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){o&&(null==e||e.open(o)),d?null==a||a():n()},children:r});return uv("div",{className:"bottom-section",children:[h?uv("div",{className:"form-buttons form-buttons-with-back",children:[uv("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),p]}):p,!s.whiteLabel&&uv(yv,{urlParams:{utm_source:"survey-footer"}})]})}function Sv(e){var t=e.question,r=e.forceDisableHtml;return uv("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[uv(t.type===Wg.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&X_({component:Bp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function wv(e){return uv("button",{className:"form-cancel",onClick:e.onClick,disabled:xg(Y_).isPreviewMode,"aria-label":"Close survey",type:"button",children:fv({fill:"black"})})}uv("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:uv("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 kv=e;function Cv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onClose,a=xg(Y_).isPopup;return wg((()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return oi(kv,"keydown",e),()=>{kv.removeEventListener("keydown",e)}}),[o]),uv("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==n.hideCancelButton&&uv(wv,{onClick:()=>o()}),uv("h3",{className:"thank-you-message-header",children:t}),r&&X_({component:Bp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!s&&"text"!==i}),a&&uv(bv,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>o()})]})}function xv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onStart,a=xg(Y_),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return uv("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==n.hideCancelButton&&uv(wv,{onClick:()=>u()}),t&&uv("h3",{className:"intro-screen-header",children:t}),r&&X_({component:Bp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!s&&"text"!==i}),uv(bv,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var Ev=e=>G(e)&&e.every((e=>J(e)));function Iv(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,s=e.onSubmit,n=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=J_().isPreviewMode,d=kg(null),h=Sg((()=>J(a)?a:"")),p=h[0],g=h[1],_=null==i?void 0:i.disableAutofocus;wg((()=>{_||setTimeout((()=>{var e;c||null==(e=d.current)||e.focus()}),100)}),[c,_]);var v="surveyQuestion"+o,f=Cg((()=>function(e,t,r){var i,s,n=e.trim();if(!r&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case x:if(void 0!==o.value&&o.value>n.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case E:if(void 0!==o.value&&n.length>o.value)return null!==(s=o.errorMessage)&&void 0!==s?s:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional)),[p,t.validation,t.optional]),m=dr(t.validation,x),y=dr(t.validation,E),b=Cg((()=>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||s(p.trim())},w=()=>{f||n(p.trim())};return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:t,forceDisableHtml:r,htmlFor:v}),uv("textarea",{ref:d,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){g(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&&uv("div",{className:"validation-hint",children:b})]}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function Tv(e){var t=e.question,r=e.appearance,i=e.onSubmit,s=e.onPreviewSubmit,n=e.canGoBack,o=e.onBack;return uv(Hp,{children:[uv("div",{className:"question-container",children:uv(Sv,{question:t,forceDisableHtml:e.forceDisableHtml})}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:n,onBack:o})]})}function Mv(e){var t,r=e.question,i=e.forceDisableHtml,s=e.displayQuestionIndex,n=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=Sg((()=>re(l)?l:G(l)&&l.length>0&&re(parseInt(l[0]))?parseInt(l[0]):J(l)&&re(parseInt(l))?parseInt(l):null)),g=p[0],_=p[1],v="emoji"===r.display&&2===r.scale,f=J_().isPreviewMode,m=e=>f?a(e):o(e);return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:r,forceDisableHtml:i}),uv("div",{className:"rating-section",children:[uv("div",{className:"rating-options",children:["emoji"===r.display&&uv("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=Ov[r.scale])?void 0:t.map(((e,t)=>uv("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+s+"-rating-"+t+" "+(t+1===g?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;_(e),r.skipSubmitButton&&m(e)},children:e},t)))}),"number"===r.display&&uv("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(d-h+1)+", minmax(0, 1fr))"},children:Dv(r.scale).map(((e,t)=>uv(Pv,{displayQuestionIndex:s,active:g===e,appearance:n,num:e,setActiveNumber(e){_(e),r.skipSubmitButton&&m(e)}},t)))})]}),!v&&uv("div",{className:"rating-text",children:[uv("div",{children:r.lowerBoundLabel}),uv("div",{children:r.upperBoundLabel})]})]})]}),uv(bv,{text:r.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:ee(g)&&!r.optional,appearance:n,onSubmit:()=>o(g),onPreviewSubmit:()=>a(g),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:c})]})}function Pv(e){var t=e.num,r=e.setActiveNumber;return uv("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 Rv(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,s=e.appearance,n=e.onSubmit,o=e.onPreviewSubmit,a=e.initialValue,l=e.canGoBack,u=e.onBack,c=kg(null),d=Cg((()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=G_(t,j_(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t)),[t]),h=Sg((()=>((e,t)=>J(e)||Ev(e)?e:t===Wg.SingleChoice?null:[])(a,t.type))),p=h[0],g=h[1],v=Sg((()=>((e,t)=>{if(J(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(Ev(e)){var r=e.find((e=>!t.includes(e)));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(a,d))),f=v[0],m=v[1],y=J_().isPreviewMode,b=t.type===Wg.SingleChoice,S=t.type===Wg.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m((e=>_({},e,{isSelected:r,inputValue:r?e.inputValue:""}))),b&&g(""),void(r&&setTimeout((()=>{var e;return null==(e=c.current)?void 0:e.focus()}),75))}if(b)return g(e),m((e=>_({},e,{isSelected:!1,inputValue:""}))),void(w&&(n(e),y&&o(e)));S&&G(p)&&(p.includes(e)?g(p.filter((t=>t!==e))):g([...p,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m((e=>_({},e,{inputValue:t}))),b&&g(t)},x=e=>{e.stopPropagation(),"Enter"!==e.key||E()||(e.preventDefault(),I()),"Escape"===e.key&&(e.preventDefault(),m((e=>_({},e,{isSelected:!1,inputValue:""}))),b&&g(null))},E=()=>!(t.optional||!ee(p)&&(!G(p)||f.isSelected||0!==p.length)&&(!f.isSelected||""!==f.inputValue.trim())),I=()=>{f.isSelected&&S?G(p)&&(y?o([...p,f.inputValue]):n([...p,f.inputValue])):y?o(p):n(p)};return uv(Hp,{children:[uv("div",{className:"question-container",children:[uv(Sv,{question:t,forceDisableHtml:r}),uv("fieldset",{className:"multiple-choice-options limit-height",children:[uv("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),d.map(((e,r)=>{var s=!!t.hasOpenChoice&&r===t.choices.length-1,n="surveyQuestion"+i+"Choice"+r,o=n+"Open",a=s?f.isSelected:b?p===e:G(p)&&p.includes(e);return uv("label",{className:s?"choice-option-open":"",children:[uv("div",{className:"response-choice",children:[uv("input",{type:b?"radio":"checkbox",name:n,checked:a,onChange:()=>k(e,s),id:n,"aria-controls":o}),uv("span",{children:s?e+":":e})]}),s&&uv("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:x,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)}))]})]}),uv(bv,{text:t.buttonText||"Submit",submitDisabled:E(),appearance:s,onSubmit:I,onPreviewSubmit:I,skipSubmitButton:w,canGoBack:l,onBack:u})]})}var Fv=[1,2,3,4,5],Lv=[1,2,3,4,5,6,7],Av=[0,1,2,3,4,5,6,7,8,9,10],Ov={2:[_v,vv],3:[hv,dv,cv],5:[pv,hv,dv,cv,gv]};function Dv(e){switch(e){case 5:default:return Fv;case 7:return Lv;case 10:return Av}}var Nv=Zr("[Surveys]");function Bv(e,t,r){var i,s=e.questions[t],n=t+1;if(null==(i=s.branching)||!i.type)return t===e.questions.length-1?Ug.End:n;if(s.branching.type===Ug.End)return Ug.End;if(s.branching.type===Ug.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Ug.ResponseBased){if(s.type===Wg.SingleChoice){var o,a=s.choices.indexOf(""+r);if(-1===a&&s.hasOpenChoice&&(a=s.choices.length-1),null!=(o=s.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=s.branching.responseValues[a];return Number.isInteger(l)?l:l===Ug.End?Ug.End:n}}else if(s.type===Wg.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,s.scale);if(null!=(u=s.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(c)){var d=s.branching.responseValues[c];return Number.isInteger(d)?d:d===Ug.End?Ug.End:n}}return n}return Nv.warn("Falling back to next question index due to unexpected branching type"),n}var qv=Zr("[SurveyTranslations]");function Hv(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,s=ka(e.overrideLanguage);if(s)return null==t||t.info("Using override display language: "+s),s;var n=function(e){return e&&"object"==typeof e&&"language"in e?ka(e.language):null}(r);if(n)return null==t||t.info("Using person property language: "+n),n;var o=ka(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(un):void 0,locale:Ya()},qv)}(t);if(!r)return qv.info("No user language detected"),{survey:e,language:null};var i=Ia(e,r,qv);return{survey:i.survey,language:i.matchedKey}}var $v=-1,Wv=e,Uv=i,zv="ph:show_survey_widget",Vv="PHWidgetSurveyClickListener";function jv(e,t){try{var r=e.getBoundingClientRect(),i=Wv.innerHeight,s=Wv.innerWidth,n=r.left+r.width/2-t/2;n+t>s-20&&(n=s-t-20),20>n&&(n=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:n+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:N_.zIndex}}catch(e){return Qg.warn("Failed to calculate trigger position:",e),null}}class Gv{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this.handlePageUnload=()=>{var e=this._posthog.get_property(hn);if(e)for(var t of e)sv(t)&&V_(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var s,n,o,a,l,u=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==u&&u,d=t._translateSurveyForRendering(e),h=d.survey,p=d.language;t._currentLanguage=p,t._surveyPopupProps=null,t._displayOptions=r;var g=t._applyDisplayOverrides(h,r);t._clearSurveyTimeout(g.id);var v=null!=r?r:{},f=v.properties,m=v.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(g,m,f,p);if(!y||null!=(s=g.appearance)&&s.displayThankYouMessage){t._addSurveyToFocus(g);var b={};if((null==(n=g.appearance)?void 0:n.position)===qg.NextToTrigger&&null!=(o=g.appearance)&&o.widgetSelector){var S,w=Uv.querySelector(g.appearance.widgetSelector);w&&(b=jv(w,parseInt((null==(S=g.appearance)?void 0:S.maxWidth)||N_.maxWidth))||{})}var k=(null==(a=g.appearance)?void 0:a.surveyPopupDelaySeconds)||0,C=$_(g,t._posthog).shadow;t._renderedTargets.set(C,C.host);var x={posthog:t._posthog,survey:g,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:p};if(t._surveyPopupProps=x,0>=k)return t._surveyIsRendered=!0,og(uv(Jv,_({},x)),C);var E=()=>{if(!t._shouldDisplaySurvey(g))return Qg.info("Survey "+g.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(g);(()=>{t._surveyIsRendered=!0;var i=t._translateSurveyForRendering(e),s=i.survey,n=i.language;t._currentLanguage=n;var o=t._applyDisplayOverrides(s,r),a=_({},x,{survey:o,surveyLanguage:n});t._surveyPopupProps=a,og(uv(Jv,_({},a,{survey:_({},o,{appearance:_({},o.appearance,{surveyPopupDelaySeconds:0})})})),C)})()},I=c?null==(l=t._posthog.surveys)||null==(l=l._surveyEventReceiver)||null==l.getActivationTimestamp?void 0:l.getActivationTimestamp(g.id):void 0,T=re(I)?Math.max(0,Date.now()-I):0,M=Math.max(0,1e3*k-T);if(0>=M)return E();var P=Wv.setTimeout((()=>{t._surveyTimeouts.delete(g.id),E()}),M);t._surveyTimeouts.set(g.id,P)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=$_(r,this._posthog),n=s.shadow,o=s.isNewlyCreated;this._renderedTargets.set(n,n.host),o&&og(uv(ef,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),n)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Vv),this._widgetSelectorListeners.delete(e),Qg.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=Uv.querySelector(ov(e,!0));return!(null==r||null==(t=r.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=Uv.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;Qg.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(Vv)){var s=t=>{var r,i;t.stopPropagation();var s=(null==(r=e.appearance)?void 0:r.position)===qg.NextToTrigger?jv(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||N_.maxWidth)):{};Wv.dispatchEvent(new CustomEvent(zv,{detail:{surveyId:e.id,position:s}}))};oi(r,"click",s),r.setAttribute(Vv,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:s,survey:e}),Qg.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,s=$_(r,this._posthog).shadow;this._renderedTargets.set(s,s.host),og(uv(Jv,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,r)=>{var i,s=this._translateSurveyForRendering(e),n=s.survey,o=s.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(n,o,r)),og(uv(Jv,{posthog:this._posthog,survey:n,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===$g.Popover||e.type===$g.Widget)),i=new Set(r.map((e=>e.id)));for(var s of Array.from(t._surveyTimeouts.keys()))i.has(s)||t.cancelSurvey(s);var n=t._sortSurveysByAppearanceDelay(r),o=new Set;n.forEach((e=>{if(e.type===$g.Widget){var r,i,s,n;if((null==(r=e.appearance)?void 0:r.widgetType)===Bg.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===Bg.Selector&&null!=(s=e.appearance)&&s.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(n=e.appearance)?void 0:n.widgetSelector))}ee(t._surveyInFocus)&&e.type===$g.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)||Qg.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&Qg.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),oi(Wv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags((()=>this._onLanguageChange()))}_onLanguageChange(){if(!ee(this._surveyInFocus)){var e=this._posthog.get_property(hn),t=null==e?void 0:e.find((e=>e.id===this._surveyInFocus));if(t){var r=this._translateSurveyForRendering(t),i=r.survey,s=r.language;if(s!==this._currentLanguage&&(this._currentLanguage=s,this._surveyIsRendered)){var n=this._applyDisplayOverrides(i,this._displayOptions),o=$_(n,this._posthog).shadow;og(uv(Jv,_({},this._surveyPopupProps,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),o)}}}}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,s_))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return null!=t&&t.position||null!=t&&t.selector?_({},e,{appearance:_({},e.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(Qg.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(Wv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach(((e,t)=>this._clearSurveyTimeout(t))),this._widgetSelectorListeners.forEach(((e,t)=>this._detachWidgetSelectorListener(t))),this._renderedTargets.forEach(((e,t)=>{og(null,t),null==e||e.remove()})),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort(((e,t)=>{var r,i,s=sv(e),n=sv(t);if(s&&!n)return-1;if(!s&&n)return 1;var o=e.schedule===zg,a=t.schedule===zg;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 Hv(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(e){var t={},r=!1,i=e.replace(/^\?/,"");if(!i)return{params:t,autoSubmit:r};var s=i.split("&");for(var n of s){var o=n.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}}(Wv.location.search),s=i.params;if(0===Object.keys(s).length)return!1;Qg.info("[Survey Prefill] Detected URL prefill parameters");var n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,r,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var s=t.responses,n=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&W_({responses:o?s:a,survey:e,surveySubmissionId:n,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var s={};for(var n of Object.entries(t)){var o=n[1];s[parseInt(n[0])]=G(o)?o.map(String):[String(o)]}Qg.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,s,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 s=t[i],n=ya(e.id);try{switch(e.type){case Wg.SingleChoice:if(!e.choices||0===e.choices.length)return void Kr.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(s[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void Kr.warn("[Survey Prefill] Invalid choice index for q"+i+": "+s[0]);r[n]=e.choices[o];break;case Wg.MultipleChoice:if(!e.choices||0===e.choices.length)return void Kr.warn("[Survey Prefill] Question "+i+" has no choices");var a=s.map((e=>parseInt(e,10))).filter((t=>!isNaN(t)&&t>=0&&e.choices.length>t));if(0===a.length)return void Kr.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map((t=>e.choices[t])))];a.length>l.length&&Kr.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[n]=l;break;case Wg.Rating:var u=parseInt(s[0],10),c=e.scale||10;if(isNaN(u)||0>u||u>c)return void Kr.warn("[Survey Prefill] Invalid rating for q"+i+": "+s[0]+" (scale: 0-"+c+")");r[n]=u;break;default:Kr.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){Kr.error("[Survey Prefill] Error converting q"+i+":",e)}}})),r}(e,t);if(0===Object.keys(i).length)return Qg.warn("[Survey Prefill] No valid responses after conversion"),null;var s=d_(),n=Object.keys(t).map((e=>parseInt(e,10))),o=function(e,t,r){for(var i=0,s={},n=[],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=ya(l.id);Y(r[u])||(s[u]=r[u])}n.push(i);var c=Bv(e,i,l.id?r[ya(l.id)]:null);if(c===Ug.End)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:n};i=c}return{startQuestionIndex:i,skippedResponses:s,skippedIndices:n}}(e,n,i),a=o.startQuestionIndex,l=o.skippedResponses,u=o.skippedIndices,c=a>=e.questions.length;return rv(e,{surveySubmissionId:s,responses:i,lastQuestionIndex:a,questionOrder:Q_(e.questions),visitedIndices:u,surveyLanguage:r}),Qg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:s,startQuestionIndex:a,isSurveyCompleted:c,skippedResponses:l}}catch(e){return Qg.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-")})),s=!0;return t&&(s=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&s}_isSurveyConditionMatched(t){return!t.conditions||ev(t,this._posthog)&&function(t){var i,s;return function(t,i){var s,n,o;if(!t||0===t.length)return!0;if(!u)return!1;var a=It(u,{userAgentDataPlatform:null==r||null==(s=r.userAgentData)?void 0:s.platform,maxTouchPoints:null==r?void 0:r.maxTouchPoints,screenWidth:null==e||null==(n=e.screen)?void 0:n.width,screenHeight:null==e||null==(o=e.screen)?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return Fa[null!=i?i:"icontains"](t,[a])}(null==(i=t.conditions)?void 0:i.deviceTypes,null==(s=t.conditions)?void 0:s.deviceTypesMatchType)}(t)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==O_||!O_.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return Z_(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(!Kg(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!r_.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 s=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,s))return i.eligible=!1,i.reason=s?"Survey linked feature flag is not enabled for variant "+s:"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 n,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,s=Math.abs(i.getTime()-r.getTime());return Math.ceil(s/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,m_._get("lastSeenSurveyDate"))?(e=>!!m_._get(e_(e))&&!Z_(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!==(n=o.reason)&&void 0!==n?n:"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(!Ta(e)&&!Zg(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=Uv.querySelector(ov(e,!0));null!=t&&t.shadowRoot&&(og(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){Qg.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),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}}function Qv(e,t){if(Uv&&Wv){var r,i=new Gv(e);if(e.config.disable_surveys_automatic_display)return Qg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return Qg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var s=()=>{Y(r)&&(r=setInterval((()=>{i.callSurveysAndEvaluateDisplayLogic(!1)}),1e3))},n=()=>{Y(r)||(clearInterval(r),r=void 0)};s();var o=()=>{Uv.hidden?n():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return oi(Uv,"visibilitychange",o),i.setAutomaticDisplayDispose((()=>{n(),Uv.removeEventListener("visibilitychange",o)})),i}}function Kv(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,s=e.setSurveyVisible,n=e.isPreviewMode,o=void 0!==n&&n,a=e.posthog;wg((()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===$g.Widget,n=ev(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===Bg.Tab&&r;if(!n)return Qg.info("Hiding survey "+t.id+" because URL does not match"),s(!1),i(t);o&&(Qg.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),s(!0))};oi(Wv,"popstate",r),oi(Wv,"hashchange",r);var n=Wv.history.pushState,l=Wv.history.replaceState;return Wv.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];n.apply(this,t),r()},Wv.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()},()=>{Wv.removeEventListener("popstate",r),Wv.removeEventListener("hashchange",r),Wv.history.pushState=n,Wv.history.replaceState=l}}}),[o,t,i,s,a])}var Zv=200;function Yv(e){switch(void 0===e&&(e=Hg.Right),e){case Hg.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case Hg.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case Hg.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Jv(e){var t,r,i,s,n,o,a,l,u,c,d,h,p=e.survey,g=e.forceDisableHtml,v=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,x=void 0===C?()=>{}:C,E=e.onPreviewBack,I=void 0===E?()=>{}:E,T=e.onPopupSurveyDismissed,M=void 0===T?()=>{}:T,P=e.onCloseConfirmationMessage,R=void 0===P?()=>{}:P,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=kg(null),N=Number.isInteger(y),B=null!=(t=p.appearance)&&t.surveyPopupDelaySeconds?1e3*p.appearance.surveyPopupDelaySeconds:0,q=function(e,t,r,i,s,n,o,a,l){var u=Sg(i||0===r||e.type===$g.ExternalSurvey),c=u[0],d=u[1],h=Sg(!1),p=h[0],g=h[1],v=kg(!1),f=()=>{var t=()=>{n&&s(e),d(!1)};if(!v.current){var r=null==o?void 0:o.current;r?(v.current=!0,r.style.transition="opacity "+Zv+"ms ease-out",r.style.opacity="0",setTimeout((()=>{v.current=!1,t()}),Zv+50)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return wg((()=>{if(t){if(!i){var s,n=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if(ev(e,t)){d(!0),Wv.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(Vg.SHOWN,_({[jg.SURVEY_NAME]:e.name,[jg.SURVEY_ID]:e.id,[jg.SURVEY_ITERATION]:e.current_iteration,[jg.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[jg.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){}}};oi(Wv,"PHSurveyClosed",m),oi(Wv,"PHSurveySent",n);var u=r>0?setTimeout(o,r):void 0;return Y(u)&&o(),()=>{Y(u)||clearTimeout(u),Y(s)||clearTimeout(s),Wv.removeEventListener("PHSurveyClosed",m),Wv.removeEventListener("PHSurveySent",n)}}}else Qg.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Kv({survey:e,removeSurveyFromFocus:s,setSurveyVisible:d,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:p,setIsPopupVisible:d,hidePopupWithAnimation:f}}(p,v,B,N,S,k,D,A,O),H=q.isPopupVisible,W=q.hidePopupWithAnimation,U=q.isSurveySent||y===p.questions.length||!0===L,z=Sg(!1),V=z[0],j=z[1],G=Cg((()=>!!iv(p)),[p]),Q=!!(null!=(r=p.appearance)&&r.introScreenHeader||null!=(i=p.appearance)&&i.introScreenDescription),K=N?y===$v:!(null==(s=p.appearance)||!s.displayIntroScreen)&&Q&&!V&&!G,Z=Cg((()=>{var e=iv(p),t=(null==e?void 0:e.surveySubmissionId)||d_();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?z_(p,v,N,O):z_(p,v,N),M()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:x,onPreviewBack:I,posthog:v,properties:F,surveyLanguage:O}}),[N,y,k,v,p,M,x,I,F,O]);return H?uv(Y_.Provider,{value:Z,children:uv("div",{className:"ph-survey",style:_({},av(p.type,null==(n=p.appearance)?void 0:n.position,null==(o=p.appearance)?void 0:o.widgetType),m),ref:D,children:U?uv(Cv,{header:(null==(a=p.appearance)?void 0:a.thankYouMessageHeader)||"Thank you!",description:(null==(l=p.appearance)?void 0:l.thankYouMessageDescription)||"",forceDisableHtml:!!g,contentType:null==(u=p.appearance)?void 0:u.thankYouMessageDescriptionContentType,appearance:p.appearance||N_,onClose(){W(),R()}}):K?uv(xv,{header:(null==(c=p.appearance)?void 0:c.introScreenHeader)||"",description:(null==(d=p.appearance)?void 0:d.introScreenDescription)||"",forceDisableHtml:!!g,contentType:null==(h=p.appearance)?void 0:h.introScreenDescriptionContentType,appearance:p.appearance||N_,onStart:()=>j(!0)}):uv(Xv,{survey:p,forceDisableHtml:!!g,posthog:v})})}):null}function Xv(e){var t,r,i=e.survey,s=e.forceDisableHtml,n=e.posthog,o=Cg((()=>{var e=iv(i);if(!e)return null;var t=re(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(nv(i),null)}),[i]),a=Sg((()=>(null!=o&&o.responses&&Qg.info("Survey is already in progress, filling in initial responses"),(null==o?void 0:o.responses)||{}))),l=a[0],u=a[1],c=xg(Y_),d=c.previewPageIndex,h=c.onPopupSurveyDismissed,p=c.isPopup,g=c.onPreviewSubmit,v=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=Sg((()=>{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=Sg((()=>{var e;return(null!==(e=null==o?void 0:o.visitedIndices)&&void 0!==e?e:[]).filter((e=>e>=0&&i.questions.length>e))})),x=C[0],E=C[1],I=Sg((()=>{var e,t=iv(i);return null!==(e=null==t?void 0:t.questionSnapshots)&&void 0!==e?e:{}})),T=I[0],M=I[1],P=Cg((()=>Q_(K_(i,o))),[i.id,o]),R=Cg((()=>{if(!P||new Set(P).size!==P.length)return K_(i,o);var e=new Map(i.questions.map((e=>[e.id,e]))),t=P.map((t=>e.get(t))).filter((e=>!!e));return t.length===P.length?t:i.questions}),[P,i.questions,i,o]);wg((()=>{!m||Y(d)||0>d||k(d)}),[d,m]);var F=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=d?d:0)>0:x.length>0),L=R.at(w);return L?uv("form",{className:"survey-form",name:"surveyForm",children:[p&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&uv(wv,{onClick(){h()}}),uv("div",{className:"survey-box","data-question-index":w,children:tf({question:L,forceDisableHtml:s,displayQuestionIndex:w,appearance:i.appearance||N_,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,s=e.questionId;if(n)if(s){var o=ya(s),a=_({},l,{[o]:t});u(a);var c=R[r],d=null!=c&&c.id?_({},T,{[c.id]:c.question}):T;M(d);var h=Bv(i,r,t),p=h===Ug.End,g=[...x,r];if(p||(E(g),k(h),rv(i,{surveySubmissionId:f,responses:a,lastQuestionIndex:h,questionOrder:Q_(R),visitedIndices:g,surveyLanguage:b,questionSnapshots:d})),i.enable_partial_responses||p){var v=new Set(g.map((e=>{var t;return null==(t=R[e])?void 0:t.id})).filter((e=>!!e)).map((e=>ya(e)))),m=Object.fromEntries(Object.entries(a).filter((e=>v.has(e[0]))));W_({responses:m,survey:i,surveySubmissionId:f,isSurveyCompleted:p,posthog:n,properties:y,surveyLanguage:b,questionSnapshots:d})}}else Qg.error("onNextButtonClick called without a questionId.");else Qg.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:L.id}),onPreviewSubmit:g,initialValue:L.id?l[ya(L.id)]:void 0,canGoBack:F,onBack(){if(m)v();else if(0!==x.length){var e=x[x.length-1],t=x.slice(0,-1);E(t),k(e),rv(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:e,questionOrder:Q_(R),visitedIndices:t,surveyLanguage:b,questionSnapshots:T})}}})})]}):null}function ef(e){var t,r,i,s,n,o,a,l=e.survey,u=e.forceDisableHtml,c=e.posthog,d=e.readOnly,h=e.surveyLanguage,p=Sg(!0),g=p[0],_=p[1],v=Sg(!1),f=v[0],m=v[1],y=Sg({}),b=y[0],S=y[1],w=kg(void 0),k=()=>{m(!f)};if(wg((()=>{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&&(Qg.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return oi(Wv,zv,t),()=>{Y(w.current)||(clearTimeout(w.current),w.current=void 0),Wv.removeEventListener(zv,t)}}}else Qg.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]),Kv({survey:l,setSurveyVisible:_,posthog:c}),!g)return null;var C=()=>{l.schedule!==zg&&_(!1),Y(w.current)||clearTimeout(w.current),w.current=setTimeout((()=>{w.current=void 0,m(!1)}),200)};return uv(Hp,{children:["tab"===(null==(s=l.appearance)?void 0:s.widgetType)&&uv("button",{className:"ph-survey-widget-tab "+((null==(n=l.appearance)?void 0:n.tabPosition)===Hg.Top?"widget-tab-top":""),onClick:k,disabled:d,style:Yv(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&uv(Jv,{posthog:c,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var tf=e=>{var t=e.question,r=e.onSubmit,i=e.onPreviewSubmit,s={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 Wg.Open:return Bp(Iv,_({},s,{question:t,key:t.id}));case Wg.Link:return Bp(Tv,_({},s,{question:t,key:t.id}));case Wg.Rating:return Bp(Mv,_({},s,{question:t,key:t.id}));case Wg.SingleChoice:case Wg.MultipleChoice:return Bp(Rv,_({},s,{question:t,key:t.id}));default:return Qg.error("Unsupported question type: "+t.type),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Qv,h.extendPostHogWithSurveys=Qv;var rf=e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e},sf=1e4,nf=(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),of=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return nf(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var s=0,n=Math.min(e.length,r.remaining-2);n>s;){var o=Math.ceil((s+n)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?n=o-1:s=o}return nf(t,JSON.stringify(e.slice(0,s)),r)},af=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,lf=(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}},uf=(e,t,r)=>{if(!r.truncated)if(K(e)){if(r.seen.has(e))return void lf(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(uf(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else lf(t,e,r)},cf=function(e,t,r,i,s,n){if(void 0===s&&(s=!1),!af(e))return!s||nf(t,"null",r);if(ee(e)||(e=>{try{return re(e)||se(e)}catch(e){return!1}})(e))return nf(t,JSON.stringify(e),r);if("string"==typeof e)return of(e,t,r);if(!K(e)&&!G(e))return nf(t,JSON.stringify(e),r);if(i.has(e))return of("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(Q(o))return cf(o.call(e),t,r,i,s)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return of(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return nf(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 cf(l,t,r,i,s,n)}if(G(e)){if(!nf(t,"[",r))return!1;for(var c=0;e.length>c;c++){if(c>0&&!nf(t,",",r))return!1;var d=void 0;try{d=e[c]}catch(e){d=void 0}if(!cf(d,t,r,i,!0))return!1}return nf(t,"]",r)}if(!nf(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 g=void 0;try{g=e[p]}catch(e){continue}if(n)try{uf(g,p,n)}catch(e){}if(af(g)){var _=(h?"":",")+JSON.stringify(p)+":";if(_.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!nf(t,_,r))return!1;var y=t.length,b=cf(g,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return nf(t,"}",r)},df=(e,t)=>{for(var r=[],i={remaining:t,truncated:!1},s=K(e[0])?{result:{},keysRemaining:50,sizeRemaining:sf,truncated:!1,seen:new WeakSet([e[0]])}:void 0,n=0;e.length>n&&(0>=n||nf(r," ",i))&&cf(e[n],r,i,new WeakSet,!1,0===n?s:void 0);n++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==s?void 0:s.result)||{}}},hf={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},pf=e=>"canCapture"in e,gf=e=>pf(e)?e.canCapture?e.getExtension(n_):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},s=!1,n=function(e){var n=h.console[e];r.push(zh(h.console,e,(r=>{var o=(r=>function(){for(var n=!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&&!s&&u){var c=gf(u);if(c){s=!0,n=!0;var d=df(a,sf),p=d.body,g=d.attributes,v=_({},i,d.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(pf(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),s=i?t[i]:void 0;Q(s)&&s.call(t,r)}})(u,c,{level:hf[e],body:p,attributes:_({"log.source":"console."+e},v,g)})}}}catch(e){}finally{n&&(s=!1),r.apply(h.console,a)}})(r);return o.__rrweb_original__=rf(n),o})))};for(var o of Object.keys(hf))n(o);return()=>{t=void 0,r.forEach((e=>e()))}},replayConsoleBuffer(e,t){var r=gf(e);if(r)for(var i of t)try{var s=df(i.args,sf);null==r.captureBufferedConsoleLog||r.captureBufferedConsoleLog({level:hf[i.level],body:s.body,attributes:_({"log.source":"console."+i.level,host:h.location.host},s.truncated?{body_truncated:"true"}:{},s.attributes)},i.context,i.occurredAtMs)}catch(e){}}};var _f=Zr("[Error tracking]"),vf="webkit-masked-url:",ff=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",vf],mf=["__firefox__","__gCrWeb"];function yf(){return new vr([new Mr,new qr,new Rr,new Pr,new Nr,new Dr,new Lr,new Br],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 s=[],n=t.split("\n"),o=i;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Ir.test(a)?a.replace(Ir,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){s.push(c);break}}if(s.length>=Tr)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Tr).map((e=>{return _({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||fr});var r}))}(s)}}("web:javascript",kr,Er))}var bf=Zr("[ExceptionAutocapture]"),Sf=yf(),wf=t=>{var r=e;r||bf.info("window not available, cannot wrap onerror");var i=r.onerror;return r.onerror=function(){for(var e,r=arguments.length,s=new Array(r),n=0;r>n;n++)s[n]=arguments[n];var o=Sf.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4];if(null!=n)return n;if(J(t)&&J(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:s})}catch(e){return t}return t})(s),{mechanism:{handled:!1}});return t(o),!!Q(i)&&null!==(e=i(...s))&&void 0!==e&&e},r.onerror.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=r.onerror)||delete e.__POSTHOG_INSTRUMENTED__,r.onerror=i}},kf=function(t,r){void 0===r&&(r=!1);var i=e;i||bf.info("window not available, cannot wrap onUnhandledRejection");var s=i.onunhandledrejection;return i.onunhandledrejection=function(e){var i,n=Sf.buildFromUnknown(e,{mechanism:{handled:!1}});return t(n),Q(s)?null!==(i=s(e))&&void 0!==i&&i:r},i.onunhandledrejection.__POSTHOG_INSTRUMENTED__=!0,()=>{var e;null==(e=i.onunhandledrejection)||delete e.__POSTHOG_INSTRUMENTED__,i.onunhandledrejection=s}},Cf={wrapOnError:wf,wrapUnhandledRejection:kf,wrapConsoleError(e){var t=console;t||bf.info("console not available, cannot wrap console.error");var r=t.error;return t.error=function(){for(var t,i=arguments.length,s=new Array(i),n=0;i>n;n++)s[n]=arguments[n];t=1==s.length?s[0]:s.join(" ");var o=s.find((e=>e instanceof Error)),a=Sf.buildFromUnknown(o||t,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2});e(a),Q(r)&&r(...s)},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=Cf,h.posthogErrorWrappingFunctions=Cf;var xf=(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){bf.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e}),[]):[],s=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){bf.error("Failed to capture exception for a legacy client",e)}};wf((e=>{i.some((t=>e.$exception_list.some((e=>t.test(e.value||"")))))||s(e)})),kf(s,!0)}};h.extendPostHogWithExceptionAutoCapture=xf,h.extendPostHogWithExceptionAutocapture=xf;var Ef="X-POSTHOG-SESSION-ID",If="X-POSTHOG-WINDOW-ID",Tf="X-POSTHOG-DISTINCT-ID",Mf=[Ef,If,Tf],Pf=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Rf=(e,t)=>({}.hasOwnProperty.call(e,t)),Ff=e=>"object"==typeof e&&!ee(e)||Q(e),Lf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Af=t=>{try{var r;return Lf(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}},Of=(e,t,r,i,s)=>{var n;try{n=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(G(e)&&!e.includes(n))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;s.set(Ef,a.sessionId),s.set(If,l),o=!0}var u=(e=>Q(e)?e():e)(t);return u&&u!==Mn&&(s.set(Tf,u),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};var Df={_patchFetch:(t,r,i)=>zh(e,"fetch",(e=>function(s,n){var o=arguments.length>1?[s,n]:[s],a=o;try{var l=Af(s);if(l)if(Lf(s)){var u=new Request(s,n);Of(t,r,i,u.url,u.headers),a=[u]}else{var c=new Headers(Ff(n)?n.headers:void 0);if(Of(t,r,i,l,c)){var d=((e,t)=>{if(Y(e)||ee(e))return{headers:t};if(Ff(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)=>Rf(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>Rf(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach((e=>t.add(e))),Pf.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&&Pf.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var s=Reflect.getOwnPropertyDescriptor(r,t);return s?_({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(n,c);d&&(a=[s,d])}}}catch(e){a=o}return e.apply(this,a)})),_patchXHR:(t,r,i)=>zh(e.XMLHttpRequest.prototype,"open",(e=>function(s,n,o,a,l){void 0===o&&(o=!0);var u=this,c=new Headers,d=Af(n);d&&Of(t,r,i,d,c);var h=e.call(u,s,n,o,a,l);return Mf.forEach((e=>{var t=c.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}})),h}))};h.__PosthogExtensions__.tracingHeadersPatchFns=Df,h.postHogTracingHeadersPatchFns=Df,"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 Nf=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 Bf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},qf=e=>{if("loading"===document.readyState)return"loading";var t=Bf();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"},Hf=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},$f=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,s=e,n=s.id?"#"+s.id:[Hf(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},Wf=new WeakMap;function Uf(e,t){var r=Wf.get(t);return r||(r=new WeakMap,Wf.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var zf=-1,Vf=()=>zf,jf=e=>{addEventListener("pageshow",(t=>{t.persisted&&(zf=t.timeStamp,e(t))}),!0)},Gf=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Qf=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Kf=()=>{var e,t;return null!==(e=null==(t=Bf())?void 0:t.activationStart)&&void 0!==e?e:0},Zf=-1,Yf=new Set,Jf=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Xf=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Yf)t();isFinite(Zf)||(Zf="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Xf,!0))}},em=function(e){if(void 0===e&&(e=!1),e&&(Zf=1/0),0>Zf){var t,r=Kf(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Zf=null!=i?i:Jf(),addEventListener("visibilitychange",Xf,!0),addEventListener("prerenderingchange",Xf,!0),jf((()=>{setTimeout((()=>{Zf=Jf()}))}))}return{get firstHiddenTime(){return Zf},onHidden(e){Yf.add(e)}}},tm=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Bf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Vf()?a&&(document.prerendering||Kf()>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:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},rm=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var s=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 n of i)s.observe(_({type:n,buffered:!0},r));return s}}catch(e){}},im=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},sm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},nm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};class om{constructor(){this.u=void 0}}var am,lm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},um=[1800,3e3],cm=function(e,t){void 0===t&&(t={});var r=im(t);lm((()=>{var i,s=Uf(t,om),n=em(),o=tm("FCP"),a=rm(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Kf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=Gf(e,o,um,t.reportAllChanges),jf((r=>{o=tm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Vf()),i=Gf(e,o,um,t.reportAllChanges),Qf((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&rm(["soft-navigation"],(r=>{r.forEach((r=>{s.u&&r.navigationId&&sm(s.u,r);var n=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=tm("FCP",n,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Gf(e,o,um,t.reportAllChanges))(!0)}))}),t)}))},dm=[.1,.25],hm=e=>e.find((e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)}))||e[0],pm=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),Nf),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var s=hm(e.sources),n=null==s?void 0:s.node;if(n){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(n))&&void 0!==o?o:$f(n);i.set(s,a)}}},function(e,t){void 0===t&&(t={});var r=em();cm(nm((()=>{var i,s=tm("CLS",0),n=Uf(t,Nf),o=(r,o,a,l,u)=>{s=tm("CLS",0,r,o,a,l,u),n.o=0,i=Gf(e,s,dm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.o>s.value&&(s.value=n.o,s.entries=n.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?n.l(t):l(t);a()},c=["layout-shift"];im(t)&&c.push("soft-navigation");var d=rm(c,u);d&&(i=Gf(e,s,dm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),jf((()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Vf()),Qf(i)})),setTimeout(i))})))}((t=>{e((e=>{var t={};if(e.entries.length){var r,s=e.entries.reduce(((e,t)=>e.value>t.value?e:t));if(null!=s&&null!=(r=s.sources)&&r.length){var n=hm(s.sources);n&&(t={largestShiftTarget:i.get(n),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:n,largestShiftEntry:s,loadState:qf(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))}),t)},gm=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),om);im(t)&&(r.u=new Map),cm((t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:qf(Vf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=Bf(),s=e.entries.at(-1);if(i){var n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:qf(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}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)},_m=0,vm=1/0,fm=0,mm=e=>{for(var t of e)t.interactionId&&(vm=Math.min(vm,t.interactionId),fm=Math.max(fm,t.interactionId),_m=fm?(fm-vm)/7+1:0)},ym=()=>{var e;return am?_m:null!==(e=performance.interactionCount)&&void 0!==e?e:0};let bm=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return ym()-this.h}D(){this.h=ym(),this.v.length=0,this.p.clear()}S(e){var t=this.T(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{k:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.p.get(e.interactionId);if(i||10>this.v.length||e.duration>r.k){var s;if(i?e.duration>i.k?(i.entries=[e],i.k=e.duration):e.duration===i.k&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.p.set((i={id:e.interactionId,entries:[e],k:e.duration}).id,i),this.v.push(i)),this.v.sort(((e,t)=>t.k-e.k)),this.v.length>10){var n=this.v.splice(10);for(var o of n)this.p.delete(o.id)}null==(s=this.M)||s.call(this,i)}}}};var Sm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=nm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()}),{timeout:t})}},wm=[200,500],km=function(e,t){void 0===t&&(t={});var r=Uf(t=Object.assign({},t),bm),i=[],s=[],n=0,o=new WeakMap,a=new WeakMap,l=!1,u=()=>{l||(Sm(c),l=!0)},c=()=>{var e=new Set(r.v.map((e=>o.get(e.entries[0])))),t=s.length-10;s=s.filter(((r,i)=>i>=t||e.has(r)));var a=new Set;for(var u of s){var c=d(u.startTime,u.processingEnd);for(var h of c)a.add(h)}i=i.filter((e=>e.startTime>n||a.has(e))),l=!1};r.m=e=>{var r,i=e.startTime+e.duration;n=Math.max(n,e.processingEnd);for(var a=s.length-1;a>=0;a--){var l=s[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||s.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),e.interactionId&&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 s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==s?s:$f(i);a.set(e,n)}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 s of i)if(s.startTime+s.duration>=e){if(s.startTime>t)break;r.push(s)}return r};rm(["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=em();lm((()=>{var i;"interactionCount"in performance||am||(am=rm(["event"],mm,{durationThreshold:0}));var s,n=tm("INP"),o=Uf(t,bm),a=(r,i,a,l,u)=>{o.D(),n=tm("INP",-1,r,i,a,l,u),s=Gf(e,n,wm,t.reportAllChanges)},l=()=>{var e=o.S(n.navigationType);e&&e.k!==n.value&&(n.value=e.k,n.entries=e.entries,s())},u=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),Sm((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.l(r):u(r);l(),t&&s(!0)}))},d=["event","first-input"];im(t)&&d.push("soft-navigation");var h=rm(d,c,_({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Gf(e,n,wm,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),jf((()=>{a("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Vf())})))}))}}((t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:qf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],s=o.get(i),n=Math.max(s.processingStart,i.startTime),l=Math.max(i.startTime+i.duration,n),u=Math.min(s.processingEnd,l),c=s.entries.sort(((e,t)=>e.processingStart-t.processingStart)),h=d(i.startTime,u),p=r.p.get(i.interactionId),g={interactionTarget:a.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:l,processedEventEntries:c,longAnimationFrameEntries:h,inputDelay:n-i.startTime,processingDuration:u-n,presentationDelay:l-u,loadState:qf(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 s,n,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 g=p.startTime+p.duration;if(g>=r){var _=g-Math.max(r,p.startTime),v=p.duration?_/p.duration*p.forcedStyleAndLayoutDuration:0;l+=_-v,u+=v,_>d&&(n=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",s=p,d=_)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(c=i-m),s&&n&&(e.longestScript={entry:s,subpart:n,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=c,e.totalUnattributedDuration=i-r-l-u-c}})(g),Object.assign(e,{attribution:g})})(t))}),t)};let Cm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null==(t=this.m)||t.call(this,e)}};var $=[2500,4e3],xm=50,Em=[];rm(["resource"],(e=>{for(var t of e)Em.push(t),Em.length>xm&&Em.shift()}));var Im=function(e,t){void 0===t&&(t={}),null!=(t=Object.assign({},t)).resourceBufferSize&&(xm=t.resourceBufferSize);var r=Uf(t,Cm),i=new WeakMap;im(t)&&(r.u=new Map),r.m=e=>{var r=e.element;if(r){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==s?s:$f(r);i.set(e,n)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=im(t);lm((()=>{var s,n=em(),o=tm("LCP"),a=Uf(t,Cm),l=(i,a,l,u,c)=>{o=tm("LCP",-1,i,a,l,u,c),s=Gf(e,o,$,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=em(!0))},u=e=>{a.u&&e.navigationId&&sm(a.u,e),r||s(!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-Kf(),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])}n.firstHiddenTime>d&&(o.value=l,o.entries=c,s())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=rm(d,c);if(h){s=Gf(e,o,$,t.reportAllChanges);var p=["keydown","click","visibilitychange"],g=e=>{if(e.isTrusted&&!r){var t=o.id;Sm((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,g,{capture:!0});t===o.id&&(r=!0,s(!0))}}))}};for(var _ of p)addEventListener(_,g,{capture:!0});jf((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Vf()),s=Gf(e,o,$,t.reportAllChanges),Qf((()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)}))}))}}))}((t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,n,o,a,l,u,c=e.entries.at(-1),d=c.url&&(Em.findLast((e=>e.name===c.url))||performance.getEntriesByType("resource").findLast((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!==(s=null==(n=u=Bf())?void 0:n.activationStart)&&void 0!==s?s: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 g=Math.max(0,p-h),v=Math.max(g,d?(d.requestStart||d.startTime)-h:0),f=Math.min(e.value,Math.max(v,d?d.responseEnd-h:0));t=_({},t,{timeToFirstByte:g,resourceLoadDelay:v-g,resourceLoadDuration:f-v,elementRenderDelay:e.value-f,navigationEntry:u})}}return Object.assign(e,{attribution:t})})(t))}),t)},Tm=-1,Mm=()=>Tm,Pm=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Tm=t.timeStamp,e(t))}),!0)},Rm=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Fm=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Lm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Am=()=>{var e,t;return null!==(e=null==(t=Lm())?void 0:t.activationStart)&&void 0!==e?e:0},Om=-1,Dm=new Set,Nm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Bm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Dm)t();isFinite(Om)||(Om="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Bm,!0))}},qm=function(e){if(void 0===e&&(e=!1),e&&(Om=1/0),0>Om){var t,r=Am(),i=document.prerendering||null==(t=globalThis.performance.getEntriesByType("visibility-state").find((e=>"hidden"===e.name&&e.startTime>=r)))?void 0:t.startTime;Om=null!=i?i:Nm(),addEventListener("visibilitychange",Bm,!0),addEventListener("prerenderingchange",Bm,!0),Pm((()=>{setTimeout((()=>{Om=Nm()}))}))}return{get firstHiddenTime(){return Om},onHidden(e){Dm.add(e)}}},Hm=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Lm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Mm()?a&&(document.prerendering||Am()>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:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},$m=new WeakMap;function Wm(e,t){var r=$m.get(t);return r||(r=new WeakMap,$m.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}class Um{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 zm=function(e,t,r){void 0===r&&(r={});try{var i=e.filter((e=>PerformanceObserver.supportedEntryTypes.includes(e)));if(i.length>0){var s=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 n of i)s.observe(_({type:n,buffered:!0},r));return s}}catch(e){}},Vm=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},jm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Gm=e=>{var t=!1;return()=>{t||(e(),t=!0)}};class Qm{constructor(){this.l=void 0}}var Km,Zm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Ym=[1800,3e3],Jm=function(e,t){void 0===t&&(t={});var r=Vm(t);Zm((()=>{var i,s=Wm(t,Qm),n=qm(),o=Hm("FCP"),a=zm(["paint"],(e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Am(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))}));a&&(i=Rm(e,o,Ym,t.reportAllChanges),Pm((r=>{o=Hm("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Mm()),i=Rm(e,o,Ym,t.reportAllChanges),Fm((()=>{o.value=performance.now()-r.timeStamp,i(!0)}))}))),r&&zm(["soft-navigation"],(r=>{r.forEach((r=>{s.l&&r.navigationId&&jm(s.l,r);var n=Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0);o=Hm("FCP",n,"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Rm(e,o,Ym,t.reportAllChanges))(!0)}))}),t)}))},Xm=[.1,.25],ey=function(e,t){void 0===t&&(t={});var r=qm();Jm(Gm((()=>{var i,s=Hm("CLS",0),n=Wm(t,Um),o=(r,o,a,l,u)=>{s=Hm("CLS",0,r,o,a,l,u),n.i=0,i=Rm(e,s,Xm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.i>s.value&&(s.value=n.i,s.entries=n.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?n.h(t):l(t);a()},c=["layout-shift"];Vm(t)&&c.push("soft-navigation");var d=zm(c,u);d&&(i=Rm(e,s,Xm,t.reportAllChanges),r.onHidden((()=>{u(d.takeRecords()),i(!0)})),Pm((()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Mm()),Fm(i)})),setTimeout(i))})))},ty=0,ry=1/0,iy=0,sy=e=>{for(var t of e)t.interactionId&&(ry=Math.min(ry,t.interactionId),iy=Math.max(iy,t.interactionId),ty=iy?(iy-ry)/7+1:0)},ny=()=>{var e;return Km?ty:null!==(e=performance.interactionCount)&&void 0!==e?e:0};class oy{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return ny()-this.u}M(){this.u=ny(),this.v.length=0,this.m.clear()}L(e){var t=this._(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{P:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.m.get(e.interactionId);if(i||10>this.v.length||e.duration>r.P){var s;if(i?e.duration>i.P?(i.entries=[e],i.P=e.duration):e.duration===i.P&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.m.set((i={id:e.interactionId,entries:[e],P:e.duration}).id,i),this.v.push(i)),this.v.sort(((e,t)=>t.P-e.P)),this.v.length>10){var n=this.v.splice(10);for(var o of n)this.m.delete(o.id)}null==(s=this.T)||s.call(this,i)}}}}var ay=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Gm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r((()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()}),{timeout:t})}},ly=[200,500],uy=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=qm();Zm((()=>{var i;"interactionCount"in performance||Km||(Km=zm(["event"],sy,{durationThreshold:0}));var s,n=Hm("INP"),o=Wm(t,oy),a=(r,i,a,l,u)=>{o.M(),n=Hm("INP",-1,r,i,a,l,u),s=Rm(e,n,ly,t.reportAllChanges)},l=()=>{var e=o.L(n.navigationType);e&&e.P!==n.value&&(n.value=e.P,n.entries=e.entries,s())},u=e=>{l(),s(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),ay((()=>{for(var r of e)"soft-navigation"!==r.entryType?o.h(r):u(r);l(),t&&s(!0)}))},d=["event","first-input"];Vm(t)&&d.push("soft-navigation");var h=zm(d,c,_({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Rm(e,n,ly,t.reportAllChanges),h&&(r.onHidden((()=>{c(h.takeRecords(),!0)})),Pm((()=>{a("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Mm())})))}))}};class cy{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null==(t=this.p)||t.call(this,e)}}var dy=[2500,4e3],hy=function(e,t){void 0===t&&(t={});var r=!1,i=Vm(t);Zm((()=>{var s,n=qm(),o=Hm("LCP"),a=Wm(t,cy),l=(i,a,l,u,c)=>{o=Hm("LCP",-1,i,a,l,u,c),s=Rm(e,o,dy,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=qm(!0))},u=e=>{a.l&&e.navigationId&&jm(a.l,e),r||s(!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-Am(),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])}n.firstHiddenTime>d&&(o.value=l,o.entries=c,s())}else u(r)},d=["largest-contentful-paint"];i&&d.push("interaction-contentful-paint","soft-navigation");var h=zm(d,c);if(h){s=Rm(e,o,dy,t.reportAllChanges);var p=["keydown","click","visibilitychange"],g=e=>{if(e.isTrusted&&!r){var t=o.id;ay((()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,g,{capture:!0});t===o.id&&(r=!0,s(!0))}}))}};for(var _ of p)addEventListener(_,g,{capture:!0});Pm((i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Mm()),s=Rm(e,o,dy,t.reportAllChanges),Fm((()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)}))}))}}))},py={onLCP:Im,onCLS:pm,onFCP:gm,onINP:km,withoutAttribution:{onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=py,h.__PosthogExtensions__.postHogWebVitalsCallbacks=py,h.postHogWebVitalsCallbacks=py;var gy={onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=gy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=gy,h.postHogWebVitalsCallbacks=gy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>gy;var _y={onLCP:Im,onCLS:pm,onFCP:gm,onINP:km,withoutAttribution:{onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=_y,h.__PosthogExtensions__.postHogWebVitalsCallbacks=_y,h.postHogWebVitalsCallbacks=_y;var vy={onLCP:hy,onCLS:ey,onFCP:Jm,onINP:uy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=vy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=vy,h.postHogWebVitalsCallbacks=vy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>vy;class fy{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 my="$copy_autocapture",yy=Zr("[AutoCapture]");function by(e,t){return t.length>e?t.slice(0,e)+"...":t}function Sy(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ci(t));return t}function wy(t,r){var i,s,n=r.e,o=r.maskAllElementAttributes,a=r.maskAllText,l=r.elementAttributeIgnoreList,u=r.elementsChainAsString,c=r.disableCaptureUrlHashes;if(!Ci(t))return{props:{}};for(var d=[t],h=new Set([t]),p=t;p.parentNode&&!xi(p,"body")&&Ti>d.length;)if(Ii(p.parentNode)){var g=p.parentNode.host;if(h.has(g))break;h.add(g),d.push(g),p=g}else{if(!Ci(p.parentNode))break;if(h.has(p.parentNode))break;h.add(p.parentNode),d.push(p.parentNode),p=p.parentNode}var v,f,m=[],y={},b=!1,S=!1;if(Jr(d,(e=>{var t=Qi(e);if(xi(e,"a")){var r=e.getAttribute("href");b=!!(t&&r&&is(r))&&(c?Rt(r):r)}q(Ri(e),"ph-no-capture")&&(S=!0),m.push(function(e,t,r,i,s){void 0===s&&(s=!1);var n=e.tagName.toLowerCase(),o={tag_name:n};Oi.indexOf(n)>-1&&!r&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?by(1024,ss(e)):by(1024,Li(e)));var a=Ri(e);a.length>0&&(o.classes=a.filter((function(e){return""!==e}))),Jr(e.attributes,(function(r){var n;if((!Ki(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&is(r.value)&&(!J(n=r.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=r.value;"class"===r.name&&(a=Mi(a).join(" ")),o["attr__"+r.name]=by(1024,"href"===r.name&&s?Rt(a):a)}}));for(var l=1,u=1,c=e;c=Sy(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 Jr(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&&is(i)&&(t[r]=i)}})),t}(e);Jr(i,((e,t)=>{({}).hasOwnProperty.call(y,t)||(y[t]=e)}))})),S)return{props:{},explicitNoCapture:S};if(a||(m[0].$el_text=xi(t,"a")||xi(t,"button")?ss(t):Li(t)),b){var w,k;m[0].attr__href=b;var C=null==(w=ci(b))?void 0:w.host,x=null==e||null==(k=e.location)?void 0:k.host;C&&x&&C!==x&&(v=b)}return{props:Xr({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(f=m,G(f)?function(e){var t=e.map((e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var n=_({},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 ei(n).sort(((e,t)=>function(e,t){return t>e?-1:e>t?1:0}(e[0],t[0]))).forEach((e=>{var t=e[1];return o[os(e[0].toString())]=os(t.toString())})),(i+=":")+ei(o).map((e=>e[0]+'="'+e[1]+'"')).join("")}));return t.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:as(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return ei(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==(s=m[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},y)}}class ky{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 fy(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){yy.error("Failed to capture event",e)}};if(oi(i,"submit",t,{capture:!0}),oi(i,"change",t,{capture:!0}),oi(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,my)}catch(e){yy.error("Failed to capture clipboard event",e)}};oi(i,"copy",r,{capture:!0}),oi(i,"cut",r,{capture:!0}),oi(i,"paste",r,{capture:!0})}}}else yy.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;se(i)&&(null==(r=this._client)||r.kv.set(Is,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 s=null==i?void 0:i.querySelectorAll(t);null==s||s.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(Is),i=this._isDisabledServerSide,s=this._refreshConfig(),n=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(ee(i)&&!se(r)&&!n)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!s.enabled&&!o}_captureEvent(t,r){if(void 0===r&&(r="$autocapture"),this.isEnabled){var i=Ai(t);Ei(i)&&(i=i.parentNode||null);var s,n=this._compileUrlPatterns();"$autocapture"===r&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Vi(i,n.rageclick)&&this._captureEvent(t,"$rageclick");var o=r===my,a=o?_({},n,{dom_event_allowlist:void 0}):n;if(i&&function(t,r,i,s,n,o){var a;if(!e||ji(t))return!1;if(null!=i&&i.url_allowlist&&!Pi(i.url_allowlist,o))return!1;if(null!=i&&i.url_ignorelist&&Pi(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=Gi(t,s),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,s=function(e){if(r.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var n of e)if(i=s(n))return i.v;return!1}(d,i))return!1;if(!Di(d,null==i?void 0:i.css_selector_allowlist))return!1;if(Di(d,null!==(a=null==i?void 0:i.css_selector_ignorelist)&&void 0!==a?a:Bi))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(n||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(r.type)>=0;default:return c?(n||["click"]).indexOf(r.type)>=0:(n||["click"]).indexOf(r.type)>=0&&(Oi.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,u=wy(i,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),c=u.props;if(u.explicitNoCapture)return!1;var d=this.getElementSelectors(i);if(d&&d.length>0&&(c.$element_selectors=d),r===my){var h=t.type||"clipboard";if("paste"!==h){var p,g,v=null==e||null==(p=e.getSelection())?void 0:p.toString(),f=Fi(v);if(!f)return!1;c.$selected_content=f,c.$clipboard_text_length=null!==(g=null==v?void 0:v.length)&&void 0!==g?g:0}c.$copy_type=h}return null==(l=this._client)||l.capture(r,c).catch((e=>yy.error("Failed to capture event",e))),!0}}}isBrowserSupported(){return Q(null==i?void 0:i.querySelectorAll)}}var Cy={};function xy(t,r){var i=Cy[t];if(i)return i;var s=r[t];if((e=>Q(e)&&-1!==e.toString().indexOf("[native code]"))(s)&&(null==e||!e.Zone))return Cy[t]=s.bind(r);var n=r.document;if(n&&Q(n.createElement)){var o,a=!1;try{(o=n.createElement("iframe")).hidden=!0,n.head.appendChild(o);var l,u,c=o.contentWindow;c&&c[t]&&(s=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){Kr.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 s&&Q(s)?Cy[t]=s.bind(r):s}function Ey(e,t){var r=Ai(e);return r?_({node:r,originalEvent:e,timestamp:Date.now()},t):null}function Iy(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Ty(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var My="canvas,video,audio,embed,object",Py=1e3;function Ry(e,t){return re(e)&&e>=t}function Fy(e){return e>=0&&Py>e?e:void 0}function Ly(e,t){return t?Fy(e-t):void 0}class Ay{_asRequiredConfig(e){var t,r,i,s,n,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!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(n=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==n?n: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=Ey(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 s=e,n=null==(t=s.changedTouches)?void 0:t[0];if(n){var o=n.clientX-r.x,a=n.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(My))))return;var d=Ey(s,{type:"swipe",swipeDirection:Iy(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 xy("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(){oi(h,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=Ly(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Ly(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Y(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout((()=>{this._checkClicks()}),1e3))}_startScrollObserver(){oi(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){oi(h,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){oi(i,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){oi(h,"blur",this._onFocusChange),oi(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach((r=>{var i=Fy(t-r.timestamp);re(i)&&(Y(r[e])||r[e]>i)&&(r[e]=i)}))}_startSwipeObserver(){oi(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),oi(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),oi(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(My))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){if(ki(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&&!xi(t.node,"html")&&Ci(t.node)&&function(t,r){var i;if(!e||ji(t))return!1;var s=se(r)?Wi:null!==(i=null==r?void 0:r.css_selector_ignorelist)&&void 0!==i?i:Wi;return!Di(Gi(t,!1).targetElementList,s)}(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||ji(i))&&Gi(i,!1).targetElementList.some((e=>xi(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=Ry(t.scrollDelayMs,this._config.scroll_threshold_ms),s=Ry(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=Ry(t.mutationDelayMs,this._config.mutation_threshold_ms),o=Ry(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||n||o||s){var h=Ty(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"]:n,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:s,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=Ty(e);this.instance.capture(r,_({},t,wy(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 Ay(e,t);class Oy{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===zn||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Un}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 ge(e)?1:q(_e,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?m_:v_,r=t._is_supported()?t:P_;if(!this._persistentStore||this._persistentStore!==r){this._persistentStore=r;var i="localStorage"===e?v_:m_;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(ge(i._get(this._storageKey))),i._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,null==r?void 0:r.globalPrivacyControl].some((e=>ge(e)))}}var Dy=Zr("[Dead Clicks]"),Ny=()=>!0,By=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(Ls)),i=e.instance.config.capture_dead_clicks;return se(i)?i:!!K(i)||r};class qy{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({[Ls]: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?Dy.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)?_({},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),Dy.info("starting...")}}else Dy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Dy.info("stopping..."))}}var Hy=Zr("[SegmentIntegration]");var $y="posthog-js";function Wy(e,t){var r=void 0===t?{}:t,i=r.organization,s=r.projectId,n=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,g=(null==(r=t.exception)?void 0:r.values)||[],v=g.map((e=>_({},e,{stacktrace:e.stacktrace?_({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>_({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(o=g[0])?void 0:o.value)||t.message,$exception_type:null==(l=g[0])?void 0:l.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=g[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Uy{constructor(e,t,r,i,s,n){this.name=$y,this.setupOnce=function(o){o(Wy(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class zy{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Kr.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,s=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(),s}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},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,c=s.maxContentY;if(!(Y(n)||Y(o)||Y(a)||Y(l)||Y(u)||Y(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ve(o/n,0,1,Kr):1,h=n>1?ve(a/n,0,1,Kr):1,p=l>1?ve(u/l,0,1,Kr):1,g=l>1?ve(c/l,0,1,Kr):1;i=Xr(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:g})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Vy=["flags","surveys"],jy={[Ss]:{exposure:"hidden"},[xs]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Es]:{exposure:"hidden"},[Is]:{exposure:"event"},[Ts]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[Ms]:{exposure:"event"},[Ps]:{exposure:"hidden"},[Rs]:{exposure:"event"},[Fs]:{exposure:"event"},[Ls]:{exposure:"event"},[As]:{exposure:"hidden"},[Ds]:{exposure:"event"},[Ns]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Us]:{exposure:"hidden"},[zs]:{exposure:"event"},[Bs]:{exposure:"event",shouldSkipFromEventProperties:e=>ee(e)},[Vs]:{exposure:"event"},[js]:{exposure:"event"},[Gs]:{exposure:"event"},[Ys]:{exposure:"event"},[Js]:{exposure:"hidden"},[Xs]:{exposure:"hidden",storageGroup:"flags"},[en]:{exposure:"hidden",storageGroup:"flags"},[tn]:{exposure:"hidden"},[rn]:{exposure:"hidden",storageGroup:"flags"},[sn]:{exposure:"hidden",storageGroup:"flags"},[nn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[on]:{exposure:"hidden",storageGroup:"flags"},[an]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[un]:{exposure:"hidden"},[cn]:{exposure:"hidden"},[hn]:{exposure:"hidden",storageGroup:"surveys"},[pn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gn]:{exposure:"event"},[_n]:{exposure:"hidden"},[vn]:{exposure:"hidden"},[fn]:{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"},[mn]:{exposure:"hidden"},[yn]:{exposure:"hidden"},[dn]:{exposure:"event"},[bn]:{exposure:"hidden"},[Sn]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wn]:{exposure:"hidden"},[kn]:{exposure:"hidden"},[Cn]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[En]:{exposure:"hidden"},[In]:{exposure:"hidden"},[Tn]:{exposure:"hidden"},[qs]:{exposure:"event"},[Hs]:{exposure:"event"},[$s]:{exposure:"event"},[Ws]:{exposure:"event"},[Rn]:{exposure:"event"},[Fn]:{exposure:"event"},[Ln]:{exposure:"event"},[An]:{exposure:"event"},[On]:{exposure:"event"},[Dn]:{exposure:"event"},[Nn]:{exposure:"event"},[Bn]:{exposure:"event"},[qn]:{exposure:"event"},[Hn]:{exposure:"event"},[$n]:{exposure:"event"}},Gy=[[Qs,{exposure:"hidden"}],[Ks,{exposure:"hidden"}],[Zs,{exposure:"hidden"}]],Qy=e=>{var t=jy[e];if(t)return t;for(var r of Gy){var i=r[1];if(0===e.indexOf(r[0]))return i}},Ky={flags:Sn,surveys:pn},Zy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Yy=e=>e+"_cookie_identity_change_pending",Jy="main",Xy=[Xs,en,rn,sn,nn,Sn,on,un],eb=e=>-1!==Xy.indexOf(e),tb=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return e===t}},rb=e=>{if(!e)return{};var t=JSON.parse(e);return K(t)?t:{}},ib=(e,t)=>{Jr(e,((r,i)=>{var s=Qy(i);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]}))};class sb{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._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._crossTabFeatureFlagHandlers=new Set,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(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Kr.info("Persistence loaded",t.persistence,_({},this.props)),this.update_config(t,t,r),this.save(),e){var s=()=>this.flush();oi(e,"beforeunload",s,{capture:!1}),oi(e,"pagehide",s,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){var r=Vy.find((e=>t.key===this._groupEntryName(e)));r&&this._syncCrossTabFeatureFlagProperties(t.key,r)}}else this._syncCrossTabFeatureFlagProperties(t.key,Jy)},oi(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach((e=>{var t=e[0],r=e[1],i=this._pendingCrossTabFeatureFlagChanges.get(t);if(eb(t)&&!0!==i)if(!0!==r){var s=new Set(i||[]);r.forEach((e=>s.add(e))),s.size&&this._setCrossTabFeatureFlagChangesPending(t,s)}else this._setCrossTabFeatureFlagChangesPending(t,!0)}))}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,r){if(void 0===r&&(r=!0),this._disabled)return!1;var i,s;try{if(s=m_._get(e),ee(s)){var n=this._slotWriteState(t);return n.storageValue=null,t!==Jy&&(n.persisted=!1),!1}i=rb(s)}catch(e){return!1}var o=t===Jy?i:m_._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(i,t,r);return t===Jy&&this._splitStorage&&!tb(this._partitionProps().main,i)||this._rememberCrossTabStorageFingerprint(i,t,!0,s),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[ws],r=e[ws];return!Y(t)&&!Y(r)&&t!==r}_rememberCrossTabStorageFingerprint(e,t,r,i){var s=this._slotWriteState(t);s.storageValue=i,t!==Jy&&(s.persisted=r);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,r){var i=!1;return Xy.forEach((r=>{var s,n=null==(s=Qy(r))?void 0:s.storageGroup;if(!(t===Jy&&this._splitStorage&&n||t!==Jy&&n!==t)){var o=r in e,a=this._mergePendingCrossTabFeatureFlagChanges(r,o?e[r]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(r)?r in this.props:o;l===r in this.props&&tb(a,this.props[r])||(l?this._setProp(r,a,!1):this._deleteProp(r,!1),i=!0)}})),i&&r&&this._crossTabFeatureFlagHandlers.forEach((e=>e())),i}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=m_._get(this._name),r=this._slotWriteState(Jy),i=!1,s=!1;if(t!==r.storageValue)if(ee(t))r.storageValue=null;else{if(e=rb(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(e,Jy,!1),!this._splitStorage||tb(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,Jy,!0,t):r.storageValue=t,i=!0}return this._splitStorage&&Vy.forEach((t=>{var r=m_._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=i&&Xy.some((e=>{var r;return(null==(r=Qy(e))?void 0:r.storageGroup)===t&&e in o}));if(r!==n.storageValue||a){if(ee(r))return n.storageValue=null,n.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||s));var l=rb(r);s=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||s,this._rememberCrossTabStorageFingerprint(l,t,!0,r)}})),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var r=Qy(e);null!=r&&r.volatile||(this._slotWriteState((this._splitStorage?null==r?void 0:r.storageGroup:void 0)||Jy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Xy.forEach((e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0)))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=m_._get(this._name),t=rb(e);this._slotWriteState(Jy).storageValue=e,Xy.forEach((e=>{var r,i=this._splitStorage?null==(r=Qy(e))?void 0:r.storageGroup:void 0,s=i?m_._get(this._groupEntryName(i)):null;if(i){var n=this._slotWriteState(i);n.storageValue=s,n.persisted=!ee(s)}var o=i&&!ee(s)?rb(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)}))}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var r=this._pendingCrossTabFeatureFlagChanges.get(e);if(!r)return t;if(!0===r)return this.props[e];if(e===en){var i=new Set(G(t)?t:[]),s=new Set(G(this.props[e])?this.props[e]:[]);return r.forEach((e=>s.has(e)?i.add(e):i.delete(e))),Array.from(i)}var n=K(t)?_({},t):{},o=K(this.props[e])?this.props[e]:{};return r.forEach((e=>{e in o?n[e]=o[e]:delete n[e]})),n}_markPendingCrossTabFeatureFlagChanges(e,t,r){if(eb(e)){var i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==i){var s=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Qy(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;s=rb(m_._get(a))[e]}catch(e){}var l=new Set(i||[]);if(e===en){if(!Y(t)&&!G(t)||!Y(s)&&!G(s)||!G(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var u=new Set(t||[]),c=new Set(s||[]),d=new Set(r);new Set([...u,...d]).forEach((e=>{u.has(e)!==d.has(e)&&l.add(e)})),l.forEach((e=>{c.has(e)===d.has(e)&&l.delete(e)}))}else{if(!K(r))return void(tb(s,r)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!Y(t)&&!K(t)||Y(t)&&Z(r)&&Y(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var h=K(t)?t:{},p=K(s)?s:{};new Set([...Object.keys(h),...Object.keys(r)]).forEach((e=>{e in h==e in r&&tb(h[e],r[e])||l.add(e)})),l.forEach((e=>{e in p==e in r&&tb(p[e],r[e])&&l.delete(e)}))}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_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=C_(e,this._config.cookie_persisted_properties||[]),r=E_(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),s=v_._get(this._name)||void 0;s&&T_(this._name,s)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=s)}catch(e){}else try{var n=v_._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?T_(this._name,n):void 0,this._lastSeenMainCookieValue=n}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=v_._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,s=T_(this._name,r);try{i=k_(JSON.parse(r))}catch(e){return!1}if((v_._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r;var n=I_(this._name,r),o=[...b_,...n.properties],a={};if(Object.keys(i).forEach((e=>{var t=i[e];(Y(t)||ee(t)||""===t||e===wn&&t!==Vn&&t!==jn)&&(a[e]=!0,delete i[e])})),Z(i))return!1;var l=ws in i||i[wn]===Vn||i[wn]===jn,u=this.props,c=u[ws],d=u[wn],h=Xr({},u);[...b_,...e.cookie_persisted_properties||[]].forEach((e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||e!==ws&&e!==wn)){var t=h[e];!n.isValid&&-1!==b_.indexOf(e)&&(!1===t||0===t)||delete h[e]}})),this.props=Xr(h,i),Xy.forEach((e=>{var t=e in this.props;e in u===t&&tb(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))})),!l||wn in i||wn in this.props||this._setProp(wn,Vn);var p=this.props[ws],g=this.props[wn];return!l||p===c&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,F_._set(Yy(this._name),!0),this._deleteProp(un),this._deleteProp(en),this._deleteProp(Xs),this._deleteProp(rn),this._deleteProp(sn),this._deleteProp(nn),this._deleteProp(Sn),this._deleteProp(bn),this._deleteProp(mn),g===Vn&&(d===jn||i[wn]===Vn||!Y(c)&&p!==c)&&(ib(this.props,i),this._deleteProp(cn)),g===jn?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(xs)),!0}consumeCookieIdentityChange(){var e=Yy(this._name),t=this._cookieIdentityChangePending||!!F_._get(e);return this._cookieIdentityChangePending=!1,t&&F_._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[Jy],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===Zy.indexOf(t.persistence.toLowerCase())&&(Kr.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=[...b_,...t];return _({},m_,{_parse(e){try{var t,s={};try{t=v_._get(e)||void 0,s=t?k_(JSON.parse(t)):{}}catch(e){}var n,o=JSON.parse(m_._get(e)||"{}");if(r){var a=I_(e,t),l=[...b_,...a.properties],u={};Object.keys(s).forEach((e=>{var t=s[e];ee(t)||""===t||e===wn&&t!==Vn&&t!==jn||(u[e]=t)}));var c=ws in u||u[wn]===Vn||u[wn]===jn;if(Object.keys(u).length>0){var d,h=o[ws],p=null!==(d=o[wn])&&void 0!==d?d:Vn;i.forEach((e=>{if(-1!==l.indexOf(e)&&!(e in s)&&(c||e!==ws&&e!==wn)){var t=o[e];!a.isValid&&-1!==b_.indexOf(e)&&(!1===t||0===t)||delete o[e]}})),!c||wn in s||wn in o||(o[wn]=Vn),!c||(ws in u?u[ws]:o[ws])===h&&(wn in u?u[wn]:o[wn])===p||(y_.forEach((e=>delete o[e])),u[wn]===jn&&ws in u?o.$user_id=u[ws]:delete o.$user_id,u[wn]!==jn&&(delete o[dn],delete o[cn]),delete o.__alias)}n=Xr(o,u)}else n=Xr(s,o);return m_._set(e,n),n}catch(e){}return null},_set(e,i,s,n,o,a){var l=m_._set(e,i,void 0,void 0,a);try{var u=C_(i,t);if(Object.keys(u).length){if(r){var c=S_(e),d=E_(u,t);if(v_._set(c,d,s,n,o,a),v_._get(c)!==JSON.stringify(d)){v_._remove(c,n);var h=C_(i);return v_._set(e,h,s,n,o,a),l}}v_._set(e,u,s,n,o,a)}}catch(e){m_._error(e)}return l},_remove(t,r){try{null==e||e.localStorage.removeItem(t),v_._remove(t,r),v_._remove(S_(t),r)}catch(e){m_._error(e)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&m_._is_supported()?(r=m_,s=!0):"localstorage+cookie"===n&&i._is_supported()?(r=i,s=!0):"sessionstorage"===n&&F_._is_supported()?r=F_:"memory"===n?r=P_:"cookie"===n&&v_._is_supported()?r=v_:i._is_supported()?(r=i,s=!0):r=v_._is_supported()?v_:P_,this._splitStorageEligible=s,r}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return Jr(this.props,((t,r)=>{var i=Qy(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?m_._parse(this._name):null,i={};if(t)try{Jr(i=k_(v_._parse(this._name)),((e,t)=>{(Y(e)||ee(e)||""===e)&&delete i[t]}))}catch(e){}var s=this._storage._parse(this._name);if(s&&(this.props=Xr({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var n,o,a=null==r?void 0:r[ws],l=null!==(n=null==r?void 0:r[wn])&&void 0!==n?n:Vn,u=s[ws],c=null!==(o=s[wn])&&void 0!==o?o:Vn;if(u!==a||c!==l){this._cookieIdentityChangePending=!0,F_._set(Yy(this._name),!0);var d=Xr({},this.props);y_.forEach((e=>delete d[e])),c===Vn&&(l===jn||i[wn]===Vn||!Y(a)&&u!==a)&&(ib(d,i),delete d[cn]),this.props=d;var h=new Set;y_.forEach((e=>{var t,r=null==(t=Qy(e))?void 0:t.storageGroup;r&&h.add(r)})),h.forEach((e=>{var t={};Jr(this.props,((r,i)=>{var s;(null==(s=Qy(i))?void 0:s.storageGroup)===e&&(t[i]=r)})),Z(t)?(m_._remove(this._groupEntryName(e)),this._slotState[e]={}):m_._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})}))}}F_._get(Yy(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Vy){var t=m_._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)||Xr(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var r;return(null==(r=Qy(t))?void 0:r.storageGroup)===e}))}_groupEntryIsStale(e,t){var r=Ky[e];if(!r)return!1;var i=t[r],s=this.props[r];return re(i)&&re(s)&&s>i}refreshKey(e){var t;if(!this._disabled){var r=this._splitStorage?null==(t=Qy(e))?void 0:t.storageGroup:void 0,i=r?m_._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e]);else{if(r){var s=this._storage._parse(this._name);if(s&&e in s)return void this._setProp(e,s[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){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||this.syncCookieProperties();var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var r=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Kr.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(r&&this._crossTabFeatureFlagHandlers.forEach((e=>e())));var i=this._writeEntry(this._storage,this._name,this.props,Jy);"written"===i&&this._rememberCurrentCookieProperties(this.props),"failed"!==i&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1),r&&this._crossTabFeatureFlagHandlers.forEach((e=>e()))}}}_writeNowSplit(){var e=this,t=this._partitionProps(),r=t.main,i=t.groups,s=this._writeEntry(this._storage,this._name,r,Jy);"written"===s&&this._rememberCurrentCookieProperties(r),"failed"!==s&&(this._localIdentityChangePending=!1,Xy.forEach((e=>{var t;null!=(t=Qy(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)})));var n=function(t){var r,s=i[t];if(Z(s)&&(null==(r=e._slotState[t])||!r.persisted))return Xy.forEach((r=>{var i;(null==(i=Qy(r))?void 0:i.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(r)})),1;var n=e._writeEntry(m_,e._groupEntryName(t),s,t);"failed"!==n&&Xy.forEach((r=>{var i=Qy(r);(null==i?void 0:i.storageGroup)!==t||"written"!==n&&i.volatile||e._pendingCrossTabFeatureFlagChanges.delete(r)}))};for(var o of Vy)n(o)}_partitionProps(){var e={},t={flags:{},surveys:{}};return Jr(this.props,((r,i)=>{var s,n=null==(s=Qy(i))?void 0:s.storageGroup;n?t[n][i]=r:e[i]=r})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Jy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return Jr(e,((e,t)=>{var i;r[t]=null!=(i=Qy(t))&&i.volatile?"__volatile__":e})),JSON.stringify(r)}_writeEntry(e,t,r,i){var s,n=this._slotWriteState(i);if(i!==Jy&&!n.dirty&&!Y(n.fingerprint))return"skipped";try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){s=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Jy&&(n.persisted=!0),Y(s)||(n.fingerprint=s),this._splitStorageEligible&&(n.storageValue=m_._get(t)),"written"):(this._config.debug&&Kr.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),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 Vy)m_._remove(this._groupEntryName(i));r?delete this._slotState[Jy]: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(Jr(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(Jr(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=Qa(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);Z(ii(t))||this.register(t),this._campaign_params_url=e}}update_search_keyword(){var e;this.register((e=null==i?void 0:i.referrer)?Za(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Xa(),$referring_domain:null!=i&&i.referrer&&(null==(e=ci(i.referrer))?void 0:e.host)||Ja},void 0)}set_initial_person_info(){this.props[xn]||this.props[En]||this.register_once({[In]:el(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={};Jr([En,xn],(t=>{var r=this.props[t];r&&Jr(r,(function(t,r){e["$initial_"+W(r)]=t}))}));var t=this.props[In];if(t){var r=function(e,t){void 0===t&&(t=!1);var r=tl(e,t),i={};return Jr(r,(function(e,t){i["$initial_"+W(t)]=e})),i}(t,this._config.disable_capture_url_hashes);Xr(e,r)}return e}safe_merge(e){return Jr(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){var i=e.persistence!==t.persistence,s=!((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||[]),n=i||s,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(i||s||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(_({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),l));var u=n||o?this._buildStorage(e):this._storage,c=this._resolveSplitStorage(e),d=n||c!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;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[Jy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,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[Es]||{};r[e]=t,this._setProp(Es,r),this.save()}remove_event_timer(e){var t=this.props[Es]||{},r=t[e];return Y(r)||(delete t[e],this._setProp(Es,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,r){var i;void 0===r&&(r=!0);var s=this.props[e];this.props[e]=t,r&&(e!==ws&&e!==wn||s===t||(this._localIdentityChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,s,t),null!=(i=Qy(e))&&i.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(eb(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,r=null==(t=Qy(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var nb=Zr("[RateLimiter]");class ob{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=>{nb.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void nb.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 s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property(Cn))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);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(Cn,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!=s&&s.pathname)return""+(null!==(e=s.origin)&&void 0!==e?e:"")+s.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=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",n?"triggered on "+n: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 "+s+" 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 ab=Zr("[RemoteConfig]");class lb{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 ab.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void ab.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return ab.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){ab.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||ab.warn("Failed to fetch remote config from PostHog."):ab.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){ab.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){ab.error("Error loading feature flags",e)}}}var ub=!!o||!!n,cb="text/plain",db=!1,hb=(e,t)=>{var r=e.split("#"),i=r[1],s=r[0].split("?"),n=s[0],o=s[1];if(!o)return e;var a=o.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return n+(a?"?"+a:"")+(i?"#"+i:"")},pb=function(e,t,r){var i;void 0===r&&(r=!0);var s=e.split("?"),n=s[0],o=s[1],a=_({},t),l=null!==(i=null==o?void 0:o.split("&").map((e=>{var t,i=e.split("="),s=i[0],n=r&&null!==(t=a[s])&&void 0!==t?t:i[1];return delete a[s],s+"="+n})))&&void 0!==i?i:[],u=di(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},gb=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===Ag){var i=pa(ga(ui(t)),{mtime:0});return{contentType:cb,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===Og){var s=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(ui(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:ui(e)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=ui(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},_b=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:pb(e.url,{compression:Og}),encodedBody:gb(_({},e,{compression:Og,_encodedBody:void 0}))}:{url:hb(e.url,"compression"),encodedBody:gb(_({},e,{compression:void 0,_encodedBody:void 0}))};try{t=gb(e)}catch(t){if(Bt(e.compression,hi(e.url,"compression")))return Kr.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&Bt(e.compression,hi(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?Nt(new Uint8Array(r)):ArrayBuffer.isView(r)&&Nt(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(db=!0,i()):{url:e.url,encodedBody:t}},vb=e=>{try{return _b(e)}catch(t){return Kr.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},fb=function(){var e=g((function*(e){var t=ui(e.data),r=yield Ut(t,Gr.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return _({},e,{_encodedBody:{contentType:cb,body:i,estimatedSize:i.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),mb=/Failed to fetch|NetworkError|Load failed/i,yb=e=>"TypeError"===(null==e?void 0:e.name)&&mb.test((null==e?void 0:e.message)||""),bb=e=>{var t=vb(e);if(t){var r=t.url,i=t.encodedBody,s=null!=i?i:{},o=s.contentType,l=s.body,u=s.estimatedSize,c=new Headers;Jr(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(Pt("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))}),e.timeout)}}var g=t=>{h&&"AbortError"===(null==t?void 0:t.name)||yb(t)?Kr.warn(t):Kr.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var v;n(r,_({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(u||0),body:l,signal:null==(v=d)?void 0:v.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){Kr.error(e)}null==e.callback||e.callback(i)})))).catch(g).finally((()=>d?clearTimeout(d.timeout):null))}catch(e){d&&clearTimeout(d.timeout),g(e)}}},Sb=e=>{try{var t,i=_b(e),s=i.url,n=i.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(r.sendBeacon(s,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:_({},e.data,{batch:t});return Sb(_({},e,{data:h(c.slice(0,d))})),void Sb(_({},e,{data:h(c.slice(d))}))}Kr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),bb(_({},e,{_keepaliveDisabled:!0}))}catch(e){Kr.warn("Beacon send failed",e)}},wb=(e,t,r,i)=>{var s="query"===i?"POST"===t?"sent_at":"_":void 0;return pb(r===Ag?hb(e,"compression"):e,_({},s?{[s]:Date.now().toString()}:{},r===Ag?{}:{compression:r}))},kb=[];n&&kb.push({transport:"fetch",method:bb}),o&&kb.push({transport:"XHR",method(e){var t=vb(e);if(t){var r=new o,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var s=null!=i?i:{},n=s.contentType,a=s.body;Jr(e.headers,(function(e,t){r.setRequestHeader(t,e)})),n&&r.setRequestHeader("Content-Type",n),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&&kb.push({transport:"sendBeacon",method:Sb});var Cb=3e3;class xb{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ve((null==t?void 0:t.flush_interval_ms)||Cb,250,5e3,Kr.createLogger("flush interval"),Cb),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(_({},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],s=(new Date).getTime();r.data&&G(r.data)&&Jr(r.data,(e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp})),e._sendRequestSafely(r)};for(var i in t)r()}}),this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Kr.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Jr(this._queue,(t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;Y(e[s])&&(e[s]=_({},i,{data:[]})),null==(r=e[s].data)||r.push(i.data)})),this._queue=[],e}}var Eb=["retriesPerformedSoFar"];class Ib{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},oi(e,"online",this._onlineListener),oi(e,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,r=v(e,Eb);ie(t)&&(r.url=pb(r.url,{retry_count:t})),this._instance._send_request(_({},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(_({retriesPerformedSoFar:t},r));0===e.statusCode&&Kr.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),s=Math.random()-.5;return Math.ceil(i+s*(i-r))}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),Kr.warn(s),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(_({},r,{transport:"sendBeacon"}))}catch(e){Kr.error(e)}}this._queue=[]}}class Tb{constructor(e){this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,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(){oi(e,"scroll",this._updateScrollData,{capture:!0}),oi(e,"scrollend",this._updateScrollData,{capture:!0}),oi(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 Mb=e=>el(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 Pb{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({[kn]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||Mb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[kn]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?tl(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 Jr(ii(this.getSetOnceProps()),((t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+W(r)]=t})),e}}class Rb{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 Fb=Zr("[SessionId]"),Lb=864e5;class Ab{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 Rb,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===zn)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||d_,this._windowIdGenerator=r||d_;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ve(this._config.session_idle_timeout_seconds||1800,60,36e3,Fb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=F_._parse(this._window_id_storage_key),o=F_._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:F_._remove(this._window_id_storage_key),F_._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&&F_._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&F_._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?F_._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,s=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!i||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Us]:[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(Us):(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({[Us]:[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[Us];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 Fb.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void Fb.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(Kn,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&F_._remove(this._primary_window_exists_storage_key)},oi(e,Kn,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===zn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(ee(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],c=!Y(s)&&l!==s,d=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,g=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>Lb),_=p?g:ie(u)&&Math.abs(i-u)>Lb,v=!1,f=c,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,d);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||Fb.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||_){f=!1;var w=p&&!g;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),Fb.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:_}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,v=!0}else h||(h=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(Fb.info("adopted cross-tab session id",{sessionId:l,windowId:h}),v=!0);var k=ie(d)&&e&&!_?d:i,C=ie(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var x={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:_,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach((e=>e(l,h,x))),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:v?x: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 Ob=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 Db(){return Db=g((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 Kr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})),Db.apply(this,arguments)}var Nb="custom",Bb="i.posthog.com",qb=/^\/static\//,Hb=["/s/","/e/","/i/"];class $b{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("."+Bb,".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":Nb),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(qb.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=ci(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ci(r))?void 0:n.href)||r;i=s(new URL(o)).toString()}if(s&&"api"===e&&Hb.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===s||(c={apiHost:u,rewriteRequestPath:s,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===Nb)return this._prepareEndpoint(e,t,this.apiHost+t);var i=Bb+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 Wb=Zr("[PostHog ExternalIntegrations]"),Ub={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class zb{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 Wb.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(){var t,i,s,n=r[0],o=r[1];!o||null!=(t=h.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Ub[n],(()=>{var t;null==(t=h.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)})),!o&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]&&(null==(s=h.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}}class Vb{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return g((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 jb{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 s=null==t?void 0:t.get_property(i);Y(s)||(r[i]=s)}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 Gb="extensionsRemoteConfig";class Qb{constructor(e){this._disposed=!1,this.instance=e,this._logger=Kr,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new jb(e),this.onEvent=e=>Lg(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 Lg((()=>{}));var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(Gb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Lg(r)},this._runtime=new Vb(Kr.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(ks))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(ks);return"string"==typeof e?e:void 0}get library(){return{name:Gr.LIB_NAME,version:Gr.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,s=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==s?void 0:s.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==s?void 0:s.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==s?void 0:s.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 g((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 Lg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(Gb,e))}sendRequest(e,t){var r=this;return g((function*(){var i;void 0===t&&(t={});var s=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),n={method:t.method,url:t.query?pb(s,t.query):s,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(n),{statusCode:202}):new Promise((e=>{n.callback=e,r.instance._send_request(n)}))}))()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var Kb={},Zb=0,Yb=()=>{},Jb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xb="Surveys module not available",eS="sanitize_properties is deprecated. Use before_send instead",tS="Invalid value for property_denylist config: ",rS=["token","distinct_id",Pn],iS="posthog",sS=!ub&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),nS=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},oS=t=>{var r;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ni(null==i?void 0:i.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Yb,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:s&&J(null==s?void 0:s.search)&&-1!==s.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){Kr.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:Gn,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Cb},error_tracking:{},_onCapture:Yb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Hi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:nS(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))},aS=[["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"]],lS=e=>{var t={};for(var r of aS){var i=r[0],s=r[1];Y(e[i])||(t[s]=e[i])}var n=Xr({},t,e),o=e.__preview_external_dependency_versioned_paths;return Y(o)||(Y(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),J(o)&&Y(e.asset_host)&&(n.asset_host=o)),G(e.property_blacklist)&&(Y(e.property_denylist)?n.property_denylist=e.property_blacklist:G(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Kr.error(tS+e.property_denylist)),n};class uS{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Kr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class cS{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===zn||this.config.cookieless_mode===Un&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!this._hasWarnedAboutVolatileIdentity&&!this.config.segment&&!this._inCookielessMode()){var e,t,r,i="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(i||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(i?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",r="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+r)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&this.get_distinct_id()===Mn){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===Mn){var r=this.config.get_device_id(d_());this.register({distinct_id:r,$device_id:r}),e.set_property(wn,Vn)}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 uS,this._personProcessingSetOncePropertiesSent=!1,this.version=Gr.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Rb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oS(),this.SentryIntegration=Uy,this.sentryIntegration=e=>function(e,t){var r=Wy(e,t);return{name:$y,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 Tb(this),this.pageViewManager=new zy(this),this.rateLimiter=new ob(this),this.requestRouter=new $b(this),this.consent=new Oy(this),this.externalIntegrations=new zb(this);var t=null!==(e=cS.__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=>Kr.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,r){if(r&&r!==iS){var i,s=null!==(i=Kb[r])&&void 0!==i?i:new cS;return s._init(e,t,r),Kb[r]=s,Kb[iS][r]=s,s}return this._init(e,t,r)}_init(t,r,i){var s,n,o;void 0===r&&(r={});var a,l=J(t)?t.trim():"";if(!l)return Kr.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 l!==(null==(a=this.config)?void 0:a.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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=oS(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 u=oS(r.defaults),c=lS(r),d=Xr({},u,c,{name:i,token:l});K(u.rageclick)&&K(c.rageclick)&&(d.rageclick=Xr({},u.rageclick,c.rageclick)),K(u.session_recording)&&K(c.session_recording)&&(d.session_recording=Xr({},u.session_recording,c.session_recording)),this.set_config(d),this.config.on_xhr_error&&Kr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Ag;var h=this._is_persistence_disabled();if(this.persistence=new sb(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sb(_({},this.config,{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&F_._is_supported()){var p=F_._parse(this._sessionRegisteredPropertiesStorageKey);G(p)&&p.forEach((e=>{J(e)&&this._sessionRegisteredPropKeys.add(e)}))}else F_._remove(this._sessionRegisteredPropertiesStorageKey);var g=_({},this.persistence.props),v=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new xb((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Ib(this),this.__request_queue=[];var f=this._inCookielessMode();f||(this.sessionManager=new Ab(this),this.sessionPropsManager=new Pb(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?(Kr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(f)}),0)):(Kr.info("Initializing extensions synchronously"),this._initExtensions(f)),Gr.DEBUG=Gr.DEBUG||this.config.debug,Gr.DEBUG&&Kr.info("Starting in debug mode",{this:this,config:r,thisC:_({},this.config),p:g,s:v}),!this.config.identity_distinct_id||null!=(s=r.bootstrap)&&s.distinctID||(r.bootstrap=_({},r.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=r.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!m&&!X(m),void 0!==(null==(o=r.bootstrap)?void 0:o.distinctID)){var y=r.bootstrap.distinctID,b=this.get_distinct_id(),S=this.persistence.get_property(wn);if(r.bootstrap.isIdentifiedID&&null!=b&&b!==y&&S===Vn)this.identify(y);else if(r.bootstrap.isIdentifiedID&&null!=b&&b!==y&&S===jn)Kr.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 w=this.config.get_device_id(d_()),k=r.bootstrap.isIdentifiedID?w:y;this.persistence.set_property(wn,r.bootstrap.isIdentifiedID?jn:Vn),this.register({distinct_id:y,$device_id:k})}}if(f)this.register_once({distinct_id:Mn,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(d_());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(wn,Vn)}return oi(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()||d_();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(wn,jn)),t()},s=r.user();"then"in s&&Q(s.then)?s.then(i):i(s)}(e,(()=>{r.register((e=>{"undefined"!=typeof Promise&&Promise.resolve||Hy.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()||(Hy.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Hy.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,Zn),identify:e=>t(e,Jn),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Q(this.config._onCapture)&&this.config._onCapture!==Yb&&(Kr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Kr.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 Db.apply(this,arguments)}().then((e=>{e&&this.register({[Cs]:e})})).catch(Yb),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=>{Kr.error('Failed to dispose browser extension "'+e.name+'"',t)}))})):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,r,i,s,n,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(r=cS.__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==(s=(n=this.featureFlags).initialize)||s.call(n))}_initExtensions(e){var t,r,i,s,n,o,a,l=performance.now(),u=_({},cS.__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!==(s=this.metrics)&&void 0!==s?s:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n: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,By)),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){Kr.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[Rn]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fn]:i}),this.config.__preview_deferred_init_extensions&&Kr.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!i||!i.body)return Kr.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,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=q(s.supportedCompression,Ag)?Ag:q(s.supportedCompression,Og)?Og:void 0),null!=(r=s.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Gn}),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){Kr.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var e=s.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 lb(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()&&Yr(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,s;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Yn),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(Yn,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?sS?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=_({},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,s=_({},e);s.timeout=s.timeout||6e4;var n,o,a,u,c,d=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===d&&Y(s.compression)&&s.data&&(s.compression=Og),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(c=(u=(G(n=s.data)?n:[n]).map((e=>_({},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"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),G(e)?e.map((e=>_({},e,{sent_at:t}))):_({},e,{sent_at:t})}(s.data))),s.url=wb(s.url,s.method,s.compression,s.timestampMode);var h=kb.filter((e=>!s.disableTransport||!e.transport||!s.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 g=e=>{try{p(e)}catch(e){yb(e)?Kr.warn(e):Kr.error(e),null==s.callback||s.callback({statusCode:0,error:e})}};"sendBeacon"!==d&&s.data&&s.compression===Ag&&l&&"undefined"!=typeof Promise&&!db?fb(s).then((e=>{g(e)})).catch((t=>{if(qt(t))return db=!0,void g(_({},s,{compression:void 0,url:wb(e.url,e.method,void 0,e.timestampMode)}));Ht(t)&&(db=!0),g(s)})):p(s)})(_({},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){Zb++;try{var t,r=[],i=[],s=[];Yr(e,(e=>{if(e)if(G(t=e[0]))s.push(e);else if(Q(e))try{e.call(this)}catch(t){Kr.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])?s.push(e):i.push(e)}));var n=function(e,t){Yr(e,(function(e){try{if(G(e[0])){var r=t;Jr(e,(function(e){r=r[e[0]].apply(r,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Kr.error("Error executing queued PostHog call",e,t)}}))};n(r,this),n(i,this),n(s,this)}finally{Zb--}}push(e){if(Zb>0&&G(e)&&J(e[0])){var t=cS.prototype[e[0]];Q(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,s,n,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)&&(Kr.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||Kr.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=Mt(null==r?void 0:r.uuid,d_),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===Zn&&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 g="$feature_flag_called"===e&&!1===p.properties.$feature_flag_has_experiment&&!0===this.get_property(on);(null==r?void 0:r.$set)&&!g&&(p.$set=null==r?void 0:r.$set);var v=null==r?void 0:r.$unset;v&&(p.$unset=v);var f=g?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==Xn,e===Jn);if(f&&(p.$set_once=f),null!=r&&r._noTruncate||(s=this.config.properties_string_max_length,n=p,o=e=>J(e)?e.slice(0,s):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=[],Yr(t,(t=>{i.push(e(t))}));else{var s={};Jr(t,((t,r)=>{a.has(t)||(s[r]=e(t,r))})),i=s}return i}}(n)),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),g&&(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,rS)),e===Vg.DISMISSED||e===Vg.SENT){var m=null==t?void 0:t[jg.SURVEY_ID],y=null==t?void 0:t[jg.SURVEY_ITERATION];t_({id:m,current_iteration:y}),p.$set=_({},p.$set,{[wa({id:m,current_iteration:y},e===Vg.SENT?"responded":"dismissed")]:!0})}else e===Vg.SHOWN&&(p.$set=_({},p.$set,{[jg.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if("product tour shown"===e){var b=null==t?void 0:t.$product_tour_type;b&&(p.$set=_({},p.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var S=_({},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=Mt(p.uuid,d_)}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),x={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(x):this._requestQueue.enqueue(x),p}Kr.critical("This capture call is ignored due to client rate limiting.")}}else Kr.error("No event name provided to posthog.capture")}else Kr.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 Qb(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(wn)===Vn&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,n,o,a){if(n=n||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=_({},r);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this._inCookielessMode()&&(c[Pn]=!0),"$snapshot"===t){var d=_({},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))&&Kr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,p=function(t,r,i,n){var o,a,l,c;if(void 0===n&&(n=!1),!u)return{};var d,h=t?[...za,...r||[]]:[],p=xt(u),g=p[0],_=p[1],v=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,x=Xr(ii({$os:g,$os_version:_,$browser:St(u,navigator.vendor,v,f),$device:Et(u),$device_type:It(u,m),$timezone:rl(),$timezone_offset:il()}),{$current_url:pi(n?Rt(null==s?void 0:s.href):null==s?void 0:s.href,h,ja),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:kt(u,navigator.vendor,v,f),$browser_language:Ya(),$browser_language_prefix:(C=Ya(),"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:Gr.LIB_NAME,$lib_version:Gr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Gr.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Gr.SDK_DIST_CHANNEL),x}(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 g=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),v=g.windowId;c.$session_id=g.sessionId,c.$window_id=v}this.sessionPropsManager&&Xr(c,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Xr(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===Nb&&(c.$lib_custom_api_host=this.config.api_host),h=t!==Zn||a?t!==Yn||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),c=Xr(c,h),t===Zn&&i&&(c.title=i.title),!Y(l)){var m=n.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();Jr(["$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{Xr(S,w())}catch(e){Kr.error("Failed to produce browser extension event properties",e)}(c=Xr({},p,y,b,_({},S,c))).$is_identified=this._isIdentified(),G(this.config.property_denylist)?Jr(this.config.property_denylist,(function(e){delete c[e]})):Kr.error(tS+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Kr.error(eS),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 s=this.persistence.get_initial_props(),n=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),o=Xr({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Kr.error(eS),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||!F_._is_supported())F_._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach((e=>t.push(e))),t.length>0?F_._set(this._sessionRegisteredPropertiesStorageKey,t):F_._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:Xb}),()=>{})}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:Xb})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Xb})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=i_),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:Xb}}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:Xb})}_validateIdentifyId(e){return!e||X(e)?(Kr.critical("Unique user id has not been set in posthog.identify"),!1):e===Mn?(Kr.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())||(Kr.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 Kr.uninitializedWarning("posthog.identify");if(re(e)&&(e=e.toString(),Kr.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(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ks)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property(xs)&&(this.unregister(xs),this.register({distinct_id:e}));var u,c=(this.persistence.get_property(wn)||Vn)===Vn,d=e!==l,h=!d&&c;if(d&&c)this.persistence.set_property(wn,jn),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(Jn,{distinct_id:e,$anon_distinct_id:l},{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=Aa(e,t,r),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(h){this.persistence.set_property(wn,jn);var p=t||{},g=r||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:p,$set_once:g}),this._cachedPersonProperties=Aa(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(mn)):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=Aa(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):Kr.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 s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},s,{[e]:t})}),n||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(Xn,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else Kr.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=se(e)?e:null==e?void 0:e.resetDeviceID,r=se(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,s,n;if(void 0===t&&(t=!1),Kr.info("reset"),!this.__loaded)return Kr.uninitializedWarning("posthog.reset");var o=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(ks),l=this.get_property(Cs),u=this.get_property(Ns),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==(n=this.persistence)||null==n._beginCookieSyncSuppression?void 0:n._beginCookieSyncSuppression(),h=!1;try{var p,g,v,f,m,y,b,S,w,k,C,x,E;if(null==(p=this.persistence)||p.clear(),null==(g=this.sessionPersistence)||g.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Y(u)||null==(k=this.persistence)||k.register({[Ns]:u}),null==(v=this.surveys)||v.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(wn,Vn),null==(w=this.sessionManager)||w.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===zn)this.register_once({distinct_id:Mn,$device_id:null},"");else{var I=this.config.get_device_id(d_());this.register_once({distinct_id:I,$device_id:e?I:a},""),e||Y(l)||this.register({[Cs]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(E=this.persistence)||E.set_property(wn,r.isIdentifiedID?jn:Vn),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(Y(o)||null!=(x=this.sessionManager)&&x.setBootstrapSessionId(o,!0))){var T=_({},r);delete T.sessionID,this.config.bootstrap=T}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 g((function*(){var e,r,i,s,n,o,a;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==(s=t._requestQueue)||s.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){Kr.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else Kr.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 s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-n,0)}return i}alias(e,t){return e===this.get_property(Ss)?(Kr.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(xs,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Kr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(K(e)){var r,i,s,n,o,a,l,u,c,d,h,p;Xr(this.config,lS(e));var g=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sb(_({},this.config,{persistence:"sessionStorage"}),g,!1);var v,f=this._checkLocalStorageForDebug(this.config.debug);se(f)&&(this.config.debug=f),se(this.config.debug)&&(this.config.debug?(Gr.DEBUG=!0,m_._is_supported()&&m_._set("ph_debug",!0),Kr.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(Gr.DEBUG=!1,m_._is_supported()&&m_._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.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==(v=this.historyAutocapture)||v.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){Gr.LIB_NAME=e,Gr.LIB_VERSION=t}startSessionRecording(e){var t,r,i,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(_({},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:cS._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:iS;return t!==iS&&(t=iS+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(wn))===jn||(null==(t=this.sessionPersistence)?void 0:t.get_property(wn))===jn}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Gn&&!this._isIdentified()&&Z(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[xs])&&(null==(t=this.persistence)||null==(t=t.props)||!t[Tn]))}_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?(Kr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Tn,!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!==Un)}_sync_opt_out_with_persistence(){var e,t,r,i,s,n=this._is_persistence_disabled();return this.is_capturing()||null==(r=this.logs)||r._onOptOut(),(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==zn){if(this._inCookielessMode()){var r,i,s,n,o,a;null==(r=this.sessionRecording)||r.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Ab(this),this.pageViewManager=new zy(this),this.persistence&&(this.sessionPropsManager=new Pb(this,this.sessionManager,this.persistence));var l,u=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=cS.__defaultExtensionClasses)?void 0:a.sessionRecording;u&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new u(this)),this._lastRemoteConfig&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._lastRemoteConfig)))}var c,d;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==Un&&(null==(c=this.surveys)||c.loadIfEnabled()),(Y(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(d=null==e?void 0:e.captureEventName)&&void 0!==d?d:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Kr.warn(Jb)}opt_out_capturing(){if(this.config.cookieless_mode!==zn){var e,t,r=this.config.cookieless_mode===Un?this.sessionRecording:void 0;null==r||r.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Un&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Un&&(this.register({distinct_id:Mn,$device_id:null}),this._removeExtension(r),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else Kr.warn(Jb)}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===zn||(this.config.cookieless_mode===Un?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?Ob(r,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){i&&("visible"===i.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Zn,{title:i.title},{send_instantly:!0}),this._visibilityStateListener&&(i.removeEventListener(Qn,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),oi(i,Qn,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?(Kr.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,s){var n=t in e&&!te(e[t]),o=r in e&&!te(e[r]);return n?e[t]:!!o&&(s&&s.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,Kr)}_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],s=e;for(var n of i)try{if(s=n(s),te(s)){var o="Event '"+e.event+"' was rejected in beforeSend function";return oe(e.event)?Kr.warn(o+". This can cause unexpected behavior."):Kr.info(o),null}s.properties&&!Z(s.properties)||Kr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Kr.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(s.properties&&te(s.properties[a]))return Kr.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 s}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=se(e)&&!e,r=m_._is_supported()&&"true"===m_._get("ph_debug");return!t&&(!!r||e)}}cS.__defaultExtensionClasses={},cS._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]]=ri(e.prototype[t[r]])}(cS,["identify"]);class dS{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 hS=Zr("[ExceptionAutocapture]"),pS=Zr("[TracingHeaders]"),gS=Zr("[Web Vitals]"),_S=9e5,vS=["CLS","FCP","INP","LCP"],fS=["INP","LCP"],mS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],yS="[SessionRecording]",bS=Zr(yS),SS=Zr("[Heatmaps]");function wS(e){return K(e)&&"clientX"in e&&"clientY"in e&&re(e.clientX)&&re(e.clientY)}var kS=Zr("[Product Tours]"),CS=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(As))},xS=["$set_once","$set"],ES=Zr("[SiteApps]"),IS="Error while initializing PostHog app with config id ",TS=(e,t)=>null!=e&&e.then?e.then(t):t(e),MS="SDK is not enabled or survey functionality is not yet loaded",PS="Disabled. Not loading surveys.";class RS{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 Qg.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(te(t))return Qg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=se(t)?t:t.length>0,Qg.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}},this._configSource=e,this._initialClientState=t}setup(e){if(!this._disposed)return this._initializingClient=e,TS(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(Yg)||null!=i&&i.startsWith(Jg))&&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)Qg.info("Already initializing surveys, skipping...");else if(e.disableSurveys)Qg.info(PS);else if(e.cookielessMode&&this._configSource.isOptedOut())Qg.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 s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Wn),void(this._isInitializingSurveys=!1);s((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 Qg.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),Qg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){Qg.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 Qg.info(PS),e([]);var s=i.kv.get(hn);if(s&&!t)return e(s,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys((()=>{}),!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then((t=>{this._disposed||e(t.surveys,t.context)})).catch((e=>Qg.error("Error in survey callback",e)));else{var n=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 Qg.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}}),(e=>this._handleSurveyResponse(i,{statusCode:0,error:e})));this._getSurveysInFlightPromise=n;var o=()=>{this._getSurveysInFlightPromise===n&&(this._getSurveysInFlightPromise=null)};n.then((t=>{o(),this._disposed||e(t.surveys,t.context)}),o).catch((e=>Qg.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(MS)})))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:MS}};var r=t.statusCode;if(200!==r||!t.json){var i="Surveys API could not be loaded, status: "+r;return 0!==r?Qg.error(i):t.error||Qg.warn(i),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:i}}}this._lastSurveyRefreshFailedAt=null;var s,n=t.json.surveys||[],o=n.filter((e=>Kg(e)&&(Ta(e)||Zg(e))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),e.kv.set({[hn]:n,[pn]:Date.now()}),{surveys:n,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(pn);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};t_(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){Qg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!te(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Qg.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:MS};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:MS};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 Qg.warn("init was not called"),{visible:!1,disabledReason:MS};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return te(this._surveyManager)?(Qg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:MS})):new Promise((r=>{this.getSurveys((t=>{var i,s=null!==(i=t.find((t=>t.id===e)))&&void 0!==i?i:null;if(s){var n=this._checkSurveyRenderability(s);r({visible:n.eligible,disabledReason:n.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var s;if(te(this._surveyManager))Qg.warn("init was not called");else{var n="string"==typeof e?this._getSurveyById(e):e;if(null!=n&&n.id)if(r_.includes(n.type)){var o=null==i?void 0:i.querySelector(t);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){Qg.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var e,t;this._renderTimeouts.delete(a),this._disposed||(Qg.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,o,r),Qg.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(a)}else this._surveyManager.renderSurvey(n,o,r);else Qg.warn("Survey element not found")}else Qg.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Qg.warn("Survey not found")}}displaySurvey(e,t){var r;if(te(this._surveyManager))Qg.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var s=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=_({},i,{appearance:_({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Gg&&t.initialResponses&&Qg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this._checkSurveyEligibility(i);if(!n.eligible)return void Qg.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else Qg.warn("Survey not found")}}cancelPendingSurvey(e){te(this._surveyManager)?Qg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}function FS(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 LS{constructor(e){this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Rb,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 Rb}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(!FS(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=>FS(e.href,t.href,t.href_matching||"exact")));var s,n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!n&&FS((s=n.match(/(?::|")href="(.*?)"/))?s[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=>FS(e.text,t.text,t.text_matching||"exact")||FS(e.$el_text,t.text,t.text_matching||"exact")));var s,n,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(s=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),n=t.text,o=t.text_matching||"exact",s.some((e=>FS(e,n,o))))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;var s=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}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||La(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 AS{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&&La(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===Dg?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems((e=>{s=e.filter((e=>null==i?void 0:i.includes(e.id)))})),s.filter((i=>{var s,n=null==(s=i.conditions)||null==(s=s[r])||null==(s=s.values)?void 0:s.find((t=>t.name===e));return this._doesEventMatchFilter(n,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 LS(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,s=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}}))})),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var s;t&&(null==(s=this._actionMatcher)||s.replace([]))}}_mergeItemMaps(e,t){t.forEach(((t,r)=>{var i,s=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach((e=>{s.includes(e)||s.push(e)})),e.set(r,s)}))}_setupEventBasedItems(e,t){var r,i,s=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})),n=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,Dg),a=this._buildEventToItemMap(e,Ng);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==s.length||0!==n.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,s=this._getLogger(),n=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this._activationOutcome(e,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._deactivateItems([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:e,itemId:n}),this._persistActivation(n),void this._clearActivationTimestamps([n])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,Ng);a.length>0&&(s.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)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,Dg);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 s of e)r&&this._shouldPersistArmedActivation(s)?this._persistActivation(s)&&this._recordActivationTimestamp(s):i.push(s);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(_({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var s of Object.entries(t)){var n=s[0],o=s[1];e.includes(n)?i=!0:r[n]=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()],s=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return s&&i===s?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(),s=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter((e=>re(s[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 OS extends AS{constructor(e){super(e)}_getActivatedKey(){return gn}_getActivatedSessionKey(){return _n}_getActivationTimestampsKey(){return vn}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[vn]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(vn)}_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 Vg.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 Qg}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[gn]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[_n]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(_n)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems((e=>{r=e.find((e=>e.id===t))})),!r||Ma(r)?e===Vg.SHOWN?"consume":"ignore":e===Vg.SHOWN?"persist":e===Vg.DISMISSED||e===Vg.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class DS{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 NS{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 OS(this._instance)}}var BS=null!=e&&e.location?gi(e.location.hash,"__posthog")||gi(location.hash,"state"):null,qS="_postHogToolbarParams",HS=Zr("[Toolbar]"),$S=Zr("[FeatureFlags]");class WS{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,s,n,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!==(s=e.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==n?n:[],flagKeys:G(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||($S.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)||$S.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}}var US=Zr("[FeatureFlags]"),zS=Zr("[FeatureFlags]",{debugEnabled:!0}),VS="\" failed. Feature flags didn't load in time.",jS="connection_error",GS=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},QS=e=>{var t={};for(var r of ei(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},KS="Refusing to render web experiment since the viewer is a likely bot",ZS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Pa(t,e),not_regex:(e,t)=>!Pa(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class YS{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{YS._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;t._flagToExperiments&&(YS._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 s in e.variants){var n=e.variants[s];YS._matchesTestVariant(n,t._instance)&&t._applyTransforms(e.name,s,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())YS._logInfo(KS);else if(!this._config.disable_web_experiments){if(te(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();YS._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),s=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=s&&s.variants[i]&&this._applyTransforms(s.name,i,s.variants[i].transforms)}}))}}previewWebExperiment(){var e=YS.getWindowLocation();if(null!=e&&e.search){var t=hi(null==e?void 0:e.search,"__experiment_id"),r=hi(null==e?void 0:e.search,"__experiment_variant");t&&r&&(YS._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&&(YS._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)&&YS._matchUrlConditions(e,t)&&YS._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=YS.getWindowLocation();if(i){var s,n,o,a=fi(t,i.href);return null==(s=e.conditions)||!s.url||ZS[null!==(n=null==(o=e.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"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=Qa();if(r.utm_source){var i,s,n,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==r.utm_campaign,h=null==(n=e.conditions)||null==(n=n.utm)||!n.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,g=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&&g&&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];Kr.info("[WebExperiments] "+e,r)}_applyTransforms(e,t,r){this._is_bot()?YS._logInfo(KS):"control"!==t?r.forEach((r=>{if(r.selector){var i;YS._logInfo("applying transform of variant "+t+" for experiment "+e+" ",r);var s=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==s||s.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute("style",r.css)}))}})):YS._logInfo("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?Ob(r,this._config.custom_blocked_useragents):void 0}}var JS=Zr("[Conversations]"),XS="Conversations not available yet.";function ew(e,t){var i,s,n,o,a,l,u,c=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,d=null!==(s=null==e?void 0:e.maxBufferSize)&&void 0!==s?s:100,h=null!=t&&t.consoleCapture?void 0:null!==(n=null==e?void 0:e.maxLogsPerInterval)&&void 0!==n?n:1e3,p=Y(h)?Math.max(d,2048):Math.max(d,h),g=_({},function(){var e="",t="";try{var i=null==r?void 0:r.userAgent;if(i){var s=xt(i);e=s[0],t=s[1]}}catch(e){}return function(e,t){var r=function(e){if(e)return{}.hasOwnProperty.call(Xt,e)?Xt[e]:e}(e);return _({},r?{"os.name":r}:{},t?{"os.version":t}:{})}(e,t)}(),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==g?void 0:g["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==g?void 0:g["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(u=null==g?void 0:g["deployment.environment"])&&void 0!==u?u:null==e?void 0:e.environment,resourceAttributes:g,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var tw=["debug","log","warn","error","info"],rw="console",iw="__posthogHandledLogsRequestError",sw=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[iw]=!0,r},nw=e=>!!e&&"object"==typeof e&&!0===e[iw],ow={featureFlags:class{constructor(e){this.name=s_,this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=US,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._instance=e,this._mutableConfigSource=new WS(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]"),TS(e.kv.initialize(),(()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))}))}_finishSetup(t){var r;if(this._client===t)return e&&oi(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties((()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues)),this._crossTabPersistenceUnsubscribe=null==(r=this._instance)||null==(r=r.persistence)?void 0:r.onCrossTabFeatureFlagChange((()=>{this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()})),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&&oi(i,Qn,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(Qn,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,r;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,null==(r=this._crossTabPersistenceUnsubscribe)||r.call(this),this._crossTabPersistenceUnsubscribe=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)}))}_markCrossTabFeatureFlagSnapshot(e,t,r){var i;if(null!=(i=this._instance)&&i.persistence&&e[Xs]){var s=this._prop(Xs)||{},n=e[Xs]||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter((e=>{var t=e[1];return!(null!=t&&t.failed)})).map((e=>e[0])):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:r&&!G(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),c=this._prop(sn)||{},d=e[sn]||{},h=l||r?u:Array.from(new Set([...Object.keys(c),...Object.keys(d)])),p=!l&&!r,g=!!p||u,_={[en]:g,[Xs]:g,[sn]:!!p||h};for(var v of(e[rn]&&(_[rn]=g),[nn,Sn,on]))Y(e[v])||(_[v]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}_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[en,sn,nn,an]){var r=this._prop(t);Y(r)||(e[t]=r)}this._baseEventProperties=e;var i=_({},e),s=this._prop(Xs);if(s)for(var n of Object.entries(s))i["$feature/"+n[0]]=n[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(Sn);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 s,n,o=null!==(s=null==(n=r.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},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,s,n=null!=r&&r.merge&&null!==(i=this._prop(Xs))&&void 0!==i?i:{},o=null!=r&&r.merge&&null!==(s=this._prop(sn))&&void 0!==s?s:{},a=_({},n,e),l=_({},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(rn),t=this._prop(an),r=this._prop(ln);if(!r&&!t)return e||{};var i=Xr({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=i[n],u=null==t?void 0:t[n],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[n],p=_({},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=_({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[n]=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(Xs),t=this._prop(an);if(!t)return e||{};for(var r=Xr({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];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(sn),t=this._prop(ln);if(!t)return e||{};for(var r=Xr({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];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(mn)}_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:_({},t.initialPersonProperties,this._prop(un)||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(cn),timezone:rl()};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 s=this._getValidFlagKeys();Y(s)||(r.flag_keys=s);var n=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&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({[bn]:[jS]}),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,s=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?jS:"unknown_error"):200!==e.statusCode&&u.push("api_error_"+e.statusCode),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var c=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));c&&u.push("quota_limited"),this._set({[bn]: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(s,o,{partialResponse:n}),l()}}else l()})).catch(u)}catch(e){u(e)}}}_hasStatusZeroCircuitBreakerTripped(){return _i(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=vi(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+VS)}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(),s=e in i,n=i[e],o=this.getFlagPayloads()[e],a=String(n),l=this._prop(nn)||void 0,u=this._prop(Sn)||void 0,c=this._prop(mn)||{};if(this._config.deduplicateCallsPerSession){var d,h=null==(d=this._client)?void 0:d.session.sessionId,p=this._prop(yn);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({[mn]:c,[yn]:r});else{var g,v,f,m,b,S,w,k,C,x,E,I;G(c[e])?c[e].push(a):c[e]=[a],this._set(_({[mn]:c},r?{[yn]:r}:{}));var T=this.getFeatureFlagDetails(e),M=[...null!==(g=this._prop(bn))&&void 0!==g?g:[]];Y(n)&&M.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(v=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==v?v: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==T||null==(S=T.metadata)?void 0:S.has_experiment)||(P.$feature_flag_has_experiment=T.metadata.has_experiment),Y(null==T||null==(w=T.metadata)?void 0:w.version)||(P.$feature_flag_version=T.metadata.version);var R,F=null!==(k=null==T||null==(C=T.reason)?void 0:C.description)&&void 0!==k?k:null==T||null==(x=T.reason)?void 0:x.code;F&&(P.$feature_flag_reason=F),null!=T&&null!=(E=T.metadata)&&E.id&&(P.$feature_flag_id=T.metadata.id),Y(null==T?void 0:T.original_variant)&&Y(null==T?void 0:T.original_enabled)||(P.$feature_flag_original_response=Y(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(I=T.metadata)&&I.original_payload&&(P.$feature_flag_original_payload=null==T||null==(R=T.metadata)?void 0:R.original_payload),M.length&&(P.$feature_flag_error=M.join(",")),this._captureFeatureFlagCalled(P)}else r&&this._set({[mn]:c,[yn]:r});if(s)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:y(o)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+VS)}_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 g((function*(){var i=r._client;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r._getValidEvaluationEnvironments();n.length&&(s.evaluation_contexts=n);var o,a=r._getValidFlagKeys();Y(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,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+VS),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,s,n){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===n&&(n=US);var o=((e,t)=>{var r=e.flags;return r?_({},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!Y(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,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(G(l)){n.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{[en]:l,[Xs]:h,[on]:!1}}var g=l,v=u,f=a;if(null!=s&&s.partialResponse){var m=Object.keys(g),y=v||{};g=_({},t,g),v=_({},r,y),m.forEach((e=>{var t;e in y||null==(t=v)||delete t[e]})),f=_({},i,f)}else if(e.errorsWhileComputingFlags)if(a){var b=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));g=_({},t,Object.fromEntries(Object.entries(g).filter((e=>b.has(e[0])))));var S=Object.fromEntries(Object.entries(v||{}).filter((e=>b.has(e[0]))));v=_({},r,S),b.forEach((e=>{var t;e in S||null==(t=v)||delete t[e]})),f=_({},i,Object.fromEntries(Object.entries(f||{}).filter((e=>b.has(e[0])))))}else g=_({},t,g),v=_({},r,v),f=_({},i,f);return _({[en]:Object.keys(QS(g)),[Xs]:g||{},[sn]:v||{},[rn]:f||{},[on]:!0===e.minimalFlagCalledEvents},c?{[nn]:c}:{},d?{[Sn]:d}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);i&&(this._markCrossTabFeatureFlagSnapshot(i,e,!(null==r||!r.partialResponse)),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([an,ln]),this._fireFeatureFlagsCallbacks(),void zS.info("All overrides cleared");if(G(e))return this._set({[an]:GS(e)}),this._fireFeatureFlagsCallbacks(),void zS.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={},s=r.flags,n=r.payloads;return s&&(i[an]=G(s)?GS(s):s),n&&(i[ln]=n),Object.keys(i).length&&this._set(i),!1===s&&!1===n?this._remove([an,ln]):!1===s?this._remove(an):!1===n&&this._remove(ln),this._fireFeatureFlagsCallbacks(),!1===s?zS.info("Flag overrides cleared"):s&&zS.info("Flag overrides set",{flags:s}),void(!1===n?zS.info("Payload overrides cleared"):n&&zS.info("Payload overrides set",{payloads:n}))}if(e&&"object"==typeof e)return this._set({[an]:e}),this._fireFeatureFlagsCallbacks(),void zS.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,s=(this._prop(tn)||[]).find((t=>t.flagKey===e)),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=_({},this.getFlagVariants(),{[e]:t});null==(i=this._instance)||null==(i=i.persistence)||i.markCrossTabFeatureFlagChanges({[en]:[e],[Xs]:[e],[un]:Object.keys(n)}),this._set({[en]:Object.keys(QS(a)),[Xs]:a,[un]:_({},this._prop(un)||{},n)}),this._fireFeatureFlagsCallbacks();try{var l;null==(l=this._client)||l.capture("$feature_enrollment_update",o).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(tn);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return g((function*(){var i=r._client;if(i){var s,n=t?"&"+t.map((e=>"stage="+e)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r._set({[tn]:s=o.json.earlyAccessFeatures})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(s)}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(un)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in r||(n[o]=s[o]));this._set({[un]:_({},r,n,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=_({},this._prop(un)||{});e.forEach((e=>{delete r[e]})),this._set({[un]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(un),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop(cn)||{},i=_({},r);for(var s of Object.keys(e))i[s]=_({},r[s],e[s]);this._set({[cn]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(cn)||{};this._set({[cn]:_({},t,{[e]:{}})})}else this._remove(cn)}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}}},aw={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===oo||this._recordingStatus===ao?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=eo,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 bS.error("started without valid sessionManager"),new Error(yS+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===zn)throw new Error(yS+' cannot be used with cookieless_mode="always"');null!=i&&i.addEventListener&&oi(i,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(void 0===e?{}:e).discardBufferedEvents,r=void 0!==t&&t;this._sessionRecordingDisposed=!0,null==i||null==i.removeEventListener||i.removeEventListener("visibilitychange",this._onVisibilityChange),r?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t,r=!(null==(t=this._instance.get_property(Ns))||!t.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&r&&i&&!s}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),bS.info("starting")):(this._recordingStatus=eo,this.stopRecording())}}_lazyLoadAndStart(e){var t,r;if(this._isRecordingEnabled)if(this._recordingStatus!==oo&&this._recordingStatus!==ao&&(this._recordingStatus=no),null!=h&&null!=(t=h.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=h.__PosthogExtensions__)&&r.initSessionRecording)this._onScriptLoaded(e);else{var i,s=this._instance.sessionManager;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,(t=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===s)return t?(this._instance.register_for_session({[Ln]:!0}),bS.error("could not load recorder",t)):void this._onScriptLoaded(e);this._recordingStatus=eo}))}}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(e){var t,r;void 0===e&&(e=!1),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=void 0,null==(r=this._lazyLoadedSessionRecording)||r.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(zs),null==(t=this._persistence)||t.unregister(Bs)}_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?(bS.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,s=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=s?s:n;te(o)&&this._resetSampling();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[Ns]:_({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:_({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})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(s)}}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===oo&&(this._recordingStatus=ao,bS.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):bS.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(Ns);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(Ns);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return bS.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<=Tl}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(null==(t=h.__PosthogExtensions__)||!t.initSessionRecording)return bS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Ln]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(s=h.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===ao||this._recordingStatus===oo)return;return this._recordingStatus=oo,bS.info("persisted remote config is stale, requesting fresh config before starting"),void new lb(this._instance).load()}this._recordingStatus=no,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=eo}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({[Hs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({[qs]:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(r=this._persistence)||r.register({["url"===e?$s:Ws]:!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))}}},lw={autocapture:class extends ky{constructor(e){super(new dS(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&&(Kr.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,Kr.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;zh(e.history,t,(e=>function(r,s,n){e.call(this,r,s,n),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(Zn,{navigation_type:e}),this._lastLocation=t}catch(t){Kr.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var t=()=>{this._capturePageview("popstate")};oi(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var t=()=>{this._capturePageview("hashchange")};oi(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[Ts]),this.rageclicks=new fy(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;SS.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({[Ts]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){wS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(i)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&i&&(this._flushHandler=this._flush.bind(this),oi(e,Kn,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),oi(i,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),oi(i,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new qy(this.instance,Ny,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),oi(i,Qn,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&i&&(this._flushHandler&&e.removeEventListener(Kn,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(Qn,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(t=this._deadClicksCapture)||t.stop(),this._initialized=!1)}_getProperties(t,r){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(t,r,i){for(var s=t;s&&Ci(s)&&!xi(s,"body");){if(s===i)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:e)?void 0:o.getComputedStyle(s).position}catch(e){return!1}if(q(r,n))return!0;s=Ni(s)}return!1}(Ai(t),["fixed","sticky"],n);return{x:t.clientX+(o?0:s),y:t.clientY+(o?0:i),target_fixed:o,type:r}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!ki(e.target)&&wS(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&Vi(Ai(e),this.instance.config.rageclick)&&this._capture(_({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!ki(e.target)&&wS(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?Rt(e.location.href):e.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...za,...i||[]]:[],n=pi(r,s,ja);this._buffer=this._buffer||{},this._buffer[n]||(this._buffer[n]=[]),this._buffer[n].push(t)}}_flush(){this._buffer&&!Z(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:qy,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",_({$current_url:this._buffer.url},this._buffer.metrics.reduce(((e,t)=>_({},e,{["$web_vitals_"+t.name+"_event"]:_({},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))gS.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!Y(i)){var s=re(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Y(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=i),this._buffer.firstMetricTimestamp=Y(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=_({},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 mS){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(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else gS.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,s=!1,n=h.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Y(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!Y(a)){var l=a.withoutAttribution,u=this.attributionMetrics;s=!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=s&&this.attributionMetrics.indexOf("INP")>-1?_({},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 gS.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[Fs]),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[Ds])||vS: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 se(e)?e?vS:[]:G(e)?e:fS}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:_S;return e>0&&6e4>=e?_S:e}get isEnabled(){var e=null==s?void 0:s.protocol;if("http:"!==e&&"https:"!==e)return gS.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=K(this._perfConfig)?this._perfConfig.web_vitals:se(this._perfConfig)?this._perfConfig:void 0;return se(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(gS.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({[Fs]:r}),this._instance.persistence.register({[Ds]: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?gS.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?Rt(r):r,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...za,...s||[]]:[];return pi(i,n,ja)}gS.error("Could not determine current URL")}}},uw={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,s=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=s(this.captureException.bind(this)))}catch(e){hS.error("failed to start",e),this._stopCapturing()}}},this._instance=t,this._remoteEnabled=!(null==(r=this._instance.persistence)||!r.props[Ms]),this._rateLimiter=new fe(_({},function(e){var t,r,i,s;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!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:hS})),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=_({},t,e):(Y(e)?this._remoteEnabled:e)&&(t=_({},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?(hS.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 hS.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({[Ms]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,r,i,s=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(s)?hS.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=yf(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property(Ps))&&void 0!==t?t:[],this._exceptionStepsConfig=zr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Vr(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=zr(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var s=e.config;if("errorTracking"in s){var n=null!==(t=null==(r=s.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=s.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[Ps]:this._suppressionRules,[Rs]:o})}}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(Rs),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 _f.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)=>Wr.has(i)?(t.push(i),r):(r[i]=e[i],r)),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,s=r.droppedKeys;s.length>0&&_f.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(_({[Hr]:e,[$r]:(new Date).toISOString()},i))}catch(e){_f.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 _f.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 _f.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 _f.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 _f.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(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;i&&(r.$release_id=i);try{var s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return _f.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void _f.error("Failed to process exception event. Ignoring this exception.",e)}var n}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:_({},e,{$exception_steps:t})}catch(t){return _f.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Hr]:e,[$r]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return K(e)?_({},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=Fa[e.operator],i=t[e.key];if(!r||!i)return!1;var s=G(e.value)?e.value:[e.value];return s.length>0&&r(s,i)}));return"OR"===e.type?r.some(Boolean):r.every(Boolean)}))}catch(e){return _f.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:[]})),r=t.filter((e=>{var t=e.filename;return!!t&&ff.some((e=>t.startsWith(e)))}));return 0!==r.length&&(!r.every((e=>{var t=e.filename;return!!t&&t.startsWith(vf)}))||e.some((e=>{var t=e.value;return J(t)&&t.includes("isolatedAPI.contexts.topHostname")}))&&!t.some((e=>{var t=e.filename;return e.in_app&&!(null!=t&&t.startsWith(vf))})))}_isInjectedBrowserScriptException(e){return e.some((e=>{var t=e.value;return J(t)&&mf.some((e=>t.includes(e)))}))}_isPostHogException(e){if(e.length>0){var t,r,i,s,n=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(i=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!te(e)&&G(e)}}},cw=_({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({[As]:!!t.productTours}),!CS(this._instance))return!this._productTourManager&&te(null==(r=this._persistence)?void 0:r.props[fn])||kS.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&&CS(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?kS.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[fn];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(CS(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||kS.warn(s):kS.error(s),void e([],{isLoaded:!1,error:s})}var n=G(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,r&&r.register({[fn]:n}),e(n,{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(fn)}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)}}},ow),dw={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,s,n,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,g=e.$set;return{event:_({},v(e,xS),{properties:_({},e.properties,g?{$set:_({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:_({},null!==(i=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==i?i:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_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)||(ES.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)||(ES.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,s,n,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,g=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push((()=>{e[t]=i}))}},_=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},v=e=>e.map((e=>"string"==typeof e?e:_(e))).filter((e=>!ee(e)));return g(c,"appendChild",(e=>function(t){var r=_(t);return r?e.call(this,r):t})),g(c,"insertBefore",(e=>function(t,r){var i=_(t);return i?e.call(this,i,r):t})),g(c,"replaceChild",(e=>function(t,r){var i=_(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==(s=u.DocumentFragment)?void 0:s.prototype].forEach((e=>{g(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,v(r))})),g(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,v(r))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((e=>{g(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,v(r))})),g(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,v(r))})),g(e,"replaceWith",(e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var s=v(r);return r.length&&!s.length?void 0:e.apply(this,s)}))})),g(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(e=>function(t,r){var i=_(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&&(ES.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,s=s=>{t.errored=!s,t.loaded=!0,ES.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&r()};try{var n=this._runWithPreparedSiteAppElements((t=>e.init({posthog:this._instance,callback(e){t(),s(e)}})),!1).processEvent;n&&(t.processEvent=n),i=!0}catch(t){ES.error(IS+e.id,t),s(!1)}if(i&&t.loaded)try{r()}catch(r){ES.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){ES.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var s of Object.values(this.apps))i(s)}}onRemoteConfig(e){var t,r,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void ES.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 n=e.config;if(null!=(i=n.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,r,(e=>{if(e)return ES.error(IS+t,e)}))};for(var a of n.siteApps)o()}else ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},hw={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 pS.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()}}},pw=_({surveys:class extends RS{constructor(e){var t;super(new NS(e),{get projectToken(){return t.config.token},kv:new DS(t=e)}),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?pb(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})}))}}},ow),gw={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,s){if(void 0===t&&(t=void 0),void 0===r&&(r=void 0),void 0===s&&(s=void 0),ai(this.instance.config))return!1;if(!e||!i)return!1;t=null!=t?t:e.location,s=null!=s?s: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 n,o=BS||gi(t.hash,"__posthog")||gi(t.hash,"state"),a=o?ti((()=>JSON.parse(atob(decodeURIComponent(o)))))||ti((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?t.hash=a.desiredHash:s?s.replaceState(s.state,"",t.pathname+t.search):t.hash="")):((n=JSON.parse(r.getItem(qS)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),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):HS.warn("No toolbar load function found")}loadToolbar(t){var r=!(null==i||!i.getElementById(yi));if(!e||r)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=_({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(e.localStorage.setItem(qS,JSON.stringify(_({},n,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(n);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 HS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(n)})),oi(e,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(n)}))}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)}}},_w=_({experiments:YS},ow),vw={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)||(se(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||ai(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(Wn);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 JS.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,JS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else JS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){JS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():JS.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":ai(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 g((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(JS.warn(XS),null)}))()}getMessages(e,t){var r=this;return g((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(JS.warn(XS),null)}))()}markAsRead(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(JS.warn(XS),null)}))()}getTickets(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(JS.warn(XS),null)}))()}requestRestoreLink(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(JS.warn(XS),null)}))()}restoreFromToken(e){var t=this;return g((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(JS.warn(XS),null)}))()}restoreFromUrlToken(){var e=this;return g((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(JS.warn(XS),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()}}},fw={logs:class{constructor(t){var r,i=this;this.name=n_,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Zr("[logs]"),this._coreLogger=_({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];t.some(nw)||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&&oi(e,"online",this._onReconnect)}_buildCore(e,t,r,i){var s,n=ew(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,r);return[new or(this._createHost(e,t),n,this._coreLogger,(()=>this._getSdkContext()),(e=>e()),void 0,i),n]}_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},rw);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,s;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==(s=this._consoleCore)||s.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({[Os]:!!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[Os])}_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=ew(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=function(e){var i;try{i=rf(h.console[e])}catch(e){return 0}if(!i)return 0;t._consoleRecorderUnpatchers.push(zh(h.console,e,(s=>{var n=function(){for(var i=arguments.length,n=new Array(i),o=0;i>o;o++)n[o]=arguments[o];try{t._recordConsoleEntry(e,n,r)}catch(e){}return s.apply(h.console,n)};return n.__rrweb_original__=i,n})))};for(var s of tw)i(s);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){nw(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(Wn),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,s,n=this._takeConsoleBuffer();this._consoleLogsDispose=r.initializeLogs(null!==(i=this._client)&&void 0!==i?i:this._instance),this._isLoaded=!0,n.length>0&&(null==r.replayConsoleBuffer||r.replayConsoleBuffer(null!==(s=this._client)&&void 0!==s?s:this._instance,n))}}}))}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:()=>Gr.LIB_NAME,getLibraryVersion:()=>Gr.LIB_VERSION}}_sendLogsBatch(e){return new Promise((t=>{if(_i(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:sw(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(s),t(e))},s=setTimeout((()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:sw(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:sw(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=vi(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,Gr.LIB_NAME,(e=>{this._queue=e})),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,rw,(e=>{this._consoleQueue=e}))}_drainQueueViaTransport(e,t,r,i,s){if(0!==t.length){var n=t.map((e=>e.record));s([]);var o=nr(n,sr(r,Gr.LIB_NAME,Gr.LIB_VERSION),i,Gr.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,s=r.sessionStartTimestamp,n=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,te(s)||(t.sessionStartTimestamp=s),te(n)||(t.lastActivityTimestamp=n)}if(null!=h&&null!=(e=h.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Rt(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},mw={metrics:class{constructor(e){this._logger=Zr("[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 cr(this._createHost(),function(e){var t,r,i,s,n,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!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==n?n: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:()=>Gr.LIB_NAME,getLibraryVersion:()=>Gr.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise((r=>{var i=!1,s=e=>{i||(i=!0,clearTimeout(n),r(e))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(_({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)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error("metrics request failed with status "+t)});else{var r;s({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)}}},yw=_({},ow,aw,lw,uw,cw,dw,pw,hw,gw,_w,vw,fw,mw);cS.__defaultExtensionClasses=_({},yw),function(){Gr.SDK_DIST_CHANNEL="cdn";var t=h.posthog;if(!t||G(t._i)){var r=Kb[iS]=new cS;if(t){var s=[];Jr(t._i,(function(e){if(e&&G(e)){var i=r.init(e[0],e[1],e[2]),n=t[e[2]]||t;i.__loaded&&-1===s.indexOf(n)&&(s.push(n),i._execute_array.call(i.people,n.people),i._execute_array(n))}}))}r.__SV=1,h.posthog=r,function(){function t(){t.done||(t.done=!0,sS=!1,Jr(Kb,(function(e){e._dom_loaded()})))}null!=i&&i.addEventListener?"complete"===i.readyState?t():oi(i,"DOMContentLoaded",t,{capture:!1}):e&&Kr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}();
2
2
  //# sourceMappingURL=array.full.no-external.js.map