!function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.380.1",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function f(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}function g(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}var _,m=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),b=["$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"],y="NativeGzipValidationError",w=t=>t.length>=2&&31===t[0]&&139===t[1],x=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),E=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=y,e},S=function(){var t=f((function*(t,e){18>t.size&&E("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());w(i)&&8===i[2]||E("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(_)return _;_=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;_[t]=e>>>0}return _})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&E("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&E("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function k(){return k=f((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=f((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield S(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),k.apply(this,arguments)}var P=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],T=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return P.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function R(t,e){return-1!==t.indexOf(e)}var I=function(t){return t.trim()},C=function(t){return t.replace(/^\$/,"")},F=Object.prototype,O=F.hasOwnProperty,M=F.toString,A=Array.isArray||function(t){return"[object Array]"===M.call(t)},D=t=>"function"==typeof t,j=t=>t===Object(t)&&!A(t),L=t=>{if(j(t)){for(var e in t)if(O.call(t,e))return!1;return!0}return!1},N=t=>void 0===t,z=t=>"[object String]"==M.call(t),U=t=>z(t)&&0===t.trim().length,B=t=>null===t,H=t=>N(t)||B(t),q=t=>"[object Number]"==M.call(t)&&t==t,V=t=>q(t)&&t>0,W=t=>"[object Boolean]"===M.call(t),G=t=>t instanceof FormData,J=t=>R(b,t);function K(t){return null===t||"object"!=typeof t}function Y(t,e){return{}.toString.call(t)==="[object "+e+"]"}function X(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var Q=[!0,"true",1,"1","yes"],Z=t=>R(Q,t),tt=[!1,"false",0,"0","no"];function et(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),q(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),et(s||i,e,i,r))}class it{constructor(t){this.$t={},this.zt=t.zt,this.Zt=et(t.bucketSize,0,100,t.Gt),this.Qt=et(t.refillRate,0,this.Zt,t.Gt),this.Jt=et(t.refillInterval,0,864e5,t.Gt)}Kt(t,e){var i=Math.floor((e-t.lastAccess)/this.Jt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qt,this.Zt),t.lastAccess=t.lastAccess+i*this.Jt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Kt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var rt,st,nt,ot="Mobile",at="iOS",lt="Android",ut="Tablet",ht=lt+" "+ut,dt="iPad",vt="Apple",ct=vt+" Watch",ft="Safari",pt="BlackBerry",gt="Samsung",_t=gt+"Browser",mt=gt+" Internet",bt="Chrome",yt=bt+" OS",wt=bt+" "+at,xt="Internet Explorer",Et=xt+" "+ot,St="Opera",$t=St+" Mini",kt="Edge",Pt="Microsoft "+kt,Tt="Firefox",Rt=Tt+" "+at,It="Nintendo",Ct="PlayStation",Ft="Xbox",Ot=lt+" "+ot,Mt=ot+" "+ft,At="Windows",Dt=At+" Phone",jt="Nokia",Lt="Ouya",Nt="Generic",zt=Nt+" "+ot.toLowerCase(),Ut=Nt+" "+ut.toLowerCase(),Bt="Konqueror",Ht="Oculus Browser",qt="Vivaldi",Vt="Yandex",Wt="Whale",Gt="DuckDuckGo",Jt="Pale Moon",Kt="Waterfox",Yt="Brave",Xt="(\\d+(\\.\\d+)?)",Qt=new RegExp("Version/"+Xt),Zt=new RegExp(Ft,"i"),te=new RegExp(Ct+" \\w+","i"),ee=new RegExp(It+" \\w+","i"),ie=new RegExp(pt+"|PlayBook|BB10","i"),re={"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"},se=function(t,e,i){e=e||"";var r=function(t){return null!=t&&t.brave?Yt:null}(i);return r||(R(t," OPR/")&&R(t,"Mini")?$t:R(t," OPR/")?St:ie.test(t)?pt:R(t,"IE"+ot)||R(t,"WPDesktop")?Et:R(t,"OculusBrowser")?Ht:R(t,_t)?mt:R(t,kt)||R(t,"Edg/")?Pt:R(t,qt+"/")?qt:R(t,"YaBrowser/")?Vt:R(t,Wt+"/")?Wt:R(t,Gt+"/")||R(t,"Ddg/")?Gt:R(t,"FBIOS")?"Facebook "+ot:R(t,"UCWEB")||R(t,"UCBrowser")?"UC Browser":R(t,"CriOS")?wt:R(t,"CrMo")||R(t,bt)?bt:R(t,lt)&&R(t,ft)?Ot:R(t,"FxiOS")?Rt:R(t.toLowerCase(),Bt.toLowerCase())?Bt:R(t,Yt+"/")?Yt:((t,e)=>e&&R(e,vt)||function(t){return R(t,ft)&&!R(t,bt)&&!R(t,lt)}(t))(t,e)?R(t,ot)?Mt:ft:R(t,"PaleMoon/")?Jt:R(t,Kt+"/")?Kt:R(t,Tt)?Tt:R(t,"MSIE")||R(t,"Trident/")?xt:R(t,"Gecko")?Tt:"")},ne={[Et]:[new RegExp("rv:"+Xt)],[Pt]:[new RegExp(kt+"?\\/"+Xt)],[bt]:[new RegExp("("+bt+"|CrMo)\\/"+Xt)],[wt]:[new RegExp("CriOS\\/"+Xt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Xt)],[ft]:[Qt],[Mt]:[Qt],[St]:[new RegExp("(Opera|OPR)\\/"+Xt)],[Tt]:[new RegExp(Tt+"\\/"+Xt)],[Rt]:[new RegExp("FxiOS\\/"+Xt)],[Bt]:[new RegExp("Konqueror[:/]?"+Xt,"i")],[pt]:[new RegExp(pt+" "+Xt),Qt],[Ot]:[new RegExp("android\\s"+Xt,"i")],[mt]:[new RegExp(_t+"\\/"+Xt)],[Ht]:[new RegExp("OculusBrowser\\/"+Xt)],[qt]:[new RegExp(qt+"\\/"+Xt)],[Vt]:[new RegExp("YaBrowser\\/"+Xt)],[Wt]:[new RegExp(Wt+"\\/"+Xt)],[Yt]:[new RegExp(Yt+"\\/"+Xt)],[Gt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Xt)],[Jt]:[new RegExp("PaleMoon\\/"+Xt)],[Kt]:[new RegExp(Kt+"\\/"+Xt)],[xt]:[new RegExp("(rv:|MSIE )"+Xt)],Mozilla:[new RegExp("rv:"+Xt)]},oe=function(t,e,i){var r=se(t,e,i),s=ne[r];if(N(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},ae=[[new RegExp(Ft+"; "+Ft+" (.*?)[);]","i"),t=>[Ft,t&&t[1]||""]],[new RegExp(It,"i"),[It,""]],[new RegExp(Ct,"i"),[Ct,""]],[ie,[pt,""]],[new RegExp(At,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Dt,""];if(new RegExp(ot).test(e)&&!/IEMobile\b/.test(e))return[At+" "+ot,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=re[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[At,r]}return[At,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[at,[t[3],t[4],t[5]||"0"].join(".")]:[at,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=N(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+lt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lt+")","i"),t=>t&&t[2]?[lt,[t[2],t[3],t[4]||"0"].join(".")]:[lt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[yt,""]],[/Linux|debian/i,["Linux",""]]],le=function(t){return ee.test(t)?It:te.test(t)?Ct:Zt.test(t)?Ft:new RegExp(Lt,"i").test(t)?Lt:new RegExp("("+Dt+"|WPDesktop)","i").test(t)?Dt:/iPad/.test(t)?dt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ct:ie.test(t)?pt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jt,"i").test(t)?jt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(ot).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?lt:ht:new RegExp("(pda|"+ot+")","i").test(t)?zt:new RegExp(ut,"i").test(t)&&!new RegExp(ut+" pc","i").test(t)?Ut:""},ue=t=>t instanceof Error,he={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}},de=he.info;function ve(t){if(W(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(A(t))return{arrayValue:{values:t.map((t=>ve(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function ce(t){var e=[];for(var i in t){var r=t[i];B(r)||N(r)||e.push({key:i,value:ve(r)})}return e}function fe(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return nt&&i.length===st||(st=i.length,nt=i.reduce(((i,r)=>{rt||(rt={});var s=rt[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,rt[r]=[l,u];break}}return i}),{})),nt}}class pe{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return f((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&A(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),p({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return f((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,p({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:fe(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return p({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var ge="?";function _e(t,e,i,r,s){var n={platform:t,filename:e,function:""===i?ge:i,in_app:!0};return N(r)||(n.lineno=r),N(s)||(n.colno=s),n}var me=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:ge,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},be=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ye=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,we=/\((\S*)(?::(\d+))(?::(\d+))\)/,xe=(t,e)=>{var i=be.exec(t);if(i){var[,r,s,n]=i;return _e(e,r,ge,+s,+n)}var o=ye.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=we.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=me(o[1]||ge,o[2]);return _e(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Ee=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Se=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$e=(t,e)=>{var i=Ee.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Se.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||ge;return[n,s]=me(n,s),_e(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ke=/\(error: (.*)\)/;class Pe{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=z(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return Y(t,"DOMException")}isDOMError(t){return Y(t,"DOMError")}}class Te{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class Re{constructor(){}match(t){return Y(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var Ie=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ce{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Ie);return r&&(e=r[1],i=r[2]),[e,i]}}var Fe=["fatal","error","warning","log","info","debug"];function Oe(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Me{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return X(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Oe(t)}isSeverityLevel(t){return z(t)&&!U(t)&&Fe.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(ue(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Ae{match(t){return X(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Oe(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class De{match(t){return K(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class je{match(t){return Y(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!X(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return K(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Le="$message",Ne="$timestamp",ze=new Set([Le,Ne]),Ue={enabled:!0,max_bytes:32768};function Be(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Ue.enabled,max_bytes:qe(t.max_bytes,Ue.max_bytes)}:p({},Ue)}class He{constructor(t){this.Yt=[],this.Xt=0,this.qt=Be(t)}setConfig(t){this.qt=Be(t),this.er()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!j(i))return;var r=i,s=r[Le],n=r[Ne];if(!z(s)||0===s.trim().length)return;if(!z(n)&&!q(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.qt.max_bytes||(this.Yt.push({step:e.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map((t=>t.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var t=this.Yt.shift();t&&(this.Xt-=t.bytes)}}}function qe(t,e){if(!q(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Ve=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={k(i){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!N(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Ve(e+" "+t,i)};return s},We=Ve("[PostHog.js]"),Ge=We.createLogger,Je=Ge("[ExternalScriptsLoader]"),Ke=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Je.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}Ke(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Ke(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Ke(t,r,i)};var Ye="$people_distinct_id",Xe="$device_id",Qe="__alias",Ze="__timers",ti="$autocapture_disabled_server_side",ei="$heatmaps_enabled_server_side",ii="$exception_capture_enabled_server_side",ri="$error_tracking_suppression_rules",si="$error_tracking_capture_extension_exceptions",ni="$web_vitals_enabled_server_side",oi="$dead_clicks_enabled_server_side",ai="$product_tours_enabled_server_side",li="$web_vitals_allowed_metrics",ui="$session_recording_remote_config",hi="$replay_override_sampling",di="$replay_override_linked_flag",vi="$replay_override_url_trigger",ci="$replay_override_event_trigger",fi="$sesid",pi="$session_is_sampled",gi="$enabled_feature_flags",_i="$active_feature_flags",mi="$early_access_features",bi="$feature_flag_details",yi="$feature_flag_payloads",wi="$feature_flag_request_id",xi="$override_feature_flags",Ei="$override_feature_flag_payloads",Si="$stored_person_properties",$i="$stored_group_properties",ki="$surveys",Pi="$surveys_activated",Ti="ph_product_tours",Ri="$flag_call_reported",Ii="$flag_call_reported_session_id",Ci="$feature_flag_errors",Fi="$feature_flag_evaluated_at",Oi="$user_state",Mi="$client_session_props",Ai="$capture_rate_limit",Di="$initial_campaign_params",ji="$initial_referrer_info",Li="$initial_person_info",Ni="$epp",zi="__POSTHOG_TOOLBAR__",Ui="$posthog_cookieless",Bi="$sdk_debug_extensions_init_method",Hi="$sdk_debug_extensions_init_time_ms",qi="$sdk_debug_recording_script_not_loaded",Vi="PostHog loadExternalDependency extension not found.",Wi="on_reject",Gi="always",Ji="anonymous",Ki="identified",Yi="identified_only",Xi="visibilitychange",Qi="beforeunload",Zi="$pageview",tr="$pageleave",er="$identify",ir="$groupidentify";function rr(t,e){A(t)&&t.forEach(e)}function sr(t,e){if(!H(t))if(A(t))t.forEach(e);else if(G(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)O.call(t,i)&&e(t[i],i)}var nr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function or(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var ar=function(t){try{return t()}catch(t){return}},lr=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){We.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),We.critical(t)}}},ur=function(t){var e={};return sr(t,(function(t,i){(z(t)&&t.length>0||q(t))&&(e[i]=t)})),e};var hr=["herokuapp.com","vercel.app","netlify.app"];function dr(t){var e=null==t?void 0:t.hostname;if(!z(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of hr)if(i===r)return!1;return!0}function vr(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function cr(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return q(t)&&isFinite(t)&&Math.floor(t)===t});class fr{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fr(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new fr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class pr{constructor(){this.S=0,this.C=0,this.I=new mr}generate(){var t=this.generateOrAbort();if(N(t)){this.S=0;var e=this.generateOrAbort();if(N(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.T();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return fr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var gr,_r=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!N(t.crypto)&&crypto.getRandomValues&&(_r=t=>crypto.getRandomValues(t));class mr{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(_r(this.M),this.R=0),this.M[this.R++]}}var br=()=>yr().toString(),yr=()=>(gr||(gr=new pr)).generate(),wr="",xr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Er={O:()=>!!r,D(t){We.error("cookieStore error: "+t)},A(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},F(t){var e;try{e=JSON.parse(Er.A(t))||{}}catch(t){}return e},N(t,e,i,s,n){if(r)try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),wr)return wr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+br();!wr&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",wr=o)}return wr}(t);if(!i){var s=(t=>{var e=t.match(xr);return e?e[0]:""})(t);s!==i&&We.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&We.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},q(t,e){if(null!=r&&r.cookie)try{Er.N(t,"",-1,e)}catch(t){return}}},Sr=null,$r={O(){if(!B(Sr))return Sr;var e=!0;if(N(t))e=!1;else try{var i="__mplssupport__";$r.N(i,"xyz"),'"xyz"'!==$r.A(i)&&(e=!1),$r.q(i)}catch(t){e=!1}return e||We.error("localStorage unsupported; falling back to cookie store"),Sr=e,e},D(t){We.error("localStorage error: "+t)},A(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){$r.D(t)}return null},F(t){try{return JSON.parse($r.A(t))||{}}catch(t){}return null},N(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(t){$r.D(t)}},q(e){try{null==t||t.localStorage.removeItem(e)}catch(t){$r.D(t)}}},kr=[Xe,"distinct_id",fi,pi,Ni,Li,Oi],Pr={},Tr={O:()=>!0,D(t){We.error("memoryStorage error: "+t)},A:t=>Pr[t]||null,F:t=>Pr[t]||null,N(t,e){Pr[t]=e},q(t){delete Pr[t]}},Rr=null,Ir={O(){if(!B(Rr))return Rr;if(Rr=!0,N(t))Rr=!1;else try{var e="__support__";Ir.N(e,"xyz"),'"xyz"'!==Ir.A(e)&&(Rr=!1),Ir.q(e)}catch(t){Rr=!1}return Rr},D(t){We.error("sessionStorage error: ",t)},A(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Ir.D(t)}return null},F(t){try{return JSON.parse(Ir.A(t))||null}catch(t){}return null},N(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(t){Ir.D(t)}},q(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Ir.D(t)}}};class Cr{constructor(t){this._instance=t}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===Gi||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===Wi}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qt.opt_out_capturing_by_default}optInOut(t){this.nr.N(this.sr,t?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get ir(){var t=this.nr.A(this.sr);return Z(t)?1:R(tt,t)?0:-1}get nr(){var t=this.qt.opt_out_capturing_persistence_type,e="localStorage"===t?$r:Er;if(!this.ar||this.ar!==e){this.ar=e;var i="localStorage"===t?Er:$r;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Z(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>Z(t)))}}var Fr=Ge("[Dead Clicks]"),Or=()=>!0,Mr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(oi)),r=t.instance.config.capture_dead_clicks;return W(r)?r:!!j(r)||i};class Ar{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[oi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Fr.error("failed to load script",e):t()}))}hr(){var t;if(r){if(!this.ur&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=j(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.ur=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.ur.start(r),Fr.info("starting...")}}else Fr.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Fr.info("stopping..."))}}var Dr=Ge("[SegmentIntegration]");var jr="posthog-js";function Lr(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,l,u,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=e.exception)?void 0:a.values)||[],g=f.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||e.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:e.level,$exception_list:g,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),e}}class Nr{constructor(t,e,i,r,s,n){this.name=jr,this.setupOnce=function(o){o(Lr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class zr{constructor(t){this.cr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(We.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.vr()}vr(){var t;this.pr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.cr)}destroy(){var t;null==(t=this.pr)||t.call(this),this.pr=void 0}doPageView(e,i){var r,s=this.gr(e,i);return this.dr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.gr(t,null==(e=this.dr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.dr)?void 0:t.pageViewId}}gr(t,e){var i=this.dr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(N(n)||N(o)||N(a)||N(l)||N(u)||N(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?et(o/n,0,1,We):1,v=n>1?et(a/n,0,1,We):1,c=l>1?et(u/l,0,1,We):1,f=l>1?et(h/l,0,1,We):1;r=nr(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ur={[Ye]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[ti]:{exposure:"event"},[ei]:{exposure:"hidden"},[ii]:{exposure:"event"},[ri]:{exposure:"hidden"},[si]:{exposure:"event"},[ni]:{exposure:"event"},[oi]:{exposure:"event"},[ai]:{exposure:"hidden"},[li]:{exposure:"event"},[ui]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[fi]:{exposure:"hidden"},[pi]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[gi]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!j(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[_i]:{exposure:"event"},[mi]:{exposure:"hidden"},[bi]:{exposure:"hidden"},[yi]:{exposure:"event"},[wi]:{exposure:"event"},[xi]:{exposure:"event"},[Ei]:{exposure:"hidden"},[Si]:{exposure:"hidden"},[$i]:{exposure:"hidden"},[ki]:{exposure:"hidden"},[Pi]:{exposure:"event"},[Ti]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ri]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Fi]:{exposure:"hidden"},[Oi]:{exposure:"hidden"},[Mi]:{exposure:"hidden"},[Ai]:{exposure:"hidden"},[Di]:{exposure:"hidden"},[ji]:{exposure:"hidden"},[Li]:{exposure:"hidden"},[Ni]:{exposure:"hidden"},[hi]:{exposure:"event"},[di]:{exposure:"event"},[vi]:{exposure:"event"},[ci]:{exposure:"event"},[Bi]:{exposure:"event"},[Hi]:{exposure:"event"},[qi]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Br=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Hr=t=>{var e=null==r?void 0:r.createElement("a");return N(e)?null:(e.href=t,e)},qr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!A(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){We.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Vr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");A(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Wr=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Gr="https?://(.*)",Jr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Kr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jr],Yr="",Xr=["li_fat_id"];function Qr(t,e,i){if(!r)return{};var s,n=e?[...Jr,...i||[]]:[],o=Zr(Vr(r.URL,n,Yr),t),a=(s={},sr(Xr,(function(t){var e=Er.A(t);s[t]=e||null})),s);return nr(a,o)}function Zr(t,e){var i=Kr.concat(e||[]),r={};return sr(i,(function(e){var i=qr(t,e);r[e]=i||null})),r}function ts(t){var e=function(t){return t?0===t.search(Gr+"google.([^/?]*)")?"google":0===t.search(Gr+"bing.com")?"bing":0===t.search(Gr+"yahoo.com")?"yahoo":0===t.search(Gr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!B(e)){s.$search_engine=e;var n=r?qr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function es(){return navigator.language||navigator.userLanguage}var is="$direct";function rs(){return(null==r?void 0:r.referrer)||is}function ss(t,e){var i=t?[...Jr,...e||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:rs().substring(0,1e3),u:r?Vr(r,i,Yr):void 0}}function ns(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==is?is:null==(e=Hr(i))?void 0:e.host};if(r){s.$current_url=r;var n=Hr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Zr(r);nr(s,o)}if(i){var a=ts(i);nr(s,a)}return s}function os(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function as(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ls=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class us{constructor(e,i){if(this.qt=e,this.props={},this.mr=!1,this.yr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&We.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var r=()=>this.flush();vr(t,"beforeunload",r,{capture:!1}),vr(t,"pagehide",r,{capture:!1})}}_r(){var t,e=null==(t=this.qt)?void 0:t.persistence_save_debounce_ms;return q(e)&&e>0?e:0}isDisabled(){return!!this.wr}br(e){-1===ls.indexOf(e.persistence.toLowerCase())&&(We.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i=function(e){void 0===e&&(e=[]);var i=[...kr,...e];return p({},$r,{F(t){try{var e={};try{e=Er.F(t)||{}}catch(t){}var i=nr(e,JSON.parse($r.A(t)||"{}"));return $r.N(t,i),i}catch(t){}return null},N(t,e,r,s,n,o){try{$r.N(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&Er.N(t,a,r,s,n,o)}catch(t){$r.D(t)}},q(e,i){try{null==t||t.localStorage.removeItem(e),Er.q(e,i)}catch(t){$r.D(t)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&$r.O()?$r:"localstorage+cookie"===r&&i.O()?i:"sessionstorage"===r&&Ir.O()?Ir:"memory"===r?Tr:"cookie"===r?Er:i.O()?i:Er}Sr(t){var e=null!=t?t:this.qt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Fi];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return sr(this.props,((e,i)=>{var r=(t=>{var e=Ur[t];if(e)return e;for(var[i,r]of Br)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===gi?()=>this.Sr():()=>!1))return;r.transformToEventProperties&&nr(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this.wr){var t=this.nr.F(this.yr);t&&(this.props=nr({},t))}}refreshKey(t){if(!this.wr){var e=this.nr.F(this.yr);e&&t in e?this.kr(t,e[t]):this.Cr(t)}}save(){if(!this.wr){var t=this._r();t>0?N(this.Ir)&&(this.Ir=setTimeout((()=>{this.Ir=void 0,this.Tr()}),t)):this.Tr()}}flush(){N(this.Ir)||(clearTimeout(this.Ir),this.Ir=void 0,this.Tr())}Tr(){if(!this.wr){try{var t=JSON.stringify(this.props)+"|"+this.Er+"|"+this.Mr+"|"+this.Rr;if(t===this.Pr)return;this.Pr=t}catch(t){}this.nr.N(this.yr,this.props,this.Er,this.Mr,this.Rr,this.qt.debug)}}remove(){N(this.Ir)||(clearTimeout(this.Ir),this.Ir=void 0),this.nr.q(this.yr,!1),this.nr.q(this.yr,!0),this.Pr=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(j(t)){N(e)&&(e="None"),this.Er=N(i)?this.Or:i;var r=!1;if(sr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.kr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(j(t)){this.Er=N(e)?this.Or:e;var i=!1;if(sr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.kr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Cr(t),this.save())}update_campaign_params(){if(!this.mr){var t=Qr(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);L(ur(t))||this.register(t),this.mr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?ts(t):{})}update_referrer_info(){var t;this.register_once({$referrer:rs(),$referring_domain:null!=r&&r.referrer&&(null==(t=Hr(r.referrer))?void 0:t.host)||is},void 0)}set_initial_person_info(){this.props[Di]||this.props[ji]||this.register_once({[Li]:ss(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};sr([ji,Di],(e=>{var i=this.props[e];i&&sr(i,(function(e,i){t["$initial_"+C(i)]=e}))}));var e,i,r=this.props[Li];if(r){var s=(e=ns(r),i={},sr(e,(function(t,e){i["$initial_"+C(e)]=t})),i);nr(t,s)}return t}safe_merge(t){return sr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.Or=this.Er=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.br(t),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(t){this.wr=t,this.wr?this.remove():this.save()}set_cross_subdomain(t){t!==this.Mr&&(this.Mr=t,this.remove(),this.save())}set_secure(t){t!==this.Rr&&(this.Rr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[Ze]||{};i[t]=e,this.kr(Ze,i),this.save()}remove_event_timer(t){var e=this.props[Ze]||{},i=e[t];return N(i)||(delete e[t],this.kr(Ze,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.kr(t,e),this.save()}kr(t,e){this.props[t]=e}Cr(t){delete this.props[t]}}var hs="events",ds="cancelEvents",vs="survey shown",cs="survey sent",fs="popover",ps=Ge("[RateLimiter]");class gs{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{ps.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void ps.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Ai))&&void 0!==e?e:{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;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Ai,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()t(this.remoteConfig))):t()}Fr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return _s.info("Using preloaded remote config",this.remoteConfig),this.Ar(this.remoteConfig),void this.Nr();if(this._instance.Dr())return void _s.warn("Remote config is disabled. Falling back to local config.");this.Lr((t=>{if(!t)return _s.info("No config found after loading remote JS config. Falling back to JSON."),void this.Fr((t=>{this.Ar(t),this.Nr()}));this.Ar(t),this.Nr()}))}catch(t){_s.error("Error loading remote config",t)}}stop(){this.$r&&(clearInterval(this.$r),this.$r=void 0)}refresh(){!this._instance.Dr()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.$r){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.$r=setInterval((()=>{this.refresh()}),e))}}Ar(t){var e;t||_s.error("Failed to fetch remote config from PostHog."),this._instance.Ar(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var bs="gzip-js",ys="base64",ws=Uint8Array,xs=Uint16Array,Es=Uint32Array,Ss=new ws([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]),$s=new ws([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]),ks=new ws([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ps=function(t,e){for(var i=new xs(31),r=0;31>r;++r)i[r]=e+=1<r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Ts=Ps(Ss,2),Rs=Ts[1];Ts[0][28]=258,Rs[258]=28;for(var Is=Ps($s,0)[1],Cs=new xs(32768),Fs=0;32768>Fs;++Fs){var Os=(43690&Fs)>>>1|(21845&Fs)<<1;Cs[Fs]=((65280&(Os=(61680&(Os=(52428&Os)>>>2|(13107&Os)<<2))>>>4|(3855&Os)<<4))>>>8|(255&Os)<<8)>>>1}var Ms=function(t,e,i){for(var r=t.length,s=0,n=new xs(e);r>s;++s)++n[t[s]-1];var o,a=new xs(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new xs(1<s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<=d;++d)o[Cs[d]>>>l]=u}else for(o=new xs(r),s=0;r>s;++s)o[s]=Cs[a[t[s]-1]++]>>>15-t[s];return o},As=new ws(288);for(Fs=0;144>Fs;++Fs)As[Fs]=8;for(Fs=144;256>Fs;++Fs)As[Fs]=9;for(Fs=256;280>Fs;++Fs)As[Fs]=7;for(Fs=280;288>Fs;++Fs)As[Fs]=8;var Ds=new ws(32);for(Fs=0;32>Fs;++Fs)Ds[Fs]=5;var js=Ms(As,9,0),Ls=Ms(Ds,5,0),Ns=function(t){return(t/8>>0)+(7&t&&1)},zs=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof xs?xs:t instanceof Es?Es:ws)(i-e);return r.set(t.subarray(e,i)),r},Us=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Bs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Hs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new ws(0),0];if(1==s){var o=new ws(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new xs(v+1),f=qs(i[h-1],c,0);if(f>e){r=0;var p=0,g=f-e,_=1<r;++r){var m=n[r].s;if(e>=c[m])break;p+=_-(1<>>=g;p>0;){var b=n[r].s;e>c[b]?p-=1<=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}f=e}return[new ws(c),f]},qs=function(t,e,i){return-1==t.s?Math.max(qs(t.l,e,i+1),qs(t.r,e,i+1)):e[t.s]=i},Vs=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new xs(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++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=t[a]}return[i.subarray(0,r),e]},Ws=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Gs=function(t,e,i){var r=i.length,s=Ns(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Js=function(t,e,i,r,s,n,o,a,l,u,h){Us(e,h++,i),++s[256];for(var d=Hs(s,15),v=d[0],c=d[1],f=Hs(n,15),p=f[0],g=f[1],_=Vs(v),m=_[0],b=_[1],y=Vs(p),w=y[0],x=y[1],E=new xs(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=Hs(E,7),P=k[0],T=k[1],R=19;R>4&&!P[ks[R-1]];--R);var I,C,F,O,M=u+5<<3,A=Ws(s,As)+Ws(n,Ds)+o,D=Ws(s,v)+Ws(n,p)+o+14+3*R+Ws(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(A>=M&&D>=M)return Gs(e,h,t.subarray(l,l+u));if(Us(e,h,1+(A>D)),h+=2,A>D){I=Ms(v,c,0),C=v,F=Ms(p,g,0),O=p;var j=Ms(P,T,0);for(Us(e,h,b-257),Us(e,h+5,x-1),Us(e,h+10,R-4),h+=14,S=0;R>S;++S)Us(e,h+3*S,P[ks[S]]);h+=3*R;for(var L=[m,w],N=0;2>N;++N){var z=L[N];for(S=0;z.length>S;++S)Us(e,h,j[U=31&z[S]]),h+=P[U],U>15&&(Us(e,h,z[S]>>>5&127),h+=z[S]>>>12)}}else I=js,C=As,F=Ls,O=Ds;for(S=0;a>S;++S)if(r[S]>255){var U;Bs(e,h,I[257+(U=r[S]>>>18&31)]),h+=C[U+257],U>7&&(Us(e,h,r[S]>>>23&31),h+=Ss[U]);var B=31&r[S];Bs(e,h,F[B]),h+=O[B],B>3&&(Bs(e,h,r[S]>>>5&8191),h+=$s[B])}else Bs(e,h,I[r[S]]),h+=C[r[S]];return Bs(e,h,I[256]),h+C[256]},Ks=new Es([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ys=function(){for(var t=new Es(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Xs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Qs(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Ys[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new ws(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Gs(l,u,t.subarray(h,d)):(l[h]=!0,u=Gs(l,u,t.subarray(h,o)))}else{for(var v=Ks[e-1],c=v>>>13,f=8191&v,p=(1<h;++h){var I=y(h),C=32767&h,F=_[I];if(g[C]=F,_[I]=C,h>=T){var O=o-h;if((S>7e3||P>24576)&&O>423){u=Js(t,l,0,w,x,E,k,P,R,h-R,u),P=S=k=0,R=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&I==y(h-L))for(var N=Math.min(c,O)-1,z=Math.min(32767,h),U=Math.min(258,O);z>=L&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var B=0;U>B&&t[h+B]==t[h+B-L];++B);if(B>A){if(A=B,D=L,B>N)break;var H=Math.min(L,B-2),q=0;for(M=0;H>M;++M){var V=h-L+M+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,F=V)}}}L+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Rs[A]<<18|Is[D];var G=31&Rs[A],J=31&Is[D];k+=Ss[G]+$s[J],++x[257+G],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=Js(t,l,!0,w,x,E,k,P,R,h-R,u)}return zs(a,0,r+Ns(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Xs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),Xs(u,h-8,i.d()),Xs(u,h-4,r),u}var Zs=!!o||!!n,tn="text/plain",en=!1,rn=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},sn=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=p({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return sr(t,(function(t,e){N(t)||N(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return l&&a.push(l),s+"?"+a.join("&")},nn=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),on=t=>{if(t.tr)return t.tr;var{data:e,compression:i}=t;if(e){if(i===bs){var r=Qs(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ws(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new ws(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.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 zs(r,0,s)}(nn(e)),{mtime:0});return{contentType:tn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ys){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(nn(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:nn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=nn(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},an=t=>{var e,i,r,s=on(t);return!s||(i=t.compression,r=qr(t.url,"compression"),i!==m.GZipJS&&r!==m.GZipJS&&"gzip"!==r)||((e=s.body)instanceof ArrayBuffer?w(new Uint8Array(e)):ArrayBuffer.isView(e)&&w(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:s}:(en=!0,{url:rn(t.url,"compression"),encodedBody:on(p({},t,{compression:void 0,tr:void 0}))})},ln=function(){var t=f((function*(t){var e=nn(t.data),i=yield function(t,e,i){return k.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{tr:{contentType:tn,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),un=(t,e)=>sn(t,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:e}),hn=[];n&&hn.push({transport:"fetch",method(t){var e,{url:i,encodedBody:r}=an(t),{contentType:s,body:o,estimatedSize:l}=null!=r?r:{},u=new Headers;sr(t.headers,(function(t,e){u.append(e,t)})),s&&u.append("Content-Type",s);var h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(l||0),body:o,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){We.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{We.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&hn.push({transport:"XHR",method(t){var e=new o,{url:i,encodedBody:r}=an(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};sr(t.headers,(function(t,i){e.setRequestHeader(i,t)})),s&&e.setRequestHeader("Content-Type",s),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(n)}}),null!=i&&i.sendBeacon&&hn.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:r}=an(t),s=sn(e,{beacon:"1"}),{contentType:n,body:o}=null!=r?r:{};if(!o)return;var a=o instanceof Blob?o:new Blob([o],{type:n});i.sendBeacon(s,a)}catch(t){}}});var dn=3e3;class vn{constructor(t,e){this.qr=!0,this.jr=[],this.Hr=et((null==e?void 0:e.flush_interval_ms)||dn,250,5e3,We.createLogger("flush interval"),dn),this.Ur=t}enqueue(t){this.jr.push(t),this.Br||this.zr()}unload(){this.Vr();var t=this.jr.length>0?this.Wr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ur(p({},t,{transport:"sendBeacon"}))}))}enable(){this.qr=!1,this.zr()}zr(){var t=this;this.qr||(this.Br=setTimeout((()=>{if(this.Vr(),this.jr.length>0){var e=this.Wr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&A(i.data)&&sr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ur(i)};for(var r in e)i()}}),this.Hr))}Vr(){clearTimeout(this.Br),this.Br=void 0}Wr(){var t={};return sr(this.jr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;N(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.jr=[],t}}var cn=["retriesPerformedSoFar"];class fn{constructor(e){this.Zr=!1,this.Gr=3e3,this.jr=[],this._instance=e,this.jr=[],this.Qr=!0,!N(t)&&"onLine"in t.navigator&&(this.Qr=t.navigator.onLine,this.Jr=()=>{this.Qr=!0,this.Kr()},this.Yr=()=>{this.Qr=!1},vr(t,"online",this.Jr),vr(t,"offline",this.Yr))}get length(){return this.jr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=g(t,cn);V(e)&&(i.url=sn(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==i.callback||i.callback(t):this.Xr(p({retriesPerformedSoFar:e},i))}}))}Xr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.jr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),We.warn(s),this.Zr||(this.Zr=!0,this.ei())}ei(){if(this.ti&&clearTimeout(this.ti),0===this.jr.length)return this.Zr=!1,void(this.ti=void 0);this.ti=setTimeout((()=>{this.Qr&&this.jr.length>0&&this.Kr(),this.ei()}),this.Gr)}Kr(){var t=Date.now(),e=[],i=this.jr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.jr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.ti&&(clearTimeout(this.ti),this.ti=void 0),this.Zr=!1,N(t)||(this.Jr&&(t.removeEventListener("online",this.Jr),this.Jr=void 0),this.Yr&&(t.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.jr))try{this._instance._send_request(p({},e,{transport:"sendBeacon"}))}catch(t){We.error(t)}this.jr=[]}}class pn{constructor(t){this.ri=()=>{var t,e,i,r;this.ii||(this.ii={});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.ii.lastScrollY=Math.ceil(n),this.ii.maxScrollY=Math.max(n,null!==(t=this.ii.maxScrollY)&&void 0!==t?t:0),this.ii.maxScrollHeight=Math.max(o,null!==(e=this.ii.maxScrollHeight)&&void 0!==e?e:0),this.ii.lastContentY=a,this.ii.maxContentY=Math.max(a,null!==(i=this.ii.maxContentY)&&void 0!==i?i:0),this.ii.maxContentHeight=Math.max(l,null!==(r=this.ii.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ni(){return this._instance.config.scroll_root_selector}getContext(){return this.ii}resetContext(){var t=this.ii;return setTimeout(this.ri,0),t}startMeasuringScrollPosition(){vr(t,"scroll",this.ri,{capture:!0}),vr(t,"scrollend",this.ri,{capture:!0}),vr(t,"resize",this.ri)}scrollElement(){if(!this.ni)return null==t?void 0:t.document.documentElement;var e=A(this.ni)?this.ni:[this.ni];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}scrollY(){if(this.ni){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.ni){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var gn=t=>ss(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class _n{constructor(t,e,i,r){this.si=t=>{var e=this.oi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ai(this._instance)};this.ui.register({[Mi]:i})}},this._instance=t,this.li=e,this.ui=i,this.ai=r||gn,this.li.onSessionId(this.si)}oi(){return this.ui.props[Mi]}getSetOnceProps(){var t,e=null==(t=this.oi())?void 0:t.props;return e?"r"in e?ns(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return sr(ur(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+C(i)]=e})),t}}class mn{constructor(){this.hi={}}on(t,e){return this.hi[t]||(this.hi[t]=[]),this.hi[t].push(e),()=>{this.hi[t]=this.hi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.hi[t]||[])i(e);for(var r of this.hi["*"]||[])r(t,e)}}var bn=Ge("[SessionId]");class yn{on(t,e){return this.ci.on(t,e)}constructor(t,e,i){var r;if(this.di=null,this.vi=[],this.fi=void 0,this.ci=new mn,this.pi=(t,e)=>!(!V(t)||!V(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Gi)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=t.config,this.ui=t.persistence,this.gi=void 0,this.mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.yi=e||br,this.bi=i||br;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*et(this.qt.session_idle_timeout_seconds||1800,60,36e3,bn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.wi(),this.xi="ph_"+s+"_window_id",this.Si="ph_"+s+"_primary_window_exists",this.ki()){var n=Ir.F(this.xi),o=Ir.F(this.Si);n&&!o?this.gi=n:Ir.q(this.xi),Ir.N(this.Si,!0)}if(null!=(r=this.qt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.qt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.Ci(this.qt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){bn.error("Invalid sessionID in bootstrap",t)}this.Ii()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return N(this.vi)&&(this.vi=[]),this.vi.push(t),this.mi&&t(this.mi,this.gi),()=>{this.vi=this.vi.filter((e=>e!==t))}}ki(){return"memory"!==this.qt.persistence&&!this.ui.wr&&Ir.O()}Ti(t){t!==this.gi&&(this.gi=t,this.ki()&&Ir.N(this.xi,t))}Ei(){return this.gi?this.gi:this.ki()?Ir.F(this.xi):null}Mi(t){var e=this.di;return!B(e)&&!B(t)&&5e3>Math.abs(t-e)}Ci(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.mi=t,s&&!r||s&&this.Mi(e)||(this.di=e,this.ui.register({[fi]:[e,t,i]}))}Ri(){var t,e=null==(t=this.qt)?void 0:t.persistence_save_debounce_ms;return V(e)&&e>0}Pi(){var t;if(!B(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.di){this.Ri()?this.ui.refreshKey(fi):(this.ui.flush(),this.ui.load());var[,e,i]=this.Oi();e===this.mi&&i===this._sessionStartTimestamp&&(this.di=this._sessionActivityTimestamp,this.ui.register({[fi]:[this._sessionActivityTimestamp,null!==(t=this.mi)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.ui.flush())}}Li(){var[t]=this.Oi(),e=V(t)?t:0,i=V(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Oi(){var t=this.ui.props[fi];return A(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.di=null,clearTimeout(this.Fi),this.Fi=void 0,this.Ci(null,null,null)}destroy(){this.Pi(),clearTimeout(this.Fi),this.Fi=void 0,this.fi&&t&&(t.removeEventListener(Qi,this.fi,{capture:!1}),this.fi=void 0),this.vi=[]}Ii(){this.fi=()=>{this.Pi(),this.ki()&&Ir.q(this.Si)},vr(t,Qi,this.fi,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.qt.cookieless_mode===Gi)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.Oi(),n=this.Li(),o=this.Ei(),a=V(s)&&Math.abs(i-s)>864e5,l=!1,u=!r,h=!u&&!t&&this.pi(i,n);u||h||a?(r=this.yi(),o=this.bi(),bn.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),s=i,l=!0):o||(o=this.bi(),l=!0);var d=V(n)&&t&&!a?n:i,v=V(s)?s:(new Date).getTime();return this.Ti(o),this.Ci(r,d,v),t||this.wi(),l&&this.vi.forEach((t=>t(r,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:n}}wi(){clearTimeout(this.Fi),this.Fi=setTimeout((()=>{var t=this.Li();if(this.pi((new Date).getTime(),t)){var e=this.mi;this.resetSessionId(),this.ci.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}var wn=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&T(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>T(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},xn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function En(t,e,i){return nn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Sn={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>xn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!xn(e,t))))),icontains:(t,e)=>e.map($n).some((e=>t.map($n).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map($n).every((e=>t.map($n).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>it.toLowerCase();function kn(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(N(s)||B(s))return!1;var n=[String(s)],o=Sn[r.operator];return!!o&&o(r.values,n)}))}var Pn="custom",Tn="i.posthog.com",Rn=/^\/static\//;class In{constructor(t){this.Ai={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Tn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Ai[this.apiHost]||(this.Ai[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":Pn),this.Ai[this.apiHost]}Ni(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&Rn.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.Ni(e);if(i)return""+i+e}if(this.region===Pn)return this.apiHost+e;var r=Tn+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Cn=Ge("[Surveys]"),Fn="seenSurvey_",On=["popover","widget","api"],Mn={ignoreConditions:!1,ignoreDelay:!1,displayType:fs},An=Ge("[PostHog ExternalIntegrations]"),Dn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class jn{constructor(t){this._instance=t}lr(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return An.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.lr(Dn[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Ln,Nn={},zn=0,Un=()=>{},Bn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Hn="Surveys module not available",qn="sanitize_properties is deprecated. Use before_send instead",Vn="Invalid value for property_denylist config: ",Wn="posthog",Gn=!Zs&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Jn=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:dr(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Un,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:s&&z(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,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.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(t){We.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Yi,before_send:void 0,request_queue_config:{flush_interval_ms:dn},error_tracking:{},_onCapture:Un,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0}))(e))},Kn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Yn=t=>{var e={};for(var[i,r]of Kn)N(t[i])||(e[r]=t[i]);var s=nr({},e,t);return A(t.property_blacklist)&&(N(t.property_denylist)?s.property_denylist=t.property_blacklist:A(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:We.error(Vn+t.property_denylist)),s};class Xn{constructor(){this.__forceAllowLocalhost=!1}get Di(){return this.__forceAllowLocalhost}set Di(t){We.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Qn{$i(t,e){if(t){var i=this.qi.indexOf(t);-1!==i&&this.qi.splice(i,1)}return this.qi.push(e),null==e.initialize||e.initialize(),e}ji(){return this.config.cookieless_mode===Gi||this.config.cookieless_mode===Wi&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Xn,this.Hi=!1,this.version=v.LIB_VERSION,this.Ui=new mn,this.qi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Jn(),this.SentryIntegration=Nr,this.sentryIntegration=t=>function(t,e){var i=Lr(t,e);return{name:jr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Bi=!1,this.zi=null,this.Vi=null,this.Wi=null,this.scrollManager=new pn(this),this.pageViewManager=new zr(this),this.rateLimiter=new gs(this),this.requestRouter=new In(this),this.consent=new Cr(this),this.externalIntegrations=new jn(this);var e=null!==(t=Qn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=z(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=z(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>We.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Wn){var r,s=null!==(r=Nn[i])&&void 0!==r?r:new Qn;return s._init(t,e,i),Nn[i]=s,Nn[Wn][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o=z(e)?e.trim():"";if(!o)return We.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},i.debug=this.Zi(i.debug),this.Gi=i,this.Qi=[],i.person_profiles?this.Vi=i.person_profiles:i.process_person&&(this.Vi=i.process_person),this.set_config(nr({},Jn(i.defaults),Yn(i),{name:r,token:o})),this.config.on_xhr_error&&We.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:bs;var a=this.Ji();this.persistence=new us(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new us(p({},this.config,{persistence:"sessionStorage"}),a);var l=p({},this.persistence.props),u=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ki=new vn((t=>this.Yi(t)),this.config.request_queue_config),this.Xi=new fn(this),this.__request_queue=[];var h=this.ji();if(h||(this.sessionManager=new yn(this),this.sessionPropsManager=new _n(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(We.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.en(h)}),0)):(We.info("Initializing extensions synchronously"),this.en(h)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&We.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var d=i.bootstrap.distinctID,c=this.get_distinct_id(),f=this.persistence.get_property(Oi);if(i.bootstrap.isIdentifiedID&&null!=c&&c!==d&&f===Ji)this.identify(d);else if(i.bootstrap.isIdentifiedID&&null!=c&&c!==d&&f===Ki)We.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 g=this.config.get_device_id(br()),_=i.bootstrap.isIdentifiedID?g:d;this.persistence.set_property(Oi,i.bootstrap.isIdentifiedID?Ki:Ji),this.register({distinct_id:d,$device_id:_})}}if(h)this.register_once({distinct_id:Ui,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(br());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(Oi,Ji)}return vr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||br();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Oi,Ki)),e()},s=i.user();"then"in s&&D(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||Dr.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Dr.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Dr.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,Zi),identify:t=>e(t,er),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.tn())):this.tn(),D(this.config._onCapture)&&this.config._onCapture!==Un&&(We.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&We.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}en(t){var e,i,r,s,n,o,a,l=performance.now(),u=p({},Qn.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.qi.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new u.featureFlags(this)),u.exceptions&&this.qi.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.qi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.qi.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.qi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.qi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.qi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.qi.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.qi.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.qi.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.qi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.qi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.qi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.qi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.qi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Mr)),u.toolbar&&this.qi.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.qi.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.qi.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.rn){var t=this.rn;this.rn=void 0,this.Ar(t)}})),this.nn(h,l)}nn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.nn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){We.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Bi]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Hi]:r}),this.config.__preview_deferred_init_extensions&&We.info("PostHog extensions initialized ("+r+"ms)")}Ar(t){var e;if(!r||!r.body)return We.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ar(t)}),500);this.config.__preview_deferred_init_extensions&&(this.rn=t),this.sn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=R(t.supportedCompression,bs)?bs:R(t.supportedCompression,ys)?ys:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Vi?this.Vi:Yi}),this.qi.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}tn(){try{this.config.loaded(this)}catch(t){We.critical("`loaded` function failed",t)}if(this.an(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.ji())&&this.un()}),1),this.ln=new ms(this),this.ln.load()}an(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ki)||t.enable())}_dom_loaded(){this.is_capturing()&&rr(this.__request_queue,(t=>this.Yi(t))),this.__request_queue=[],this.an()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.hn()&&this.capture(tr),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.Ki)||i.unload(),null==(r=this.Xi)||r.unload()):this.hn()&&this.capture(tr,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Gn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=sn(t.url,{ip:this.config.ip?1:0}),t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=un(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=hn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===bs&&l&&!en?ln(s).then((t=>{a(t)})).catch((e=>{if(x(e))return en=!0,void a(p({},s,{compression:void 0,url:un(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return x(t)||e===y})(e)&&(en=!0),a(s)})):a(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Yi(t){this.Xi?this.Xi.retriableRequest(t):this._send_request(t)}_execute_array(t){zn++;try{var e,i=[],r=[],s=[];rr(t,(t=>{if(t)if(A(e=t[0]))s.push(t);else if(D(t))try{t.call(this)}catch(e){We.error("Error executing queued PostHog call",t,e)}else A(t)&&"alias"===e?i.push(t):A(t)&&-1!==e.indexOf("capture")&&D(this[e])?s.push(t):r.push(t)}));var n=function(t,e){rr(t,(function(t){try{if(A(t[0])){var i=e;sr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){We.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{zn--}}push(t){if(zn>0&&A(t)&&z(t[0])){var e=Qn.prototype[t[0]];D(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ki){if(this.is_capturing())if(!N(t)&&z(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!z(null==e?void 0:e.$current_url)&&(We.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.cn||We.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==i?void 0:i.timestamp)||h,v=(null==i?void 0:i.uuid)||br(),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Zi&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var f,g,_,m=this.dn(null==i?void 0:i.$set_once,t!==ir,t===er);if(m&&(c.$set_once=m),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>z(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),A(e)?(r=[],rr(e,(e=>{r.push(t(e))}))):(r={},sr(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),c.timestamp=d,N(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),"survey dismissed"===t||t===cs){var b=null==e?void 0:e.$survey_id,y=null==e?void 0:e.$survey_iteration;(t=>{try{var e=(t=>((t,e)=>{var i=""+t+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+t+e.id+"_"+e.current_iteration),i})(Fn,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Cn.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:y}),c.$set=p({},c.$set,{[(f={id:b,current_iteration:y},g=t===cs?"responded":"dismissed",_="$survey_"+g+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(_="$survey_"+g+"/"+f.id+"/"+f.current_iteration),_)]:!0})}else t===vs&&(c.$set=p({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var w=null==e?void 0:e.$product_tour_type;w&&(c.$set=p({},c.$set,{["$product_tour_last_seen_date/"+w]:(new Date).toISOString()}))}var x=p({},c.properties.$set,c.$set);if(L(x)||this.setPersonPropertiesForFlags(x),!H(this.config.before_send)){var E=this.vn(c);if(!E)return;c=E}this.Ui.emit("eventCaptured",c);var S={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Yi(S):this.Ki.enqueue(S),c}We.critical("This capture call is ignored due to client rate limiting.")}}else We.error("No event name provided to posthog.capture")}else We.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.ji()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!z(h.distinct_id)&&!q(h.distinct_id)||U(h.distinct_id))&&We.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,f=function(e,i){var r,n,o,a;if(!u)return{};var l,h,d,c,f,p,g,_,m,b=e?[...Jr,...i||[]]:[],[y,w]=function(t){for(var e=0;ae.length>e;e++){var[i,r]=ae[e],s=i.exec(t),n=s&&(D(r)?r(s,t):r);if(n)return n}return["",""]}(u),x=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},E=nr(ur({$os:y,$os_version:w,$browser:se(u,navigator.vendor,x),$device:le(u),$device_type:(d=u,c={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},m=le(d),m===dt||m===ht||"Kobo"===m||"Kindle Fire"===m||m===Ut?ut:m===It||m===Ft||m===Ct||m===Lt?"Console":m===ct?"Wearable":m?ot:"Android"===(null==c?void 0:c.userAgentDataPlatform)&&(null!==(f=null==c?void 0:c.maxTouchPoints)&&void 0!==f?f:0)>0?600>Math.min(null!==(p=null==c?void 0:c.screenWidth)&&void 0!==p?p:0,null!==(g=null==c?void 0:c.screenHeight)&&void 0!==g?g:0)/(null!==(_=null==c?void 0:c.devicePixelRatio)&&void 0!==_?_:1)?ot:ut:"Desktop"),$timezone:os(),$timezone_offset:as()}),{$current_url:Vr(null==s?void 0:s.href,b,Yr),$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:oe(u,navigator.vendor,x),$browser_language:es(),$browser_language_prefix:(h=es(),"string"==typeof h?h.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=v.SDK_DIST_CHANNEL),E}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:g,windowId:_}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=g,h.$window_id=_}this.sessionPropsManager&&nr(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&nr(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Xi)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Pn&&(h.$lib_custom_api_host=this.config.api_host),c=e!==Zi||a?e!==tr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=nr(h,c),e===Zi&&r&&(h.title=r.title),!N(l)){var b=n.getTime()-l;h.$duration=parseFloat((b/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=nr({},f,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),A(this.config.property_denylist)?sr(this.config.property_denylist,(function(t){delete h[t]})):We.error(Vn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(We.error(qn),h=y(h,e));var w=this.fn();return h.$process_person_profile=w,w&&!a&&this.pn("_calculate_event_properties"),h}dn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.fn())return t;if(this.Hi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=nr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(We.error(qn),o=a(o,"$set_once")),e&&(this.Hi=!0),L(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}gn(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ui.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Hn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Hn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Hn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Mn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Hn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Hn})}mn(t){return!t||U(t)?(We.critical("Unique user id has not been set in posthog.identify"),!1):t===Ui?(We.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(We.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return We.uninitializedWarning("posthog.identify");if(q(t)&&(t=t.toString(),We.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.mn(t)&&this.pn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Xe)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Qe)&&(this.unregister(Qe),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Oi)||Ji)===Ji;t!==r&&n?(this.persistence.set_property(Oi,Ki),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(er,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Wi=En(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(Ri))}}setPersonProperties(t,e){if((t||e)&&this.pn("posthog.setPersonProperties")){var i=En(this.get_distinct_id(),t,e);this.Wi!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Wi=i):We.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(ir,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else We.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.pn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,l;if(We.info("reset"),!this.__loaded)return We.uninitializedWarning("posthog.reset");var u,h=this.get_property(Xe),d=this.get_property(ui);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),N(d)||null==(u=this.persistence)||u.register({[ui]:d}),null==(r=this.surveys)||r.reset(),null==(s=this.ln)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Oi,Ji),null==(l=this.sessionManager)||l.resetSessionId(),this.Wi=null,this.config.cookieless_mode===Gi)this.register_once({distinct_id:Ui,$device_id:null},"");else{var v=this.config.get_device_id(br());this.register_once({distinct_id:v,$device_id:t?v:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.yn()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.bn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(Ye)?(We.critical("Attempting to create alias for existing People user - aborting."),-2):this.pn("posthog.alias")?(N(e)&&(e=this.get_distinct_id()),t!==e?(this.gn(Qe,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(We.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(j(t)){var i,r,s,n,o,a,l,u,h,d,c;nr(this.config,Yn(t));var f=this.Ji();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new us(p({},this.config,{persistence:"sessionStorage"}),f);var g=this.Zi(this.config.debug);W(g)&&(this.config.debug=g),W(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,$r.O()&&$r.N("ph_debug",!0),We.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,$r.O()&&$r.q("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this._n(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Qn.wn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Wn;return e!==Wn&&(e=Wn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Oi))===Ki||(null==(e=this.sessionPersistence)?void 0:e.get_property(Oi))===Ki}fn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===Yi&&!this._isIdentified()&&L(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Qe])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ni]))}hn(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.fn()||this.pn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.pn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}pn(t){return"never"===this.config.person_profiles?(We.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gn(Ni,!0),!0)}Ji(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Wi)}_n(){var t,e,i,r,s=this.Ji();return(null==(t=this.persistence)?void 0:t.wr)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.wr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Gi){if(this.ji()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new yn(this),this.pageViewManager=new zr(this),this.persistence&&(this.sessionPropsManager=new _n(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Qn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.$i(this.sessionRecording,new l(this)),this.sn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.sn)))}var u,h;this.consent.optInOut(!0),this._n(),this.an(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Wi&&(null==(u=this.surveys)||u.loadIfEnabled()),(N(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.un()}else We.warn(Bn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Gi?(this.config.cookieless_mode===Wi&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._n(),this.config.cookieless_mode===Wi&&(this.register({distinct_id:Ui,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.un(),this.an())):We.warn(Bn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Gi||(this.config.cookieless_mode===Wi?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._n()}_is_bot(){return i?wn(i,this.config.custom_blocked_useragents):void 0}un(){r&&("visible"===r.visibilityState?this.Bi||(this.Bi=!0,this.capture(Zi,{title:r.title},{send_instantly:!0}),this.zi&&(r.removeEventListener(Xi,this.zi),this.zi=null)):this.zi||(this.zi=this.un.bind(this),vr(r,Xi,this.zi)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Dr(){var t,e,i,r,s,n,o=this.Gi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(We.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,r=We,s=(e="advanced_disable_flags")in(t=o)&&!H(t[e]),n=i in t&&!H(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}vn(t){if(H(this.config.before_send))return t;var e=A(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),H(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?We.warn(s+". This can cause unexpected behavior."):We.info(s),null}i.properties&&!L(i.properties)||We.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.dr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Zi(t){var e=W(t)&&!t,i=$r.O()&&"true"===$r.A("ph_debug");return!e&&(!!i||t)}}Qn.__defaultExtensionClasses={},Qn.wn={trace:Ln=()=>{},debug:Ln,info:Ln,warn:Ln,error:Ln,fatal:Ln},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=lr(t.prototype[e[i]])}(Qn,["identify"]);var Zn=1,to=3,eo=11;function io(t){return t instanceof Element&&(t.id===zi||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ro(t){return!!t&&t.nodeType===Zn}function so(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function no(t){return!!t&&t.nodeType===to}function oo(t){return!!t&&t.nodeType===eo&&ro(t.host)}function ao(t){return t?I(t).split(/\s+/):[]}function lo(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some((t=>i.match(t))))}function uo(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return ao(e)}function ho(t){return H(t)?null:I(t).split(/(\s+)/).filter((t=>Ro(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function vo(t){var e="";return wo(t)&&!xo(t)&&t.childNodes&&t.childNodes.length&&sr(t.childNodes,(function(t){var i;no(t)&&t.textContent&&(e+=null!==(i=ho(t.textContent))&&void 0!==i?i:"")})),I(e)}function co(t){return N(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var fo=["a","button","form","input","select","textarea","label"];function po(t,e){if(N(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function go(t){var e=t.parentNode;return!(!e||!ro(e))&&e}var _o=["next","previous","prev",">","<"],mo=[".ph-no-rageclick",".ph-no-capture"];var bo=t=>!t||so(t,"html")||!ro(t),yo=(e,i)=>{if(!t||bo(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!so(n,"body");)if(oo(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=go(n);if(!o)break;if(i||fo.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function wo(t){for(var e=t;e.parentNode&&!so(e,"body");e=e.parentNode){var i=uo(e);if(R(i,"ph-sensitive")||R(i,"ph-no-capture"))return!1}if(R(uo(t),"ph-include"))return!0;var r=t.type||"";if(z(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!z(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function xo(t){return!!(so(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||so(t,"select")||so(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Eo="(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})",So=new RegExp("^(?:"+Eo+")$"),$o=new RegExp(Eo),ko="\\d{3}-?\\d{2}-?\\d{4}",Po=new RegExp("^("+ko+")$"),To=new RegExp("("+ko+")");function Ro(t,e){if(void 0===e&&(e=!0),H(t))return!1;if(z(t)){if(t=I(t),(e?So:$o).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Po:To).test(t))return!1}return!0}function Io(t){var e=vo(t);return Ro(e=(e+" "+Co(t)).trim())?e:""}function Co(t){var e="";return t&&t.childNodes&&t.childNodes.length&&sr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=vo(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Co(t)).trim())}catch(t){We.error("[AutoCapture]",t)}})),e}function Fo(t){return t.replace(/"|\\"/g,'\\"')}function Oo(t){var e=t.attr__class;return e?A(e)?e:ao(e):void 0}class Mo{constructor(t){this.disabled=!1===t;var e=j(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var Ao="$copy_autocapture",Do=Ge("[AutoCapture]");function jo(t,e){return e.length>t?e.slice(0,t)+"...":e}function Lo(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!ro(e));return e}function No(e,i){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i;if(!ro(e))return{props:{}};for(var h=[e],d=e;d.parentNode&&!so(d,"body");)if(oo(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!ro(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var v,c,f=[],g={},_=!1,m=!1;if(sr(h,(t=>{var e=wo(t);if(so(t,"a")){var i=t.getAttribute("href");_=e&&!!i&&Ro(i)&&i}R(uo(t),"ph-no-capture")&&(m=!0),f.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};fo.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?jo(1024,Io(t)):jo(1024,vo(t)));var o=uo(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),sr(t.attributes,(function(i){var s;if((!xo(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Ro(i.value)&&(!z(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=ao(o).join(" ")),n["attr__"+i.name]=jo(1024,o)}}));for(var a=1,l=1,u=t;u=Lo(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var r=function(t){if(!wo(t))return{};var e={};return sr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Ro(r)&&(e[i]=r)}})),e}(t);nr(g,r)})),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text=so(e,"a")||so(e,"button")?Io(e):vo(e)),_){var b,y;f[0].attr__href=_;var w=null==(b=Hr(_))?void 0:b.host,x=null==t||null==(y=t.location)?void 0:y.host;w&&x&&w!==x&&(v=_)}return{props:nr({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(c=f,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=p({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return or(n).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Fo(e.toString())]=Fo(i.toString())})),(r+=":")+or(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Oo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return or(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(c)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},g)}}var zo=Ge("[ExceptionAutocapture]");function Uo(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return D(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]===s&&(t[e]=r)}}catch(t){return()=>{}}}var Bo=Ge("[TracingHeaders]"),Ho=Ge("[Web Vitals]"),qo=9e5,Vo="disabled",Wo="lazy_loading",Go="awaiting_config",Jo="missing_config";Ge("[SessionRecording]"),Ge("[SessionRecording]");var Ko="[SessionRecording]",Yo=Ge(Ko),Xo=Ge("[Heatmaps]");function Qo(t){return j(t)&&"clientX"in t&&"clientY"in t&&q(t.clientX)&&q(t.clientY)}var Zo=Ge("[Product Tours]"),ta=["$set_once","$set"],ea=Ge("[SiteApps]"),ia="Error while initializing PostHog app with config id ";function ra(t,e,i){if(H(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class sa{constructor(t){this.xn=new mn,this.Sn=(t,e)=>this.kn(t,e)&&this.Cn(t,e)&&this.In(t,e)&&this.Tn(t,e),this.kn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.En=new Set,this.Mn=new Set}init(){var t,e;N(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!N(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.Mn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.En)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.En.has(t)||this.En.has(null==e?void 0:e.event))&&this.Mn&&(null==(i=this.Mn)?void 0:i.size)>0&&this.Mn.forEach((t=>{this.Rn(e,t)&&this.xn.emit("actionCaptured",t.name)}))}Pn(t){this.onAction("actionCaptured",(e=>t(e)))}Rn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Sn(t,i))return!0;return!1}onAction(t,e){return this.xn.on(t,e)}Cn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!ra(r,e.url,e.url_matching||"contains"))return!1}return!0}In(t,e){return!!this.On(t,e)&&!!this.Ln(t,e)&&!!this.Fn(t,e)}On(t,e){var i;if(null==e||!e.href)return!0;var r=this.An(t);if(r.length>0)return r.some((t=>ra(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&ra((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Ln(t,e){var i;if(null==e||!e.text)return!0;var r=this.An(t);if(r.length>0)return r.some((t=>ra(t.text,e.text,e.text_matching||"exact")||ra(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!H(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>ra(t,n,o))))}Fn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}An(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Tn(t,e){return null==e||!e.properties||0===e.properties.length||kn(e.properties.reduce(((t,e)=>{var i=A(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class na{constructor(t){this._instance=t,this.Nn=new Map,this.Dn=new Map,this.$n=new Map}qn(t,e){return!!t&&kn(t.propertyFilters,null==e?void 0:e.properties)}jn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Hn(t,e,i){var r=(i===hs?this.Nn:this.Dn).get(t),s=[];return this.Un((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.qn(n,e)}))}register(t){var e;N(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Bn(t),this.zn(t))}zn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Vn&&(this.Vn=new sa(this._instance),this.Vn.init(),this.Vn.Pn((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Vn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.$n.get(e.name);i&&i.push(t.id),this.$n.set(e.name,i||[t.id])}})))})))}Bn(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.Nn=this.jn(t,hs),this.Dn=this.jn(t,ds))}onEvent(t,e){var i,r=this.le(),s=this.Wn(),n=this.Zn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:o});var u=(null==e||null==(a=e.properties)?void 0:a.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.Gn(o))}}else{if(this.Dn.has(t)){var d=this.Hn(t,e,ds);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var e=o.indexOf(t.id);0>e||o.splice(e,1),this.Qn(t.id)})),this.Gn(o))}if(this.Nn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.Nn.get(t)});var v=this.Hn(t,e,hs);this.Gn(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Wn(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.$n.has(t)&&this.Gn(r.concat(this.$n.get(t)||[]))}Gn(t){var e=this.le(),i=[...new Set(t)].filter((t=>!this.Jn(t)));e.info("updating activated items",{activatedItems:i}),this.Kn(i)}getActivatedIds(){var t,e=this.Wn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.Nn}Yn(){return this.Vn}}class oa extends na{constructor(t){super(t)}Wn(){return Pi}Zn(){return vs}Un(t){var e;null==(e=this._instance)||e.getSurveys(t)}Qn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}le(){return Cn}Kn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[Pi]:t})}Jn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var aa="SDK is not enabled or survey functionality is not yet loaded",la="Disabled. Not loading surveys.",ua=null!=t&&t.location?Wr(t.location.hash,"__posthog")||Wr(location.hash,"state"):null,ha="_postHogToolbarParams",da=Ge("[Toolbar]"),va=Ge("[FeatureFlags]"),ca=Ge("[FeatureFlags]",{debugEnabled:!0}),fa="\" failed. Feature flags didn't load in time.",pa=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},ga=t=>{var e={};for(var[i,r]of or(t||{}))r&&(e[i]=r);return e},_a=Ge("[Error tracking]"),ma="Refusing to render web experiment since the viewer is a likely bot",ba={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&xn(i.href,e),not_regex:(e,i)=>!!t&&!xn(i.href,e),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class ya{get qt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{ya.Xn("retrieved web experiments from the server"),e.es=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.es&&(ya.Xn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.es)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);z(r)&&t.variants[r]&&e.ts(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];ya.rs(n)&&e.ts(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())ya.Xn(ma);else if(!this.qt.disable_web_experiments){if(H(this.es))return this.es=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ya.Xn("applying feature flags",t),t.forEach((t=>{var e;if(this.es&&null!=(e=this.es)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.es)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.ts(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=ya.getWindowLocation();if(null!=t&&t.search){var e=qr(null==t?void 0:t.search,"__experiment_id"),i=qr(null==t?void 0:t.search,"__experiment_variant");e&&i&&(ya.Xn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.ns(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.qt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}ns(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(ya.Xn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.ts(r[0].name,e,r[0].variants[e].transforms))}static rs(t){return!H(t.conditions)&&ya.ss(t)&&ya.os(t)}static ss(t){var e;if(H(t.conditions)||H(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=ya.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||ba[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static os(t){var e;if(H(t.conditions)||H(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Qr();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&f&&v}return!1}static Xn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];We.info("[WebExperiments] "+t,i)}ts(t,e,i){this._is_bot()?ya.Xn(ma):"control"!==e?i.forEach((i=>{if(i.selector){var r;ya.Xn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):ya.Xn("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?wn(i,this.qt.custom_blocked_useragents):void 0}}var wa=Ge("[Conversations]"),xa="Conversations not available yet.",Ea={featureFlags:class{constructor(t){this.us=!1,this.ls=!1,this.hs=!1,this.cs=!1,this.ds=!1,this.vs=!1,this.fs=!1,this.ps=!1,this._instance=t,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ui(){return this._instance.persistence}gs(t){return this._instance.get_property(t)}ys(){var t,e;return null!==(t=null==(e=this.ui)?void 0:e.Sr(this.qt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}bs(){return!!this.ys()&&(this.ps||this.hs||(this.ps=!0,va.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_s(){var t,e=null!==(t=this.qt.evaluation_contexts)&&void 0!==t?t:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.fs||(va.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||va.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}ws(){return this._s().length>0}xs(){var t=this.qt.flag_keys;if(!N(t)){if(A(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||va.error("Invalid flag key found:",t,"Expected non-empty string"),e}));va.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,i){var r=null!=i&&i.merge?this.getFlagVariants():{},s=null!=i&&i.merge?this.getFlagPayloads():{},n=p({},r,t),o=p({},s,e),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:N(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.gs(bi),e=this.gs(xi),i=this.gs(Ei);if(!i&&!e)return t||{};var r=nr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=N(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=N(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=p({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=p({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.us||(va.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.us=!0),r}getFlagVariants(){var t=this.gs(gi),e=this.gs(xi);if(!e)return t||{};for(var i=nr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.us||(va.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.us=!0),i}getFlagPayloads(){var t=this.gs(yi),e=this.gs(Ei);if(!e)return t||{};for(var i=nr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.us||(va.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.us=!0),i}reloadFeatureFlags(){this.cs||this.qt.advanced_disable_feature_flags||this.Ss||(this._instance.Ui.emit("featureFlagsReloading",!0),this.Ss=setTimeout((()=>{this.ks()}),5))}Cs(){clearTimeout(this.Ss),this.Ss=void 0}ensureFlagsLoaded(){this.ls||this.hs||this.Ss||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.cs=t}ks(t){var e;if(this.Cs(),!this._instance.Dr())if(this.hs)this.ds=!0;else{var i=this.qt.token,r=this.gs(Xe),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:p({},(null==(e=this.ui)?void 0:e.get_initial_props())||{},this.gs(Si)||{}),group_properties:this.gs($i),timezone:os()};B(r)||N(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.ws()&&(s.evaluation_contexts=this._s());var n=this.xs();N(n)||(s.flag_keys=n);var o=!!this.qt.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.hs=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.qt.disable_compression?void 0:ys,timeout:this.qt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=!0;if(200===t.statusCode&&(this.ds||(this.$anon_distinct_id=void 0),n=!1),this.hs=!1,!s.disable_flags||this.ds){this.vs=!n;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&a.push("quota_limited"),null==(r=this.ui)||r.register({[Ci]:a}),u)va.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.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.ds&&(this.ds=!1,this.ks())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.vs)if(this.ls||this.getFlags()&&this.getFlags().length>0){if(!this.bs()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else va.warn('getFeatureFlag for key "'+t+fa)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.vs)if(this.ls||this.getFlags()&&this.getFlags().length>0){if(!this.bs()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.gs(wi)||void 0,l=this.gs(Fi)||void 0,u=this.gs(Ri)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.gs(Ii);d&&d!==v&&(u={},null==(h=this.ui)||h.register({[Ri]:u,[Ii]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,g,_,m,b,y,w,x;A(u[t])?u[t].push(o):u[t]=[o],null==(c=this.ui)||c.register({[Ri]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(f=this.gs(Ci))&&void 0!==f?f:[]];N(s)&&S.push("flag_missing");var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.qt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.qt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.vs};N(null==E||null==(_=E.metadata)?void 0:_.version)||(k.$feature_flag_version=E.metadata.version);var P,T=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;T&&(k.$feature_flag_reason=T),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),N(null==E?void 0:E.original_variant)&&N(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=N(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var R=n;if(!N(n))try{R=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:R}}}}else va.warn('getFeatureFlagResult for key "'+t+fa)}getRemoteConfigPayload(t,e){var i=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.ws()&&(r.evaluation_contexts=this._s());var s=this.xs();N(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.qt.disable_compression?void 0:ys,timeout:this.qt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.vs){if(this.ls||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return N(i)?void 0:!!i}va.warn('isFeatureEnabled for key "'+t+fa)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){if(this.ui){this.ls=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):va.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(A(l)){va.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;e&&e.register({[_i]:l,[gi]:v})}else{var f=l,g=u,_=a;if(null!=n&&n.partialResponse)f=p({},i,f),g=p({},r,g),_=p({},s,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));f=p({},i,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),g=p({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=p({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=p({},i,f),g=p({},r,g),_=p({},s,_);e&&e.register(p({[_i]:Object.keys(ga(f)),[gi]:f||{},[yi]:g||{},[bi]:_||{}},h?{[wi]:h}:{},d?{[Fi]:d}:{}))}}}(t,this.ui,r,s,n,i),e||(this.ps=!1),this.Is(e)}}override(t,e){void 0===e&&(e=!1),va.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ui)return va.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ui.unregister(xi),this.ui.unregister(Ei),this.Is(),ca.info("All overrides cleared");if(A(t)){var e=pa(t);return this.ui.register({[xi]:e}),this.Is(),ca.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.us=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ui.unregister(xi),ca.info("Flag overrides cleared");else if(r.flags){if(A(r.flags)){var s=pa(r.flags);this.ui.register({[xi]:s})}else this.ui.register({[xi]:r.flags});ca.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ui.unregister(Ei),ca.info("Payload overrides cleared")):r.payloads&&(this.ui.register({[Ei]:r.payloads}),ca.info("Payload overrides set",{payloads:r.payloads}))),void this.Is()}if(t&&"object"==typeof t)return this.ui.register({[xi]:t}),this.Is(),ca.info("Flag overrides set",{flags:t});va.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ls){var{flags:e,flagVariants:i}=this.Ts();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.gs(mi)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=p({},this.getFlagVariants(),{[t]:e});null==(r=this.ui)||r.register({[_i]:Object.keys(ga(a)),[gi]:a}),this.Is()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.gs(mi),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ui)||i.unregister(mi),null==(r=this.ui)||r.register({[mi]:s}),t(s)}}})}Ts(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}Is(t){var{flags:e,flagVariants:i}=this.Ts();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.gs(Si)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[Si]:p({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Si)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.gs($i)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=p({},i[e],t[e]),delete t[e]})),this._instance.register({[$i]:p({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.gs($i)||{};this._instance.register({[$i]:p({},e,{[t]:{}})})}else this._instance.unregister($i)}reset(){this.ls=!1,this.hs=!1,this.cs=!1,this.ds=!1,this.vs=!1,this.$anon_distinct_id=void 0,this.Cs(),this.us=!1}}},Sa={sessionRecording:class{get qt(){return this._instance.config}get ui(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Es)||!t.isStarted)}get status(){var t,e;return this.Ms===Go||this.Ms===Jo?this.Ms:null!==(t=null==(e=this.Es)?void 0:e.status)&&void 0!==t?t:this.Ms}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ms=Vo,this.Rs=void 0,this._instance=t,!this._instance.sessionManager)throw Yo.error("started without valid sessionManager"),new Error(Ko+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Gi)throw new Error(Ko+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ps(){var e,i=!(null==(e=this._instance.get_property(ui))||!e.enabled),r=!this.qt.disable_session_recording,s=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this.Ps||null==(e=this.Es)||!e.isStarted){var i=!N(Object.assign)&&!N(Array.from);this.Ps&&i?(this.Os(t),Yo.info("starting")):(this.Ms=Vo,this.stopRecording())}}Os(t){var e,i,r;this.Ps&&(this.Ms!==Go&&this.Ms!==Jo&&(this.Ms=Wo),null!=h&&null!=(e=h.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.Ls(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Fs,(e=>{if(e)return Yo.error("could not load recorder",e);this.Ls(t)})))}stopRecording(){var t,e;null==(t=this.Rs)||t.call(this),this.Rs=void 0,null==(e=this.Es)||e.stop()}As(){var t,e;null==(t=this.Rs)||t.call(this),this.Rs=void 0,null==(e=this.Es)||e.discard()}Ns(){var t;null==(t=this.ui)||t.unregister(pi)}Ds(t,e){if(H(t))return null;var i,r=q(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Yo.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}$s(t){if(this.ui){var e,i,r=this.ui,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ds(null==(e=this.qt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Ds(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;H(o)&&this.Ns();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ui]:p({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:p({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:N(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this.Rs)||e.call(this),this.Rs=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.$s(t),void this.As()):(this.$s(t),void this.startIfEnabledOrStop()):(this.Ms===Go&&(this.Ms=Jo,Yo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.Es)&&i.log?this.Es.log(t,e):Yo.warn("log called before recorder was ready")}get Fs(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ui);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}qs(){var t,e,i=this._instance.get_property(ui);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return Yo.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}Ls(t){var e,i;if(null==(e=h.__PosthogExtensions__)||!e.initSessionRecording)return Yo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qi]:!0});if(this.Es||(this.Es=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Es._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.qs()){if(this.Ms===Jo||this.Ms===Go)return;return this.Ms=Go,Yo.info("persisted remote config is stale, requesting fresh config before starting"),void new ms(this._instance).load()}this.Ms=Wo,this.Es.start(t)}onRRwebEmit(t){var e;null==(e=this.Es)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Es||null==(e=this.ui)||e.register({[di]:!0}),null==(t=this.Es)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Es||null==(e=this.ui)||e.register({[hi]:!0}),null==(t=this.Es)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Es||null==(i=this.ui)||i.register({["url"===t?vi:ci]:!0}),null==(e=this.Es)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Es)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Es)||!i.tryAddCustomEvent(t,e))}}},$a={autocapture:class{constructor(t){this.js=!1,this.Hs=null,this.Us=!1,this.instance=t,this.rageclicks=new Mo(t.config.rageclick),this.Bs=null}initialize(){this.startIfEnabled()}get qt(){var t,e,i=j(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}zs(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Vs(e)}catch(t){Do.error("Failed to capture event",t)}};if(vr(r,"submit",e,{capture:!0}),vr(r,"change",e,{capture:!0}),vr(r,"click",e,{capture:!0}),this.qt.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.Vs(e,Ao)}catch(t){Do.error("Failed to capture copy/cut event",t)}};vr(r,"copy",i,{capture:!0}),vr(r,"cut",i,{capture:!0})}}}else Do.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.js&&(this.zs(),this.js=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Us=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ti]:!!t.autocapture_opt_out}),this.Hs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Bs=t}getElementSelectors(t){var e,i=[];return null==(e=this.Bs)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[ti];if(B(this.Hs)&&!W(i)&&!this.instance.Dr())return!1;var r=null!==(e=this.Hs)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Vs(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=co(e);no(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,i){if(!t||bo(e))return!1;var r,s,n;if(W(i)?(r=!!i&&mo,s=void 0):(r=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:mo,s=null==i?void 0:i.content_ignorelist),!1===r)return!1;var{targetElementList:o}=yo(e,!1);return!function(t,e){if(!1===t||N(t))return!1;var i;if(!0===t)i=_o;else{if(!A(t))return!1;if(t.length>10)return We.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var e;return{safeText:vo(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!po(o,r)}(s,this.instance.config.rageclick)&&this.Vs(e,"$rageclick");var n=i===Ao;if(s&&function(e,i,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||bo(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!lo(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&lo(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=yo(e,s);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(N(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!po(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===i.type)return!0;var f=e.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return d?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(fo.indexOf(f)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.qt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=No(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Us});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===Ao){var u,h=ho(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return D(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.Ws=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(We.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Zs&&this.Zs(),this.Zs=void 0,We.info("History API monitoring stopped")}monitorHistoryChanges(){var e,i;if(t&&t.history){var r=this;null!=(e=t.history.pushState)&&e.__posthog_wrapped__||Uo(t.history,"pushState",(t=>function(e,i,s){t.call(this,e,i,s),r.Gs("pushState")})),null!=(i=t.history.replaceState)&&i.__posthog_wrapped__||Uo(t.history,"replaceState",(t=>function(e,i,s){t.call(this,e,i,s),r.Gs("replaceState")})),this.Qs()}}Gs(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.Ws&&this.isEnabled&&this._instance.capture(Zi,{navigation_type:e}),this.Ws=r}catch(t){We.error("Error capturing "+e+" pageview",t)}}Qs(){if(!this.Zs){var e=()=>{this.Gs("popstate")};vr(t,"popstate",e),this.Zs=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(t){var e;this.Js=!1,this.js=!1,this.Ks=null,this.instance=t,this.Js=!(null==(e=this.instance.persistence)||!e.props[ei]),this.rageclicks=new Mo(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return j(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(t=this.qt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return H(this.qt.capture_heatmaps)?H(this.qt.enable_heatmaps)?this.Js:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.js)return;Xo.info("starting..."),this.Ys(),this.At()}else{var t;clearInterval(null!==(t=this.Ks)&&void 0!==t?t:void 0),this.Xs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ei]:e}),this.Js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.M;return this.M=void 0,t}eo(t){this.Mt(t.originalEvent,"deadclick")}At(){this.Ks&&clearInterval(this.Ks),this.Ks=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.Kr.bind(this),this.flushIntervalMilliseconds):null}Ys(){t&&r&&(this.ro=this.Kr.bind(this),vr(t,Qi,this.ro),this.io=e=>this.Mt(e||(null==t?void 0:t.event)),vr(r,"click",this.io,{capture:!0}),this.no=e=>this.so(e||(null==t?void 0:t.event)),vr(r,"mousemove",this.no,{capture:!0}),this.oo=new Ar(this.instance,Or,this.eo.bind(this)),this.oo.startIfEnabledOrStop(),this.ao=this.At.bind(this),vr(r,Xi,this.ao),this.js=!0)}Xs(){var e;t&&r&&(this.ro&&t.removeEventListener(Qi,this.ro),this.io&&r.removeEventListener("click",this.io,{capture:!0}),this.no&&r.removeEventListener("mousemove",this.no,{capture:!0}),this.ao&&r.removeEventListener(Xi,this.ao),clearTimeout(this.uo),null==(e=this.oo)||e.stop(),this.js=!1)}lo(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&ro(s)&&!so(s,"body");){if(s===r)return!1;if(R(i,null==t?void 0:t.getComputedStyle(s).position))return!0;s=go(s)}return!1}(co(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}Mt(t,e){var i;if(void 0===e&&(e="click"),!io(t.target)&&Qo(t)){var r=this.lo(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.ho(p({},r,{type:"rageclick"})),this.ho(r)}}so(t){!io(t.target)&&Qo(t)&&(clearTimeout(this.uo),this.uo=setTimeout((()=>{this.ho(this.lo(t,"mousemove"))}),500))}ho(e){if(t){var i=t.location.href,r=this.qt.custom_personal_data_properties,s=this.qt.mask_personal_data_properties?[...Jr,...r||[]]:[],n=Vr(i,s,Yr);this.M=this.M||{},this.M[n]||(this.M[n]=[]),this.M[n].push(e)}}Kr(){this.M&&!L(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ar,webVitalsAutocapture:class{constructor(t){var e;this.Js=!1,this.js=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.co=()=>{clearTimeout(this.do),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((t,e)=>p({},t,{["$web_vitals_"+e.name+"_event"]:p({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=t=>{var e;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.vo();if(!N(i))if(H(null==t?void 0:t.name)||H(null==t?void 0:t.value))Ho.error("Invalid metric received",t);else if(!this.fo||this.fo>t.value){this.M.url!==i&&(this.co(),this.do=setTimeout(this.co,this.flushToCaptureTimeoutMs)),N(this.M.url)&&(this.M.url=i),this.M.firstMetricTimestamp=N(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),s=p({},t,{$current_url:i,timestamp:Date.now()});N(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.M.metrics.push(s),this.M.metrics.length===this.allowedMetrics.length&&this.co()}else Ho.error("Ignoring metric with value >= "+this.fo,t)},this.po=()=>{if(!this.js){var t,e,i,r,s=h.__PosthogExtensions__;N(s)||N(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.dt.bind(this)),this.js=!0):Ho.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Js=!(null==(e=this._instance.persistence)||!e.props[ni]),this.startIfEnabled()}get mo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=j(this.mo)?null==(t=this.mo)?void 0:t.web_vitals_allowed_metrics:void 0;return H(i)?(null==(e=this._instance.persistence)?void 0:e.props[li])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(j(this.mo)?this.mo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=j(this.mo)?this.mo.web_vitals_attribution:void 0;return null!=t&&t}get fo(){var t=j(this.mo)&&q(this.mo.__web_vitals_max_value)?this.mo.__web_vitals_max_value:qo;return t>0&&6e4>=t?qo:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Ho.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=j(this.mo)?this.mo.web_vitals:W(this.mo)?this.mo:void 0;return W(e)?e:this.Js}startIfEnabled(){this.isEnabled&&!this.js&&(Ho.info("enabled, starting..."),this.lr(this.po))}onRemoteConfig(t){if("capturePerformance"in t){var e=j(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=j(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ni]:e}),this._instance.persistence.register({[li]:i})),this.Js=e,this.startIfEnabled()}}lr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Ho.error("failed to load script",e):t()}))}vo(){var e=t?t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Jr,...i||[]]:[];return Vr(e,r,Yr)}Ho.error("Could not determine current URL")}}},ka={exceptionObserver:class{constructor(e){var i,r,s;this.po=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.yo&&this.qt.capture_unhandled_errors&&(this.yo=i(this.captureException.bind(this))),!this.bo&&this.qt.capture_unhandled_rejections&&(this.bo=r(this.captureException.bind(this))),!this._o&&this.qt.capture_console_errors&&(this._o=s(this.captureException.bind(this)))}catch(t){zo.error("failed to start",t),this.wo()}}},this._instance=e,this.xo=!(null==(i=this._instance.persistence)||!i.props[ii]),this.So=new it({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,Gt:zo}),this.qt=this.ko(),this.startIfEnabledOrStop()}ko(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(t)?e=p({},e,t):(N(t)?this.xo:t)&&(e=p({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zo.info("enabled"),this.wo(),this.lr(this.po)):this.wo()}lr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return zo.error("failed to load script",e);t()}))}wo(){var t,e,i;null==(t=this.yo)||t.call(this),this.yo=void 0,null==(e=this.bo)||e.call(this),this.bo=void 0,null==(i=this._o)||i.call(this),this._o=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.xo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ii]:this.xo}),this.qt=this.ko(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.ko()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.So.consumeRateLimit(s)?zo.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.Co=[],this.Io=new pe([new Pe,new je,new Re,new Te,new Ae,new Me,new Ce,new De],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=ke.test(a)?a.replace(ke,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return p({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||ge});var i}))}(s)}}("web:javascript",xe,$e)),this._instance=t,this.Co=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(ri))&&void 0!==e?e:[],this.To=Be(this.Eo()),this.Mo=new He(this.To)}onConfigChange(){this.To=Be(this.Eo()),this.Mo.setConfig(this.To)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.Co=s,this._instance.persistence&&this._instance.persistence.register({[ri]:this.Co,[si]:n})}}get Ro(){var t,e=!!this._instance.get_property(si),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Io.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.To.enabled)try{if(!z(t)||0===t.trim().length)return void _a.warn("Ignoring exception step because message must be a non-empty string");var i=this.Po(e),{sanitizedProperties:r,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ze.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(i);s.length>0&&_a.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Mo.add(p({[Le]:t,[Ne]:(new Date).toISOString()},r))}catch(t){_a.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Oo(e)){if(this.Lo(e))return this.Fo("Exception dropped: matched a suppression rule"),void _a.info("Skipping exception capture because a suppression rule matched");if(!this.Ro&&this.Ao(e))return this.Fo("Exception dropped: thrown by a browser extension"),void _a.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.No(e))return this.Fo("Exception dropped: thrown by the PostHog SDK"),void _a.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.To.enabled&&H(t.$exception_steps)?this.Do(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",cn:!0});return r&&this.Mo.clear(),r}catch(t){return _a.error("Failed to capture exception event. Dropping this exception.",t),void this.Mo.clear()}}catch(t){return void _a.error("Failed to process exception event. Ignoring this exception.",t)}}Do(t){try{var e=this.Mo.getAttachable();return 0===e.length?t:p({},t,{$exception_steps:e})}catch(e){return _a.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Fo(t){this.To.enabled&&this.Mo.add({[Le]:t,[Ne]:(new Date).toISOString()})}Po(t){return j(t)?p({},t):{}}Eo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Lo(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return z(i)&&i.length>0&&t.$exception_types.push(i),z(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Co.some((t=>{var i=t.values.map((t=>{var i,r=Sn[t.operator],s=A(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}Ao(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}No(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Oo(t){return!H(t)&&A(t)}}},Pa=p({productTours:class{get ui(){return this._instance.persistence}constructor(t){this.$o=null,this.qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ui&&this.ui.register({[ai]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.$o||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(ai)||this.lr((()=>this.jo()))}lr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Zo.error("Could not load product tours script",e):t()}))}jo(){var t;!this.$o&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.$o=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!A(this.qo)||e){var i=this.ui;if(i){var r=i.props[Ti];if(A(r)&&!e)return this.qo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Zo.error(s),void t([],{isLoaded:!1,error:s})}var n=A(e.json.product_tours)?e.json.product_tours:[];this.qo=n,i&&i.register({[Ti]:n}),t(n,{isLoaded:!0})}})}else t(this.qo,{isLoaded:!0})}getActiveProductTours(t){H(this.$o)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.$o.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.$o)||e.showTourById(t)}previewTour(t){this.$o?this.$o.previewTour(t):this.lr((()=>{var e;this.jo(),null==(e=this.$o)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.$o)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.$o)||t.nextStep()}previousStep(){var t;null==(t=this.$o)||t.previousStep()}clearCache(){var t;this.qo=null,null==(t=this.ui)||t.unregister(Ti)}resetTour(t){var e;null==(e=this.$o)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.$o)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.$o)||e.cancelPendingTour(t)}}},Ea),Ta={siteApps:class{constructor(t){this._instance=t,this.Ho=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Uo(t,e){if(e){var i=this.globalsForEvent(e);this.Ho.push(i),this.Ho.length>1e3&&(this.Ho=this.Ho.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Uo.bind(this));this.Bo=()=>{t(),this.Ho=[],this.Bo=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:p({},g(t,ta),{properties:p({},t.properties,f?{$set:p({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:p({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.Ho.length&&(ea.info("Processing "+this.Ho.length+" events for site app with id "+t.id),this.Ho.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Bo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ea.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){ea.error(ia+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ea.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}zo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Vo(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){ea.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.zo(),void this._instance.on("eventCaptured",(t=>this.Vo(t)))):void ea.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Bo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return ea.error(ia+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else ea.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Ra={tracingHeaders:class{constructor(t){this.Wo=void 0,this.Zo=void 0,this.Go=void 0,this.po=()=>{var t,e,i=this.Qo();i?(N(this.Wo)&&(this.Wo=null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),N(this.Zo)&&(this.Zo=null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.wo()},this._instance=t}initialize(){this.startIfEnabledOrStop()}lr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Bo.error("failed to load script",e);t()}))}Jo(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Qo(){var t=this.Jo();return A(t)?(A(this.Go)?this.Go.splice(0,this.Go.length,...t):this.Go=[...t],t.length>0?this.Go:void 0):(A(this.Go)&&this.Go.splice(0),this.Go=t||void 0,this.Go)}wo(){var t,e;null==(t=this.Wo)||t.call(this),null==(e=this.Zo)||e.call(this),this.Wo=void 0,this.Zo=void 0}startIfEnabledOrStop(){this.Qo()?this.lr(this.po):this.wo()}}},Ia=p({surveys:class{get qt(){return this._instance.config}constructor(t){this.Ko=void 0,this._surveyManager=null,this.Yo=!1,this.Xo=[],this.ea=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.qt.disable_surveys){var e=t.surveys;if(H(e))return Cn.warn("Flags not loaded yet. Not loading surveys.");var i=A(e);this.Ko=i?e.length>0:e,Cn.info("flags response received, isSurveysEnabled: "+this.Ko),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;elocalStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.Yo)Cn.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)Cn.info(la);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())Cn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!N(this.Ko)||this.qt.advanced_enable_surveys){var e=this.Ko||this.qt.advanced_enable_surveys;this.Yo=!0;try{var i=t.generateSurveys;if(i)return void this.ta(i,e);var r=t.loadExternalDependency;if(!r)return void this.ra(Vi);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.ra("Could not load surveys script",i):this.ta(t.generateSurveys,e)}))}catch(t){throw this.ra("Error initializing surveys",t),t}finally{this.Yo=!1}}}else Cn.error("PostHog Extensions not found.")}}ta(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new oa(this._instance),Cn.info("Surveys loaded successfully"),this.ia({isLoaded:!0})}ra(t,e){Cn.error(t,e),this.ia({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Xo.push(t),this._surveyManager&&this.ia({isLoaded:!0}),()=>{this.Xo=this.Xo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.qt.disable_surveys)return Cn.info(la),t([]);var i,r=this._instance.get_property(ki);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.ea?this.ea.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.ea=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:e=>{var r;this.ea=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Cn.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[ki]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}ia(t){for(var e of this.Xo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Cn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!H(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Cn.warn("init was not called")}na(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}sa(t){if(H(this._surveyManager))return{eligible:!1,reason:aa};var e="string"==typeof t?this.na(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(H(this._surveyManager))return Cn.warn("init was not called"),{visible:!1,disabledReason:aa};var e=this.sa(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return H(this._surveyManager)?(Cn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:aa})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.sa(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var s;if(H(this._surveyManager))Cn.warn("init was not called");else{var n="string"==typeof t?this.na(t):t;if(null!=n&&n.id)if(On.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(Cn.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Cn.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),Cn.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);Cn.warn("Survey element not found")}else Cn.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Cn.warn("Survey not found")}}displaySurvey(t,e){var i;if(H(this._surveyManager))Cn.warn("init was not called");else{var r=this.na(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=p({},r,{appearance:p({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==fs&&e.initialResponses&&Cn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Cn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else Cn.warn("Survey not found")}}cancelPendingSurvey(t){H(this._surveyManager)?Cn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Ea),Ca={toolbar:class{constructor(t){this.instance=t}oa(t){h.ph_toolbar_state=t}aa(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),cr(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=ua||Wr(e.hash,"__posthog")||Wr(e.hash,"state"),a=o?ar((()=>JSON.parse(atob(decodeURIComponent(o)))))||ar((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(ha)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}ua(t){var e=h.ph_load_toolbar||h.ph_load_editor;!H(e)&&D(e)?e(t,this.instance):da.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById(zi));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=p({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(ha,JSON.stringify(p({},n,{source:void 0}))),2===this.aa())this.ua(n);else if(0===this.aa()){var o;this.oa(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return da.error("[Toolbar] Failed to load",t),void this.oa(0);this.oa(2),this.ua(n)})),vr(t,"turbolinks:load",(()=>{this.oa(0),this.loadToolbar(n)}))}return!0}la(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Fa=p({experiments:ya},Ea),Oa={conversations:class{constructor(t){this.ha=void 0,this._conversationsManager=null,this.ca=!1,this.da=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;H(e)||(W(e)?this.ha=e:(this.ha=e.enabled,this.da=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ha=void 0,this.da=null}loadIfEnabled(){if(!(this._conversationsManager||this.ca||this._instance.config.disable_conversations||cr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!N(this.ha)&&this.ha)if(this.da&&this.da.token){this.ca=!0;try{var e=t.initConversations;if(e)return this.va(e),void(this.ca=!1);var i=t.loadExternalDependency;if(!i)return void this.fa(Vi);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.fa("Could not load conversations script",e):this.va(t.initConversations),this.ca=!1}))}catch(t){this.fa("Error initializing conversations",t),this.ca=!1}}else wa.error("Conversations enabled but missing token in remote config.")}}va(t){if(this.da)try{this._conversationsManager=t(this.da,this._instance),wa.info("Conversations loaded successfully")}catch(t){this.fa("Error completing conversations initialization",t)}else wa.error("Cannot complete initialization: remote config is null")}fa(t,e){wa.error(t,e),this._conversationsManager=null,this.ca=!1}show(){this._conversationsManager?this._conversationsManager.show():wa.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ha&&!B(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return f((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(wa.warn(xa),null)}))()}getMessages(t,e){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(wa.warn(xa),null)}))()}markAsRead(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(wa.warn(xa),null)}))()}getTickets(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(wa.warn(xa),null)}))()}requestRestoreLink(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(wa.warn(xa),null)}))()}restoreFromToken(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(wa.warn(xa),null)}))()}restoreFromUrlToken(){var t=this;return f((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(wa.warn(xa),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}yn(){var t;null==(t=this._conversationsManager)||t.setIdentity()}bn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Ma={logs:class{constructor(t){var e;this.pa=!1,this.ga=!1,this.Gt=Ge("[logs]"),this.ma=[],this.ya=0,this.ba=0,this._a=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.pa=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!H(i)&&i&&(this.pa=!0,this.loadIfEnabled())}reset(){this.ma=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.ya=0,this.ba=0,this._a=!1}loadIfEnabled(){if(this.pa&&!this.ga){var t=null==h?void 0:h.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ga=!0)})):this.Gt.error(Vi)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,i,r,s,n,o;if(this._instance.is_capturing())if(t&&t.body){var a=null!==(e=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)&&void 0!==e?e:3e3,l=null!==(r=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==r?r:1e3,u=Date.now();if(a>u-this.ba||(this.ba=u,this.ya=0,this._a=!1),l>this.ya){this.ya++;var h=function(t,e){var i=t.level||"info",{text:r,number:s}=he[i]||de,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=p({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:ce(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),N(t.trace_flags)||(l.flags=t.trace_flags),l}(t,this.wa());this.ma.push({record:h}),(null!==(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==n?n:100)>this.ma.length?this.xa():this.flushLogs()}else this._a||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this._a=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.Sa||(this.Sa={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Sa}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),0!==this.ma.length){var e=this.ma;this.ma=[];var i=this._instance.config.logs,r=p({"service.name":(null==i?void 0:i.serviceName)||"unknown_service"},(null==i?void 0:i.environment)&&{"deployment.environment":i.environment},(null==i?void 0:i.serviceVersion)&&{"service.version":i.serviceVersion},null==i?void 0:i.resourceAttributes),s=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:ce(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),r,v.LIB_NAME,v.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Yi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:t})}}xa(){var t,e;this.Br||(this.Br=setTimeout((()=>{this.Br=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}wa(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=h&&null!=(t=h.location)&&t.href&&(e.currentUrl=h.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},Aa=p({},Ea,Sa,$a,ka,Pa,Ta,Ia,Ra,Ca,Fa,Oa,Ma);Qn.__defaultExtensionClasses=p({},Aa),function(){v.SDK_DIST_CHANNEL="cdn";var e=Nn[Wn]=new Qn,i=h.posthog;i&&sr(i._i,(function(t){if(t&&A(t)){var r=e.init(t[0],t[1],t[2]),s=i[t[2]]||i;r&&(r._execute_array.call(r.people,s.people),r._execute_array(s))}})),h.posthog=e,function(){function e(){e.done||(e.done=!0,Gn=!1,sr(Nn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():vr(r,"DOMContentLoaded",e,{capture:!1}):t&&We.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}(); //# sourceMappingURL=array.js.map