1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,22737,(e,t,i)=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"setAttributesFromProps",{enumerable:!0,get:function(){return o}});let s={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv",noModule:"noModule"},r=["onLoad","onReady","dangerouslySetInnerHTML","children","onError","strategy","stylesheets"];function n(e){return["async","defer","noModule"].includes(e)}function o(e,t){for(let[i,o]of Object.entries(t)){if(!t.hasOwnProperty(i)||r.includes(i)||void 0===o)continue;let a=s[i]||i.toLowerCase();"SCRIPT"===e.tagName&&n(a)?e[a]=!!o:e.setAttribute(a,String(o)),(!1===o||"SCRIPT"===e.tagName&&n(a)&&(!o||"false"===o))&&(e.setAttribute(a,""),e.removeAttribute(a))}}("function"==typeof i.default||"object"==typeof i.default&&null!==i.default)&&void 0===i.default.__esModule&&(Object.defineProperty(i.default,"__esModule",{value:!0}),Object.assign(i.default,i),t.exports=i.default)},4570,e=>{"use strict";var t,i="u">typeof window?window:void 0,s="u">typeof globalThis?globalThis:i;"u"<typeof self&&(s.self=s),"u"<typeof File&&(s.File=function(){});var r=null==s?void 0:s.navigator,n=null==s?void 0:s.document,o=null==s?void 0:s.location,a=null==s?void 0:s.fetch,l=null!=s&&s.XMLHttpRequest&&"withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:void 0,u=null==s?void 0:s.AbortController,c=null==s?void 0:s.CompressionStream,h=null==r?void 0:r.userAgent,d=null!=i?i:{},p="1.386.6",v={DEBUG:!1,LIB_VERSION:p,LIB_NAME:"web",JS_SDK_VERSION:p};function g(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function _(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){g(n,s,r,o,a,"next",e)}function a(e){g(n,s,r,o,a,"throw",e)}o(void 0)})}}function f(){return(f=Object.assign.bind()).apply(null,arguments)}function m(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var y,b,x,w=((y={}).GZipJS="gzip-js",y.Base64="base64",y),E=["$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"],k="NativeGzipValidationError",S=e=>e.length>=2&&31===e[0]&&139===e[1],F=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),P=e=>{var t=Error("Native gzip produced invalid output: "+e);throw t.name=k,t},$=(b=_(function*(e,t){18>e.size&&P("too-short");var i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));S(i)&&8===i[2]||P("invalid-header");var s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(x)return x;x=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?0xedb88320^t>>>1:t>>>1;x[e]=t>>>0}return x})(),i=0xffffffff,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(0xffffffff^i)>>>0})(t)&&P("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&P("invalid-size")}),function(e,t){return b.apply(this,arguments)});function I(){return(I=_(function*(e,t,i){void 0===t&&(t=!0);try{var s,r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((s=_(function*(e){try{yield o.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield $(u,r),u}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var T=["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"],M=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return T.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function C(e,t){return -1!==e.indexOf(t)}var O=function(e){return e.trim()},R=function(e){return e.replace(/^\$/,"")},A=Object.prototype,L=A.hasOwnProperty,q=A.toString,D=Array.isArray||function(e){return"[object Array]"===q.call(e)},N=e=>"function"==typeof e,j=e=>e===Object(e)&&!D(e),H=e=>{if(j(e)){for(var t in e)if(L.call(e,t))return!1;return!0}return!1},z=e=>void 0===e,U=e=>"[object String]"==q.call(e),B=e=>U(e)&&0===e.trim().length,G=e=>null===e,W=e=>z(e)||G(e),V=e=>"[object Number]"==q.call(e)&&e==e,Y=e=>V(e)&&e>0,K=e=>"[object Boolean]"===q.call(e),J=e=>C(E,e);function X(e){return null===e||"object"!=typeof e}function Z(e,t){return({}).toString.call(e)==="[object "+t+"]"}function Q(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ee=[!0,"true",1,"1","yes"],et=[!1,"false",0,"0","no"];function ei(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),V(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ei(r||i,t,i,s))}
1class es{constructor(e){this.$t={},this.zt=e.zt,this.Gt=ei(e.bucketSize,0,100,e.Zt),this.Qt=ei(e.refillRate,0,this.Gt,e.Zt),this.Jt=ei(e.refillInterval,0,864e5,e.Zt)}Kt(e,t){var i=Math.floor((t-e.lastAccess)/this.Jt);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qt,this.Gt),e.lastAccess=e.lastAccess+i*this.Jt)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.$t[s];return r?this.Kt(r,i):this.$t[s]=r={tokens:this.Gt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.zt)||t.call(this,e)),0===r.tokens)}stop(){this.$t={}}}var er,en,eo,ea="Mobile",el="Android",eu="Tablet",ec=el+" "+eu,eh="iPad",ed="Apple",ep=ed+" Watch",ev="Safari",eg="BlackBerry",e_="Samsung",ef=e_+"Browser",em=e_+" Internet",ey="Chrome",eb=ey+" OS",ex=ey+" iOS",ew="Internet Explorer",eE=ew+" "+ea,ek="Opera",eS=ek+" Mini",eF="Edge",eP="Microsoft "+eF,e$="Firefox",eI=e$+" iOS",eT="Nintendo",eM="PlayStation",eC="Xbox",eO=el+" "+ea,eR=ea+" "+ev,eA="Windows",eL=eA+" Phone",eq="Nokia",eD="Ouya",eN="Generic",ej=eN+" "+ea.toLowerCase(),eH=eN+" "+eu.toLowerCase(),ez="Konqueror",eU="Oculus Browser",eB="Vivaldi",eG="Yandex",eW="Whale",eV="DuckDuckGo",eY="Pale Moon",eK="Waterfox",eJ="Brave",eX="Google Search App",eZ="(\\d+(\\.\\d+)?)",eQ=RegExp("Version/"+eZ),e0=RegExp(eC,"i"),e1=RegExp(eM+" \\w+","i"),e2=RegExp(eT+" \\w+","i"),e3=RegExp(eg+"|PlayBook|BB10","i"),e5={"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"},e8=function(e,t,i,s){var r;return t=t||"",(null!=i&&i.brave?eJ:null)||(null!=s&&s.detectGoogleSearchApp&&C(e,"GSA/")?eX:C(e," OPR/")&&C(e,"Mini")?eS:C(e," OPR/")?ek:e3.test(e)?eg:C(e,"IE"+ea)||C(e,"WPDesktop")?eE:C(e,"OculusBrowser")?eU:C(e,ef)?em:C(e,eF)||C(e,"Edg/")?eP:C(e,eB+"/")?eB:C(e,"YaBrowser/")?eG:C(e,eW+"/")?eW:C(e,eV+"/")||C(e,"Ddg/")?eV:C(e,"FBIOS")?"Facebook "+ea:C(e,"UCWEB")||C(e,"UCBrowser")?"UC Browser":C(e,"CriOS")?ex:C(e,"CrMo")||C(e,ey)?ey:C(e,el)&&C(e,ev)?eO:C(e,"FxiOS")?eI:C(e.toLowerCase(),ez.toLowerCase())?ez:C(e,eJ+"/")?eJ:(r=t)&&C(r,ed)||C(e,ev)&&!C(e,ey)&&!C(e,el)?C(e,ea)?eR:ev:C(e,"PaleMoon/")?eY:C(e,eK+"/")?eK:C(e,e$)?e$:C(e,"MSIE")||C(e,"Trident/")?ew:C(e,"Gecko")?e$:"")},e6={[eE]:[RegExp("rv:"+eZ)],[eP]:[RegExp(eF+"?\\/"+eZ)],[ey]:[RegExp("("+ey+"|CrMo)\\/"+eZ)],[ex]:[RegExp("CriOS\\/"+eZ)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eZ)],[ev]:[eQ],[eR]:[eQ],[ek]:[RegExp("(Opera|OPR)\\/"+eZ)],[e$]:[RegExp(e$+"\\/"+eZ)],[eI]:[RegExp("FxiOS\\/"+eZ)],[ez]:[RegExp("Konqueror[:/]?"+eZ,"i")],[eg]:[RegExp(eg+" "+eZ),eQ],[eO]:[RegExp("android\\s"+eZ,"i")],[em]:[RegExp(ef+"\\/"+eZ)],[eU]:[RegExp("OculusBrowser\\/"+eZ)],[eB]:[RegExp(eB+"\\/"+eZ)],[eG]:[RegExp("YaBrowser\\/"+eZ)],[eW]:[RegExp(eW+"\\/"+eZ)],[eJ]:[RegExp(eJ+"\\/"+eZ)],[eV]:[RegExp("(DuckDuckGo|Ddg)\\/"+eZ)],[eY]:[RegExp("PaleMoon\\/"+eZ)],[eK]:[RegExp(eK+"\\/"+eZ)],[eX]:[RegExp("GSA\\/"+eZ)],[ew]:[RegExp("(rv:|MSIE )"+eZ)],Mozilla:[RegExp("rv:"+eZ)]},e4=function(e,t,i,s){var r=e6[e8(e,t,i,s)];if(z(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},e7=[[RegExp(eC+"; "+eC+" (.*?)[);]","i"),e=>[eC,e&&e[1]||""]],[RegExp(eT,"i"),[eT,""]],[RegExp(eM,"i"),[eM,""]],[e3,[eg,""]],[RegExp(eA,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eL,""];if(new RegExp(ea).test(t)&&!/IEMobile\b/.test(t))return[eA+" "+ea,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=e5[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eA,s]}return[eA,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=z(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+el+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+el+")","i"),e=>e&&e[2]?[el,[e[2],e[3],e[4]||"0"].join(".")]:[el,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[eb,""]],[/Linux|debian/i,["Linux",""]]],e9=function(e){return e2.test(e)?eT:e1.test(e)?eM:e0.test(e)?eC:RegExp(eD,"i").test(e)?eD:RegExp("("+eL+"|WPDesktop)","i").test(e)?eL:/iPad/.test(e)?eh:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ep:e3.test(e)?eg:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eq,"i").test(e)?eq:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ea).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?el:ec:RegExp("(pda|"+ea+")","i").test(e)?ej:RegExp(eu,"i").test(e)&&!RegExp(eu+" pc","i").test(e)?eH:""},te=e=>e instanceof Error,tt={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}},ti=tt.info;function ts(e){var t=[];for(var i in e){var s=e[i];G(s)||z(s)||t.push({key:i,value:function e(t){if(K(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(D(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(s)})}return t}class tr{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return _(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&D(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),f({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return _(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,f({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return eo&&i.length===en||(en=i.length,eo=i.reduce((i,s)=>{er||(er={});var r=er[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,er[s]=[l,u];break}}return i},{})),eo}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return f({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function tn(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return z(s)||(n.lineno=s),z(r)||(n.colno=r),n}var to=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},ta=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tu=/\((\S*)(?::(\d+))(?::(\d+))\)/,tc=(e,t)=>{var i=ta.exec(e);if(i){var[,s,r,n]=i;return tn(t,s,"?",+r,+n)}var o=tl.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=tu.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=to(o[1]||"?",o[2]);return tn(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},th=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,td=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tp=(e,t)=>{var i=th.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=td.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?";return[n,r]=to(n,r),tn(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tv=/\(error: (.*)\)/;class tg{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Z(e,"DOMException")}isDOMError(e){return Z(e,"DOMError")}}class t_{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class tf{match(e){return Z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var tm=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ty{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(tm);return s&&(t=s[1],i=s[2]),[t,i]}}var tb=["fatal","error","warning","log","info","debug"];function tx(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");
1if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class tw{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Q(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+tx(e)}isSeverityLevel(e){return U(e)&&!B(e)&&tb.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(te(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tE{match(e){return Q(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+tx(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tk{match(e){return X(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tS{match(e){return Z(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Q(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return X(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tF="$message",tP="$timestamp",t$=new Set([tF,tP]),tI={enabled:!0,max_bytes:32768};function tT(e){var t;return e?{enabled:null!=(t=e.enabled)?t:tI.enabled,max_bytes:function(e,t){if(!V(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}(e.max_bytes,tI.max_bytes)}:f({},tI)}class tM{constructor(e){this.Yt=[],this.Xt=0,this.qt=tT(e)}setConfig(e){this.qt=tT(e),this.er()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,(e,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(t.has(i))return"[Circular]";t.add(i)}return i}})}catch(e){return}}(e);if(t)try{var i=JSON.parse(t);if(!j(i))return;var s=i[tF],r=i[tP];if(!U(s)||0===s.trim().length||!U(r)&&!V(r))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map(e=>e.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 e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}var tC=function(e,t){var{debugEnabled:s}=void 0===t?{}:t,r={k(t){if(i&&(v.DEBUG||d.POSTHOG_DEBUG||s)&&!z(i.console)&&i.console){for(var r=("__rrweb_original__"in i.console[t])?i.console[t].__rrweb_original__:i.console[t],n=arguments.length,o=Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("debug",...t)},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.k("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>tC(e+" "+t,i)};return r},tO=tC("[PostHog.js]"),tR=tO.createLogger,tA=tR("[ExternalScriptsLoader]"),tL=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return tA.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==n?void 0:n.querySelectorAll("script");
1if(s){for(var r,o=0;s.length>o;o++)if(r=function(){if(s[o].src===t){var e=s[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}}())return r.v}var a=()=>{if(!n)return i("document not found");var s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)n.head.appendChild(s);else{var r,o=n.querySelectorAll("body > script");o.length>0?null==(r=o[0].parentNode)||r.insertBefore(s,o[0]):n.body.appendChild(s)}};null!=n&&n.body?a():null==n||n.addEventListener("DOMContentLoaded",a)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5)),s=e.requestRouter.endpointFor("assets",r)}tL(e,s,i)}else{var n=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");tL(e,n,i)}},d.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);tL(e,s,i)};var tq="$people_distinct_id",tD="$device_id",tN="__alias",tj="__timers",tH="$autocapture_disabled_server_side",tz="$heatmaps_enabled_server_side",tU="$exception_capture_enabled_server_side",tB="$error_tracking_suppression_rules",tG="$error_tracking_capture_extension_exceptions",tW="$web_vitals_enabled_server_side",tV="$dead_clicks_enabled_server_side",tY="$product_tours_enabled_server_side",tK="$web_vitals_allowed_metrics",tJ="$session_recording_remote_config",tX="$replay_sample_rate",tZ="$replay_override_sampling",tQ="$replay_override_linked_flag",t0="$replay_override_url_trigger",t1="$replay_override_event_trigger",t2="$sesid",t3="$session_is_sampled",t5="$enabled_feature_flags",t8="$active_feature_flags",t6="$early_access_features",t4="$feature_flag_details",t7="$feature_flag_payloads",t9="$feature_flag_request_id",ie="$override_feature_flags",it="$override_feature_flag_payloads",ii="$stored_person_properties",is="$stored_group_properties",ir="$surveys",io="$surveys_loaded_at",ia="$surveys_activated",il="ph_product_tours",iu="$flag_call_reported",ic="$flag_call_reported_session_id",ih="$feature_flag_errors",id="$feature_flag_evaluated_at",ip="$user_state",iv="$client_session_props",ig="$capture_rate_limit",i_="$initial_campaign_params",im="$initial_referrer_info",iy="$initial_person_info",ib="$epp",ix="__POSTHOG_TOOLBAR__",iw="$posthog_cookieless",iE="$sdk_debug_extensions_init_method",ik="$sdk_debug_extensions_init_time_ms",iS="$sdk_debug_recording_script_not_loaded",iF="PostHog loadExternalDependency extension not found.",iP="on_reject",i$="always",iI="anonymous",iT="identified",iM="identified_only",iC="visibilitychange",iO="beforeunload",iR="$pageview",iA="$pageleave",iL="$identify",iq="$groupidentify";function iD(e,t){D(e)&&e.forEach(t)}function iN(e,t){if(!W(e))if(D(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)L.call(e,i)&&t(e[i],i)}var ij=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function iH(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var iz=function(e){try{return e()}catch(e){return}},iU=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){tO.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tO.critical(e)}}},iB=function(e){var t={};return iN(e,function(e,i){(U(e)&&e.length>0||V(e))&&(t[i]=e)}),t},iG=["herokuapp.com","vercel.app","netlify.app"];function iW(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function iV(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return V(e)&&isFinite(e)&&Math.floor(e)===e});class iY{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");
1var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new iY(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new iY(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class iK{constructor(){this.S=0,this.C=0,this.I=new iZ}generate(){var e=this.generateOrAbort();if(z(e)){this.S=0;var t=this.generateOrAbort();if(z(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>0x3ffffffffff&&(this.S++,this.T())}return iY.fromFieldsV7(this.S,Math.trunc(this.C/0x40000000),0x3fffffff&this.C,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var iJ,iX=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};i&&!z(i.crypto)&&crypto.getRandomValues&&(iX=e=>crypto.getRandomValues(e));class iZ{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(iX(this.M),this.R=0),this.M[this.R++]}}var iQ=()=>i0().toString(),i0=()=>(iJ||(iJ=new iK)).generate(),i1="",i2=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,i3={O:()=>!!n,D(e){tO.error("cookieStore error: "+e)},A(e){if(n){try{for(var t=e+"=",i=n.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},F(e){var t;try{t=JSON.parse(i3.A(e))||{}}catch(e){}return t},N(e,t,i,s,r){if(!n)return!1;try{var o="",a="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=n),i1)return i1;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+iQ();!i1&&s--;){var o=i.slice(s).join("."),a=r+"=1;domain=."+o+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(r)&&(t.cookie=a+";max-age=0",i1=o)}return i1}(e);if(!i){var s,r=(s=e.match(i2))?s[0]:"";r!==i&&tO.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(n.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}r&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&tO.warn("cookieStore warning: large cookie, len="+c.length),n.cookie=c,!0}catch(e){return!1}},q(e,t){if(null!=n&&n.cookie)try{i3.N(e,"",-1,t)}catch(e){return}}},i5=null,i8={O(){if(!G(i5))return i5;var e=!0;if(z(i))e=!1;else try{var t="__mplssupport__";i8.N(t,"xyz"),'"xyz"'!==i8.A(t)&&(e=!1),i8.q(t)}catch(t){e=!1}return e||tO.error("localStorage unsupported; falling back to cookie store"),i5=e,e},D(e){tO.error("localStorage error: "+e)},A(e){try{return null==i?void 0:i.localStorage.getItem(e)}catch(e){i8.D(e)}return null},F(e){try{return JSON.parse(i8.A(e))||{}}catch(e){}return null},N(e,t){try{return null==i||i.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){i8.D(e)}return!1},q(e){try{null==i||i.localStorage.removeItem(e)}catch(e){i8.D(e)}}},i6=[tD,"distinct_id",t2,t3,ib,iy,ip],i4={},i7={O:()=>!0,D(e){tO.error("memoryStorage error: "+e)},A:e=>i4[e]||null,F:e=>i4[e]||null,N:(e,t)=>(i4[e]=t,!0),q(e){delete i4[e]}},i9=null,se={O(){if(!G(i9))return i9;if(i9=!0,z(i))i9=!1;else try{var e="__support__";se.N(e,"xyz"),'"xyz"'!==se.A(e)&&(i9=!1),se.q(e)}catch(e){i9=!1}return i9},D(e){tO.error("sessionStorage error: ",e)},A(e){try{return null==i?void 0:i.sessionStorage.getItem(e)}catch(e){se.D(e)}return null}
1,F(e){try{return JSON.parse(se.A(e))||null}catch(e){}return null},N(e,t){try{return null==i||i.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){se.D(e)}return!1},q(e){try{null==i||i.sessionStorage.removeItem(e)}catch(e){se.D(e)}}};class st{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===i$||this.isRejected()||-1===this.consent&&this.qt.cookieless_mode===iP}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(e){this.nr.N(this.sr,+!!e,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:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return C(ee,e)?1:C(et,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t="localStorage"===e?i8:i3;if(!this.ar||this.ar!==t){this.ar=t;var i="localStorage"===e?i3:i8;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(C(ee,i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[null==r?void 0:r.doNotTrack,null==r?void 0:r.msDoNotTrack,d.doNotTrack].some(e=>C(ee,e))}}function si(e){return e instanceof Element&&(e.id===ix||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function ss(e){return!!e&&1===e.nodeType}function sr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function sn(e){return!!e&&3===e.nodeType}function so(e){return!!e&&11===e.nodeType&&ss(e.host)}function sa(e){return e?O(e).split(/\s+/):[]}function sl(e){var t=null==i?void 0:i.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function su(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return sa(t)}function sc(e){return W(e)?null:O(e).split(/(\s+)/).filter(e=>sC(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sh(e){var t="";return sk(e)&&!sS(e)&&e.childNodes&&e.childNodes.length&&iN(e.childNodes,function(e){var i;sn(e)&&e.textContent&&(t+=null!=(i=sc(e.textContent))?i:"")}),O(t)}function sd(e){var t;return z(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var sp=["a","button","form","input","select","textarea","label"];function sv(e,t){if(z(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function sg(e){var t=e.parentNode;return!(!t||!ss(t))&&t}var s_=["next","previous","prev",">","<"],sf=[...s_,"+","-","â","â"],sm=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,sy=[".ph-no-rageclick",".ph-no-capture"],sb=["","text","search","email","password","url","tel","number"];function sx(e,t){if(!i||sw(e)||(K(t)?(r=!!t&&sy,n=void 0,o=!1):(r=null!=(a=null==t?void 0:t.css_selector_ignorelist)?a:sy,n=null==t?void 0:t.content_ignorelist,o=null!=(l=null==t?void 0:t.ignore_text_selection)&&l),!1===r)||o&&!(!(s=e)||!ss(s))&&(sr(s,"textarea")||(sr(s,"input")?C(sb,(s.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(s))))return!1;var s,r,n,o,a,l,{targetElementList:u}=sE(e,!1);return!function(e,t){var i;if(!1===e||z(e))return!1;if(!0===e)i=s_;else{if(!D(e))return!1;if(e.length>10)return tO.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:s}=e;return i.some(e=>sm(t,e)||sm(s,e))})}(n,u.map(e=>{var t;return{safeText:sh(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!sv(u,r)}var sw=e=>!e||sr(e,"html")||!ss(e),sE=(e,t)=>{if(!i||sw(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var s=!1,r=[e],n=e;n.parentNode&&!sr(n,"body");)if(so(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var o=sg(n);if(!o)break;if(t||sp.indexOf(o.tagName.toLowerCase())>-1)s=!0;else{var a=i.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(s=!0)}r.push(o),n=o}return{parentIsUsefulElement:s,targetElementList:r}};function sk(e){for(var t=e;t.parentNode&&!sr(t,"body");t=t.parentNode){var i=su(t);if(C(i,"ph-sensitive")||C(i,"ph-no-capture"))return!1}if(C(su(e),"ph-include"))return!0;var s=e.type||"";if(U(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}
1var r=e.name||e.id||"";return!U(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function sS(e){return!!(sr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sr(e,"select")||sr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var sF="(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})",sP=RegExp("^(?:"+sF+")$"),s$=new RegExp(sF),sI="\\d{3}-?\\d{2}-?\\d{4}",sT=RegExp("^("+sI+")$"),sM=RegExp("("+sI+")");function sC(e,t){return void 0===t&&(t=!0),!(W(e)||U(e)&&(e=O(e),(t?sP:s$).test((e||"").replace(/[- ]/g,""))||(t?sT:sM).test(e)))&&!0}function sO(e){var t=sh(e);return sC(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&iN(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=sh(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){tO.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function sR(e){return e.replace(/"|\\"/g,'\\"')}var sA=tR("[Dead Clicks]"),sL=()=>!0,sq=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tV)),s=e.instance.config.capture_dead_clicks;return K(s)?s:!!j(s)||i};class sD{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[tV]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur(()=>{this.hr()}):this.stop()}ur(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?sA.error("failed to load script",t):e()})}hr(){var e;if(n){if(!this.lr&&null!=(e=d.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=j(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.lr=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.lr.start(n),sA.info("starting...")}}else sA.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,sA.info("stopping..."))}}var sN=tR("[SegmentIntegration]"),sj="posthog-js";function sH(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,h,d,p,v=(null==(l=t.exception)?void 0:l.values)||[],g=v.map(e=>f({},e,{stacktrace:e.stacktrace?f({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>f({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(u=v[0])?void 0:u.value)||t.message,$exception_type:null==(c=v[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=v[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}class sz{constructor(e,t,i,s,r,n){this.name=sj,this.setupOnce=function(o){o(sH(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class sU{constructor(e){this.cr=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(tO.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.cr)}destroy(){var e;null==(e=this.pr)||e.call(this),this.pr=void 0}doPageView(e,t){var s,r=this.gr(e,t);return this.dr={pathname:null!=(s=null==i?void 0:i.location.pathname)?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,null==(t=this.dr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.dr)?void 0:e.pageViewId}}gr(e,t){var i=this.dr;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(z(n)||z(o)||z(a)||z(l)||z(u)||z(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>
11?ei(o/n,0,1,tO):1,d=n>1?ei(a/n,0,1,tO):1,p=l>1?ei(u/l,0,1,tO):1,v=l>1?ei(c/l,0,1,tO):1;s=ij(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var sB=["flags","surveys"],sG={[tq]:{exposure:"hidden"},[tN]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[tj]:{exposure:"hidden"},[tH]:{exposure:"event"},[tz]:{exposure:"hidden"},[tU]:{exposure:"event"},[tB]:{exposure:"hidden"},[tG]:{exposure:"event"},[tW]:{exposure:"event"},[tV]:{exposure:"event"},[tY]:{exposure:"hidden"},[tK]:{exposure:"event"},[tJ]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[t2]:{exposure:"hidden"},[t3]:{exposure:"event"},[tX]:{exposure:"event",shouldSkipFromEventProperties:e=>G(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[t5]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!j(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[t8]:{exposure:"event",storageGroup:"flags"},[t6]:{exposure:"hidden"},[t4]:{exposure:"hidden",storageGroup:"flags"},[t7]:{exposure:"event",storageGroup:"flags"},[t9]:{exposure:"event",storageGroup:"flags",volatile:!0},[ie]:{exposure:"event"},[it]:{exposure:"hidden"},[ii]:{exposure:"hidden"},[is]:{exposure:"hidden"},[ir]:{exposure:"hidden",storageGroup:"surveys"},[io]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ia]:{exposure:"event"},[il]:{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"},[iu]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[ih]:{exposure:"hidden"},[id]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ip]:{exposure:"hidden"},[iv]:{exposure:"hidden"},[ig]:{exposure:"hidden"},[i_]:{exposure:"hidden"},[im]:{exposure:"hidden"},[iy]:{exposure:"hidden"},[ib]:{exposure:"hidden"},[tZ]:{exposure:"event"},[tQ]:{exposure:"event"},[t0]:{exposure:"event"},[t1]:{exposure:"event"},[iE]:{exposure:"event"},[ik]:{exposure:"event"},[iS]:{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"}},sW=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],sV=e=>{var t=sG[e];if(t)return t;for(var[i,s]of sW)if(0===e.indexOf(i))return s},sY=e=>{var t=null==n?void 0:n.createElement("a");return z(t)?null:(t.href=e,t)},sK=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!D(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){tO.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},sJ=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");D(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},sX=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},sZ="https?://(.*)",sQ=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],s0=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...sQ],s1="<masked>",s2=["li_fat_id"];function s3(e,t,i){if(!n)return{};var s,r=t?[...sQ,...i||[]]:[],o=s5(sJ(n.URL,r,s1),e);return ij((s={},iN(s2,function(e){var t=i3.A(e);s[e]=t||null}),s),o)}function s5(e,t){var i=s0.concat(t||[]),s={};return iN(i,function(t){var i=sK(e,t);s[t]=i||null}),s}function s8(e){var t=e?0===e.search(sZ+"google.([^/?]*)")?"google":0===e.search(sZ+"bing.com")?"bing":0===e.search(sZ+"yahoo.com")?"yahoo":0===e.search(sZ+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!G(t)){i.$search_engine=t;var s=n?sK(n.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function s6(){return navigator.language||navigator.userLanguage}var s4="$direct";function s7(){return(null==n?void 0:n.referrer)||s4}function s9(e,t){var i=e?[...sQ,...t||[]]:[],s=null==o?void 0:o.href.substring(0,1e3);return{r:s7().substring(0,1e3),u:s?sJ(s,i,s1):void 0}}function re(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==s4?s4:null==(t=sY(i))?void 0:t.host};
1if(s){r.$current_url=s;var n=sY(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname,ij(r,s5(s))}return i&&ij(r,s8(i)),r}function rt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var ri={flags:id,surveys:io},rs=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],rr="main";class rn{constructor(e,t,s){if(void 0===s&&(s=!0),this.mr={},this.yr=!1,this.br=!1,this.qt=e,this._r=s,this.props={},this.wr=!1,this.kr=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.nr=this.Sr(e),this.br=this.Cr(e),this.load(),e.debug&&tO.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),i){var r=()=>this.flush();iW(i,"beforeunload",r,{capture:!1}),iW(i,"pagehide",r,{capture:!1})}}Ir(){var e,t=null==(e=this.qt)?void 0:e.persistence_save_debounce_ms;return V(t)&&t>0?t:0}isDisabled(){return!!this.Tr}Sr(e){-1===rs.indexOf(e.persistence.toLowerCase())&&(tO.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s,r,n,o=(t=e.cookie_persisted_properties||[],s=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===s&&(s=!1),r=[...i6,...t],f({},i8,{F(e){try{var t={};try{t=i3.F(e)||{}}catch(e){}var i,r=JSON.parse(i8.A(e)||"{}");if(s){var n={};for(var o in t){var a=t[o];G(a)||""===a||(n[o]=a)}i=ij(r,n)}else i=ij(t,r);return i8.N(e,i),i}catch(e){}return null},N(e,t,i,s,n,o){var a=i8.N(e,t,void 0,void 0,o);try{var l={};r.forEach(e=>{t[e]&&(l[e]=t[e])}),Object.keys(l).length&&i3.N(e,l,i,s,n,o)}catch(e){i8.D(e)}return a},q(e,t){try{null==i||i.localStorage.removeItem(e),i3.q(e,t)}catch(e){i8.D(e)}}})),a=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&i8.O()?(n=i8,a=!0):"localstorage+cookie"===l&&o.O()?(n=o,a=!0):"sessionstorage"===l&&se.O()?n=se:"memory"===l?n=i7:"cookie"===l?n=i3:o.O()?(n=o,a=!0):n=i3,this.yr=a,n}Er(e){return this.kr+"__"+e}Cr(e){return this.yr&&!!e.split_storage}Mr(e){var t=null!=e?e:this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[id];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return iN(this.props,(t,i)=>{var s=sV(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===t5?()=>this.Mr():()=>!1))return;s.transformToEventProperties&&ij(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,()=>!1))return;e[i]=t}}),e}load(){if(!this.Tr){var e=this.nr.F(this.kr);e&&(this.props=ij({},e)),this.br&&this.Rr()}}Rr(){for(var e of sB){var t=i8.F(this.Er(e));if(t&&!H(t)){var i=this.Pr(e);i.persisted=!0,this.Or(e)||(i.fingerprint=this.Lr(t,e)),this.Ar(e,t)||ij(this.props,t)}}}Or(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=sV(t))?void 0:i.storageGroup)===e})}Ar(e,t){var i=ri[e];if(!i)return!1;var s=t[i],r=this.props[i];return V(s)&&V(r)&&r>s}refreshKey(e){var t;if(!this.Tr){var i=this.br?null==(t=sV(e))?void 0:t.storageGroup:void 0,s=i?i8.F(this.Er(i)):this.nr.F(this.kr);if(s&&e in s)this.Fr(e,s[e]);else{if(i){var r=this.nr.F(this.kr);if(r&&e in r)return void this.Fr(e,r[e])}this.Nr(e)}}}save(){if(!this.Tr){var e=this.Ir();e>0?z(this.Dr)&&(this.Dr=setTimeout(()=>{this.Dr=void 0,this.$r()},e)):this.$r()}}flush(){z(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0,this.$r())}$r(){this.Tr||(this.br?this.qr():this.jr(this.nr,this.kr,this.props,rr))}qr(){var{main:e,groups:t}=this.Br();for(var i of(this.jr(this.nr,this.kr,e,rr),sB)){var s,r=t[i];(!H(r)||null!=(s=this.mr[i])&&s.persisted)&&this.jr(i8,this.Er(i),r,i)}}Br(){var e={},t={};for(var i of sB)t[i]={};return iN(this.props,(i,s)=>{var r,n=null==(r=sV(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}Lr(e,t){if(t===rr)return JSON.stringify(e)+"|"+this.Hr+"|"+this.Ur+"|"+this.zr;var i={};return iN(e,(e,t)=>{var s;i[t]=null!=(s=sV(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}jr(e,t,i,s){var r,n=this.Pr(s);if(s===rr||n.dirty||z(n.fingerprint)){try{if((r=this.Lr(i,s))===n.fingerprint)return void(n.dirty=!1)}catch(e){r=void 0}e.N(t,i,this.Hr,this.Ur,this.zr,this.qt.debug)?(n.dirty=!1,s!==rr&&(n.persisted=!0),z(r)||(n.fingerprint=r)):this.qt.debug&&tO.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(z(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0),this.nr.q(this.kr,!1),this.nr.q(this.kr,!0),!t&&this._r)for(var i of sB)i8.q(this.Er(i));t?delete this.mr[rr]:this.mr={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(j(e)){z(t)&&(t="None"),this.Hr=z(i)?this.Vr:i;var s=!1;if(iN(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Fr(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(j(e)){this.Hr=z(t)?this.Vr:t;var i=!1;if(iN(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.Fr(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Nr(e),this.save())}update_campaign_params(){if(!this.wr){var e=s3(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);H(iB(e))||this.register(e),this.wr=!0}}update_search_keyword(){var e;this.register((e=null==n?void 0:n.referrer)?s8(e):{})}update_referrer_info(){var e;this.register_once({$referrer:s7(),$referring_domain:null!=n&&n.referrer&&(null==(e=sY(n.referrer))?void 0:e.host)||s4},void 0)}set_initial_person_info(){this.props[i_]||this.props[im]||this.register_once({[iy]:s9(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};iN([im,i_],t=>{var i=this.props[t];i&&iN(i,function(t,i){e["$initial_"+R(i)]=t})});var t,i,s=this.props[iy];return s&&ij(e,(t=re(s),i={},iN(t,function(e,t){i["$initial_"+R(t)]=e}),i)),e}safe_merge(e){return iN(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){this.Vr=this.Hr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this.Sr(e):this.nr,n=this.Cr(e);if(s||n!==this.br){var o=this.props;this.clear(),this.nr=r,this.br=n,this.props=o,this.save()}}set_disabled(e){this.Tr=e,this.Tr?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ur&&(this.Ur=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zr&&(this.zr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[tj]||{};i[e]=t,this.Fr(tj,i),this.save()}remove_event_timer(e){var t=this.props[tj]||{},i=t[e];return z(i)||(delete t[e],this.Fr(tj,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Fr(e,t),this.save()}Fr(e,t){var i;this.props[e]=t,null!=(i=sV(e))&&i.volatile||this.Wr(e)}Nr(e){delete this.props[e],this.Wr(e)}Wr(e){var t,i=null==(t=sV(e))?void 0:t.storageGroup;i&&(this.Pr(i).dirty=!0)}Pr(e){return this.mr[e]||(this.mr[e]={})}}var ro="events",ra="cancelEvents",rl="survey shown",ru="survey sent",rc="popover",rh=tR("[RateLimiter]");class rd{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;
1if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{rh.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void rh.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(ig))?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(ig,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var rp=tR("[RemoteConfig]");class rv{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=d._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Gr(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Zr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return rp.info("Using preloaded remote config",this.remoteConfig),this.Qr(this.remoteConfig),void this.Jr();if(this._instance.Kr())return void rp.warn("Remote config is disabled. Falling back to local config.");this.Gr(e=>{e?(this.Qr(e),this.Jr()):(rp.info("No config found after loading remote JS config. Falling back to JSON."),this.Zr(e=>{this.Qr(e),this.Jr()}))})}catch(e){rp.error("Error loading remote config",e)}}stop(){this.Yr&&(clearInterval(this.Yr),this.Yr=void 0)}refresh(){!this._instance.Kr()&&n&&"hidden"!==n.visibilityState&&this._instance.reloadFeatureFlags()}Jr(){var e;if(!this.Yr){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.Yr=setInterval(()=>{this.refresh()},t))}}Qr(e){var t;e||rp.error("Failed to fetch remote config from PostHog."),this._instance.Qr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var rg="gzip-js",r_="base64",rf=Uint8Array,rm=Uint16Array,ry=Uint32Array,rb=new rf([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]),rx=new rf([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]),rw=new rf([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rE=function(e,t){for(var i=new rm(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new ry(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},rk=rE(rb,2),rS=rk[1];rk[0][28]=258,rS[258]=28;for(var rF=rE(rx,0)[1],rP=new rm(32768),r$=0;32768>r$;++r$){var rI=(43690&r$)>>>1|(21845&r$)<<1;rP[r$]=((65280&(rI=(61680&(rI=(52428&rI)>>>2|(13107&rI)<<2))>>>4|(3855&rI)<<4))>>>8|(255&rI)<<8)>>>1}var rT=function(e,t,i){for(var s=e.length,r=0,n=new rm(t);s>r;++r)++n[e[r]-1];var o,a=new rm(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new rm(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[rP[h]>>>l]=u}else for(o=new rm(s),r=0;s>r;++r)o[r]=rP[a[e[r]-1]++]>>>15-e[r];return o},rM=new rf(288);for(r$=0;144>r$;++r$)rM[r$]=8;for(r$=144;256>r$;++r$)rM[r$]=9;for(r$=256;280>r$;++r$)rM[r$]=7;for(r$=280;288>r$;++r$)rM[r$]=8;var rC=new rf(32);for(r$=0;32>r$;++r$)rC[r$]=5;var rO=rT(rM,9,0),rR=rT(rC,5,0),rA=function(e){return(e/8|0)+(7&e&&1)},rL=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof rm?rm:e instanceof ry?ry:rf)(i-t);return s.set(e.subarray(t,i)),s},rq=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},rD=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},rN=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new rf(0),0];if(1==r){var o=new rf(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new rm(d+1),v=rj(i[c-1],p,0);if(v>t){s=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new rf(p),v]},rj=function(e,t,i){return -1==e.s?Math.max(rj(e.l,t,i+1),rj(e.r,t,i+1)):t[e.s]=i},rH=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new rm(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},rz=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},rU=function(e,t,i){var s=i.length,r=rA(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},rB=function(e,t,i,s,r,n,o,a,l,u,c){rq(t,c++,i),++r[256];for(var h=rN(r,15),d=h[0],p=h[1],v=rN(n,15),g=v[0],_=v[1],f=rH(d),m=f[0],y=f[1],b=rH(g),x=b[0],w=b[1],E=new rm(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;x.length>k;++k)E[31&x[k]]++;for(var S=rN(E,7),F=S[0],P=S[1],$=19;$>4&&!F[rw[$-1]];--$);var I,T,M,C,O=u+5<<3,R=rz(r,rM)+rz(n,rC)+o,A=rz(r,d)+rz(n,g)+o+14+3*$+rz(E,F)+(2*E[16]+3*E[17]+7*E[18]);if(R>=O&&A>=O)return rU(t,c,e.subarray(l,l+u));if(rq(t,c,1+(R>A)),c+=2,R>A){I=rT(d,p,0),T=d,M=rT(g,_,0),C=g;var L=rT(F,P,0);for(rq(t,c,y-257),rq(t,c+5,w-1),rq(t,c+10,$-4),c+=14,k=0;$>k;++k)rq(t,c+3*k,F[rw[k]]);c+=3*$;for(var q=[m,x],D=0;2>D;++D){var N=q[D];for(k=0;N.length>k;++k)rq(t,c,L[j=31&N[k]]),c+=F[j],j>15&&(rq(t,c,N[k]>>>5&127),c+=N[k]>>>12)}}else I=rO,T=rM,M=rR,C=rC;for(k=0;a>k;++k)if(s[k]>255){rD(t,c,I[257+(j=s[k]>>>18&31)]),c+=T[j+257],j>7&&(rq(t,c,s[k]>>>23&31),c+=rb[j]);var j,H=31&s[k];rD(t,c,M[H]),c+=C[H],H>3&&(rD(t,c,s[k]>>>5&8191),c+=rx[H])}else rD(t,c,I[s[k]]),c+=T[s[k]];return rD(t,c,I[256]),c+T[256]},rG=new ry([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),rW=function(){for(var e=new ry(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),rV=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},rY=!!l||!!a,rK="text/plain",rJ=!1,rX=function(e,t,i){void 0===i&&(i=!0);var s,r,n,o,a,[l,u]=e.split("?"),c=f({},t),h=null!=(a=null==u?void 0:u.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!=(t=c[s])?t:r;return delete c[s],s+"="+n}))?a:[],d=(void 0===s&&(s="&"),o=[],iN(c,function(e,t){z(e)||z(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),o[o.length]=n+"="+r)}),o.join(s));return d&&h.push(d),l+"?"+h.join("&")},rZ=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),rQ=e=>{if(e.tr)return e.tr;var{data:t,compression:i}=e;if(t){if(i===rg){var s,r,n,o,a,l,u,c,h=(s=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new rf(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new rf(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return rL(i,0,s)}(rZ(t)),r={mtime:0},n=0xffffffff,o={p(e){for(var t=n,i=0;e.length>i;++i)t=rW[255&t^e[i]]^t>>>8;n=t},d:()=>0xffffffff^n},a=s.length,o.p(s),c=(l=10+(r.filename&&r.filename.length+1||0),u=function(e,t,i,s){var r=e.length,n=new rf(s+r+5*(1+Math.floor(r/7e3))+8),o=n.subarray(s,n.length-8),a=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?a=rU(o,a,e.subarray(l,u)):(o[l]=!0,a=rU(o,a,e.subarray(l,r)))}else{for(var c=rG[t-1],h=c>>>13,d=8191&c,p=(1<<i)-1,v=new rm(32768),g=new rm(p+1),_=Math.ceil(i/3),f=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<f)&p},y=new ry(25e3),b=new rm(288),x=new rm(32),w=0,E=0,k=(l=0,0),S=0,F=0;r>l;++l){var P=m(l),$=32767&l,I=g[P];if(v[$]=I,g[P]=$,l>=S){var T=r-l;if((w>7e3||k>24576)&&T>423){a=rB(e,o,0,y,b,x,E,k,F,l-F,a),k=w=E=0,F=l;for(var M=0;286>M;++M)b[M]=0;for(M=0;30>M;++M)x[M]=0}var C=2,O=0,R=d,A=$-I&32767;if(T>2&&P==m(l-A))for(var L=Math.min(h,T)-1,q=Math.min(32767,l),D=Math.min(258,T);q>=A&&--R&&$!=I;){if(e[l+C]==e[l+C-A]){for(var N=0;D>N&&e[l+N]==e[l+N-A];++N);if(N>C){if(C=N,O=A,N>L)break;var j=Math.min(A,N-2),H=0;for(M=0;j>M;++M){var z=l-A+M+32768&32767,U=z-v[z]+32768&32767;U>H&&(H=U,I=z)}}}A+=($=I)-(I=v[$])+32768&32767}if(O){y[k++]=0x10000000|rS[C]<<18|rF[O];var B=31&rS[C],G=31&rF[O];E+=rb[B]+rx[G],++b[257+B],++x[G],S=l+C,++w}else y[k++]=e[l],++b[e[l]]}}a=rB(e,o,!0,y,b,x,E,k,F,l-F,a)}return rL(n,0,s+rA(a)+8)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,l)).length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&rV(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,r),rV(u,c-8,o.d()),rV(u,c-4,a),u);return{contentType:rK,body:h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),estimatedSize:h.byteLength}}if(i===r_){let e;var d,p="data="+encodeURIComponent("string"==typeof(e=(d=rZ(t))?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16)))):d)?e:rZ(e));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var v=rZ(t);return{contentType:"application/json",body:v,estimatedSize:new Blob([v]).size}}},r0=e=>{var t,i,s,r=rQ(e);return!r||(i=e.compression,s=sK(e.url,"compression"),i!==w.GZipJS&&s!==w.GZipJS&&"gzip"!==s)||((t=r.body)instanceof ArrayBuffer?S(new Uint8Array(t)):ArrayBuffer.isView(t)&&S(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:r}:(rJ=!0,{url:((e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter(e=>e.split("=")[0]!==t).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")})(e.url,"compression"),encodedBody:rQ(f({},e,{compression:void 0,tr:void 0}))})},r1=(nb=_(function*(e){var t=rZ(e.data),i=yield function(e,t,i){return I.apply(this,arguments)}(t,v.DEBUG,{rethrow:!0});if(!i)return e;var s=yield i.arrayBuffer();return f({},e,{tr:{contentType:rK,body:s,estimatedSize:s.byteLength}})}),function(e){return nb.apply(this,arguments)}),r2=(e,t)=>rX(e,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:t}),r3=[];a&&r3.push({transport:"fetch",method(e){var t,{url:i,encodedBody:s}=r0(e),{contentType:r,body:n,estimatedSize:o}=null!=s?s:{},l=new Headers;iN(e.headers,function(e,t){l.append(t,e)}),r&&l.append("Content-Type",r);var c=null;if(u){var h=new u;c={signal:h.signal,timeout:setTimeout(()=>h.abort(),e.timeout)}}a(i,f({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(o||0),body:n,signal:null==(t=c)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){tO.error(e)}null==e.callback||e.callback(s)})).catch(t=>{tO.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>c?clearTimeout(c.timeout):null)}}),l&&r3.push({transport:"XHR",method(e){var t=new l,{url:i,encodedBody:s}=r0(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};iN(e.headers,function(e,i){t.setRequestHeader(i,e)}),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=r&&r.sendBeacon&&r3.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=r0(e),s=rX(t,{beacon:"1"}),{contentType:n,body:o}=null!=i?i:{};if(!o)return;var a=o instanceof Blob?o:new Blob([o],{type:n});r.sendBeacon(s,a)}catch(e){}}});class r5{constructor(e,t){this.Xr=!0,this.ei=[],this.ti=ei((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tO.createLogger("flush interval"),3e3),this.ri=e}enqueue(e){this.ei.push(e),this.ii||this.ni()}unload(){this.si();var e=Object.values(this.ei.length>0?this.oi():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ri(f({},e,{transport:"sendBeacon"}))})}enable(){this.Xr=!1,this.ni()}ni(){var e=this;this.Xr||(this.ii=setTimeout(()=>{if(this.si(),this.ei.length>0){var t=this.oi();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&D(s.data)&&iN(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.ri(s)}()}},this.ti))}si(){clearTimeout(this.ii),this.ii=void 0}oi(){var e={};return iN(this.ei,t=>{var i,s=(t?t.batchKey:null)||t.url;z(e[s])&&(e[s]=f({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.ei=[],e}}var r8=["retriesPerformedSoFar"];class r6{constructor(e){this.ai=!1,this.li=3e3,this.ei=[],this._instance=e,this.ei=[],this.ui=!0,!z(i)&&"onLine"in i.navigator&&(this.ui=i.navigator.onLine,this.hi=()=>{this.ui=!0,this.ci()},this.di=()=>{this.ui=!1},iW(i,"online",this.hi),iW(i,"offline",this.di))}get length(){return this.ei.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=m(e,r8);Y(t)&&(i.url=rX(i.url,{retry_count:t})),this._instance._send_request(f({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.vi(f({retriesPerformedSoFar:t},i))}}))}vi(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.ei.push({retryAt:n,requestOptions:e});var o="Enqueued failed request for retry in "+r;
1navigator.onLine||(o+=" (Browser is offline)"),tO.warn(o),this.ai||(this.ai=!0,this.fi())}fi(){(this.pi&&clearTimeout(this.pi),0===this.ei.length)?(this.ai=!1,this.pi=void 0):this.pi=setTimeout(()=>{this.ui&&this.ei.length>0&&this.ci(),this.fi()},this.li)}ci(){var e=Date.now(),t=[],i=this.ei.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ei=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.pi&&(clearTimeout(this.pi),this.pi=void 0),this.ai=!1,z(i)||(this.hi&&(i.removeEventListener("online",this.hi),this.hi=void 0),this.di&&(i.removeEventListener("offline",this.di),this.di=void 0)),this.ei))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(e){tO.error(e)}this.ei=[]}}class r4{constructor(e){this.gi=()=>{this.mi||(this.mi={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.mi.lastScrollY=Math.ceil(n),this.mi.maxScrollY=Math.max(n,null!=(e=this.mi.maxScrollY)?e:0),this.mi.maxScrollHeight=Math.max(o,null!=(t=this.mi.maxScrollHeight)?t:0),this.mi.lastContentY=a,this.mi.maxContentY=Math.max(a,null!=(i=this.mi.maxContentY)?i:0),this.mi.maxContentHeight=Math.max(l,null!=(s=this.mi.maxContentHeight)?s:0)},this._instance=e}get yi(){return this._instance.config.scroll_root_selector}getContext(){return this.mi}resetContext(){var e=this.mi;return setTimeout(this.gi,0),e}startMeasuringScrollPosition(){iW(i,"scroll",this.gi,{capture:!0}),iW(i,"scrollend",this.gi,{capture:!0}),iW(i,"resize",this.gi)}scrollElement(){if(!this.yi)return null==i?void 0:i.document.documentElement;for(var e of D(this.yi)?this.yi:[this.yi]){var t=null==i?void 0:i.document.querySelector(e);if(t)return t}}bi(e){if(this.yi){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return i?"y"===e?i.scrollY||i.pageYOffset||i.document.documentElement.scrollTop||0:i.scrollX||i.pageXOffset||i.document.documentElement.scrollLeft||0:0}scrollY(){return this.bi("y")}scrollX(){return this.bi("x")}}var r7=e=>s9(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class r9{constructor(e,t,i,s){this.wi=e=>{var t=this.xi();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.ki(this._instance)};this.Si.register({[iv]:i})}},this._instance=e,this.Ci=t,this.Si=i,this.ki=s||r7,this.Ci.onSessionId(this.wi)}xi(){return this.Si.props[iv]}getSetOnceProps(){var e,t=null==(e=this.xi())?void 0:e.props;return t?"r"in t?re(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return iN(iB(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+R(i)]=t}),e}}class ne{constructor(){this.Ii={}}on(e,t){return this.Ii[e]||(this.Ii[e]=[]),this.Ii[e].push(t),()=>{this.Ii[e]=this.Ii[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Ii[e]||[])i(t);for(var s of this.Ii["*"]||[])s(e,t)}}var nt=tR("[SessionId]");class ni{on(e,t){return this.Ti.on(e,t)}constructor(e,t,i){if(this.Ei=null,this.Mi=[],this.Ri=void 0,this.Pi=!1,this.Ti=new ne,this.Oi=(e,t)=>!(!Y(e)||!Y(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===i$)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.Si=e.persistence,this.Li=void 0,this.Ai=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Fi=t||iQ,this.Ni=i||iQ;var s,r=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*ei(this.qt.session_idle_timeout_seconds||1800,60,36e3,nt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Di(),this.$i="ph_"+r+"_window_id",this.qi="ph_"+r+"_primary_window_exists",this.ji()){var n=se.F(this.$i),o=se.F(this.qi);n&&!o?this.Li=n:se.q(this.$i),se.N(this.qi,!0)}if(null!=(s=this.qt.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this.qt.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.Bi(this.qt.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){nt.error("Invalid sessionID in bootstrap",e)}this.Hi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return z(this.Mi)&&(this.Mi=[]),this.Mi.push(e),this.Ai&&e(this.Ai,this.Li),()=>{this.Mi=this.Mi.filter(t=>t!==e)}}ji(){return"memory"!==this.qt.persistence&&!this.Si.Tr&&se.O()}Ui(e){e!==this.Li&&(this.Li=e,this.ji()&&se.N(this.$i,e))}zi(){return this.Li?this.Li:this.ji()?se.F(this.$i):null}Vi(e){var t=this.Ei;return!G(t)&&!G(e)&&5e3>Math.abs(e-t)}Bi(e,t,i){var s=t!==this._sessionActivityTimestamp,r=e===this.Ai&&i===this._sessionStartTimestamp;this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Ai=e,r&&!s||r&&this.Vi(t)||(this.Ei=t,this.Si.register({[t2]:[t,e,i]}))}Wi(){var e,t=null==(e=this.qt)?void 0:e.persistence_save_debounce_ms;return Y(t)&&t>0}Gi(){this.Wi()?this.Si.refreshKey(t2):(this.Si.flush(),this.Si.load())}Zi(){var e;if(!G(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ei){this.Gi();var[,t,i]=this.Qi();t===this.Ai&&i===this._sessionStartTimestamp&&(this.Ei=this._sessionActivityTimestamp,this.Si.register({[t2]:[this._sessionActivityTimestamp,null!=(e=this.Ai)?e:null,this._sessionStartTimestamp]}),this.Si.flush())}}Ji(){var[e]=this.Qi();return Math.max(Y(e)?e:0,Y(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}Ki(e){return this.Gi(),this.Oi(e,this.Ji())}Qi(){var e=this.Si.props[t2];return D(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ei=null,clearTimeout(this.Yi),this.Yi=void 0,this.Bi(null,null,null)}destroy(){this.Pi=!0,this.Zi(),clearTimeout(this.Yi),this.Yi=void 0,this.Ri&&i&&(i.removeEventListener(iO,this.Ri,{capture:!1}),this.Ri=void 0),this.Mi=[]}Hi(){this.Ri=()=>{this.Zi(),this.ji()&&se.q(this.qi)},iW(i,iO,this.Ri,{capture:!1})}
1checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.qt.cookieless_mode===i$)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this.Qi(),n=this.Ji(),o=this.zi(),a=Y(r)&&Math.abs(i-r)>864e5,l=!1,u=!1,c=!s,h=s,d=!c&&!e&&this.Oi(i,n);d&&((d=this.Ki(i))||nt.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,r]=this.Qi()),c||d||a?(s=this.Fi(),o=this.Ni(),nt.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:a}}),r=i,l=!0):(o||(o=this.Ni(),l=!0),(u=s!==h)&&(nt.info("adopted cross-tab session id",{sessionId:s,windowId:o}),l=!0));var p=Y(n)&&e&&!a?n:i,v=Y(r)?r:(new Date).getTime();this.Ui(o),this.Bi(s,p,v),e||this.Di();var g={noSessionId:c,activityTimeout:d,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.Mi.forEach(e=>e(s,o,g)),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?g:void 0,lastActivityTimestamp:n}}Di(){this.Pi||(clearTimeout(this.Yi),this.Yi=setTimeout(()=>{if(!this.Pi)if(this.Ki((new Date).getTime())){var e=this.Ai;this.resetSessionId(),this.Ti.emit("forcedIdleReset",{idleSessionId:e})}else this.Di()},1.1*this.sessionTimeoutMs))}}var ns=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&M(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>M(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},nr=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function nn(e,t,i){return rZ({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var no={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>nr(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!nr(t,e))),icontains:(e,t)=>t.map(na).some(t=>e.map(na).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(na).every(t=>e.map(na).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},na=e=>e.toLowerCase();function nl(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(z(r)||G(r))return!1;var n=[String(r)],o=no[s.operator];return!!o&&o(s.values,n)})}var nu="custom",nc="i.posthog.com",nh=/^\/static\//;class nd{constructor(e){this.Xi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+nc,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Xi[this.apiHost]||(this.Xi[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":nu),this.Xi[this.apiHost]}en(e){if(nh.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this.en(t);if(i)return""+i+t}if(this.region===nu)return this.apiHost+t;var s=nc+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var np=tR("[Surveys]"),nv="seenSurvey_",ng=["popover","widget","api"],n_={ignoreConditions:!1,ignoreDelay:!1,displayType:rc},nf=tR("[PostHog ExternalIntegrations]"),nm={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ny{constructor(e){this._instance=e}ur(e,t){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return nf.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,i=function(e){var i,s,n;!r||null!=(i=d.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.ur(nm[e],()=>{var i;null==(i=d.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)}),!r&&null!=(s=d.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=d.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[s,r]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))i(s)}}var nb,nx,nw={},nE=0,nk=()=>{}
1,nS='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',nF="Surveys module not available",nP="sanitize_properties is deprecated. Use before_send instead",n$="Invalid value for property_denylist config: ",nI="posthog",nT=!rY&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),nM=e=>{var t;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!U(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of iG)if(i===s)return!1;return!0}(null==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:nk,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:o&&U(null==o?void 0:o.search)&&-1!==o.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,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==i||null==(t=i.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){tO.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:iM,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:nk},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:sf,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e)})},nC=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],nO=e=>{var t={};for(var[i,s]of nC)z(e[i])||(t[s]=e[i]);var r=ij({},t,e),n=e.__preview_external_dependency_versioned_paths;return z(n)||(z(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),U(n)&&z(e.asset_host)&&(r.asset_host=n)),D(e.property_blacklist)&&(z(e.property_denylist)?r.property_denylist=e.property_blacklist:D(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:tO.error(n$+e.property_denylist)),r};class nR{constructor(){this.__forceAllowLocalhost=!1}get tn(){return this.__forceAllowLocalhost}set tn(e){tO.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class nA{rn(e,t){if(e){var i=this.nn.indexOf(e);-1!==i&&this.nn.splice(i,1)}return this.nn.push(t),null==t.initialize||t.initialize(),t}sn(){return this.config.cookieless_mode===i$||this.config.cookieless_mode===iP&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new nR,this.an=!1,this.version=v.LIB_VERSION,this.ln=new ne,this.nn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nM(),this.SentryIntegration=sz,this.sentryIntegration=e=>{var t;return t=sH(this,e),{name:sj,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.un=!1,this.hn=null,this.cn=null,this.dn=null,this.scrollManager=new r4(this),this.pageViewManager=new sU(this),this.rateLimiter=new rd(this),this.requestRouter=new nd(this),this.consent=new st(this),this.externalIntegrations=new ny(this);var e,t=null!=(e=nA.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>tO.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==nI){var s,r=null!=(s=nw[i])?s:new nA;return r._init(e,t,i),nw[i]=r,nw[nI][i]=r,r}return this._init(e,t,i)}_init(e,t,s){void 0===t&&(t={});var r,n,o=U(e)?e.trim():"";if(!o)return tO.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={},t.debug=this.vn(t.debug),this.fn=t,this.pn=[],t.person_profiles?this.cn=t.person_profiles:t.process_person&&(this.cn=t.process_person);var a=nM(t.defaults),l=nO(t),u=ij({},a,l,{name:s,token:o});j(a.rageclick)&&j(l.rageclick)&&(u.rageclick=ij({},a.rageclick,l.rageclick)),this.set_config(u),this.config.on_xhr_error&&tO.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:rg;var c=this.gn();this.persistence=new rn(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rn(f({},this.config,{persistence:"sessionStorage"}),c,!1);var h=f({},this.persistence.props),d=f({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.mn=new r5(e=>this.yn(e),this.config.request_queue_config),this.bn=new r6(this),this.__request_queue=[];var p=this.sn();if(p||(this.sessionManager=new ni(this),this.sessionPropsManager=new r9(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(tO.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._n(p)},0)):(tO.info("Initializing extensions synchronously"),this._n(p)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&tO.info("Starting in debug mode",{this:this,config:t,thisC:f({},this.config),p:h,s:d}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=f({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
1)),void 0!==(null==(n=t.bootstrap)?void 0:n.distinctID)){var g=t.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(ip);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===iI)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===iT)tO.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(iQ()),b=t.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(ip,t.bootstrap.isIdentifiedID?iT:iI),this.register({distinct_id:g,$device_id:b})}}if(p)this.register_once({distinct_id:iw,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(iQ());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(ip,iI)}return iW(i,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||iQ();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(ip,iT)),t()},r=i.user();"then"in r&&N(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register((Promise&&Promise.resolve||sN.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(sN.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(sN.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,iR),identify:e=>s(e,iL),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.wn()):this.wn(),N(this.config._onCapture)&&this.config._onCapture!==nk&&(tO.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tO.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}_n(e){var t,i,s,r,n,o,a,l=performance.now(),u=f({},nA.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.nn.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.nn.push(this.exceptions=null!=(i=this.exceptions)?i:new u.exceptions(this)),u.historyAutocapture&&this.nn.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.nn.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.nn.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.nn.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.nn.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.nn.push(this.surveys=null!=(s=this.surveys)?s:new u.surveys(this)),u.logs&&this.nn.push(this.logs=null!=(r=this.logs)?r:new u.logs(this)),u.conversations&&this.nn.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.nn.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.nn.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.nn.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.nn.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.nn.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,sq)),u.toolbar&&this.nn.push(this.toolbar=null!=(o=this.toolbar)?o:new u.toolbar(this)),u.experiments&&this.nn.push(this.experiments=null!=(a=this.experiments)?a:new u.experiments(this)),this.nn.forEach(e
1=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.xn){var e=this.xn;this.xn=void 0,this.Qr(e)}}),this.kn(c,l)}kn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.kn(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){tO.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[iE]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ik]:s}),this.config.__preview_deferred_init_extensions&&tO.info("PostHog extensions initialized ("+s+"ms)")}Qr(e){var t;n&&n.body?(this.config.__preview_deferred_init_extensions&&(this.xn=e),this.Sn=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=C(e.supportedCompression,rg)?rg:C(e.supportedCompression,r_)?r_:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.cn?this.cn:iM}),this.nn.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))):(tO.info("document not ready yet, trying again in 500 milliseconds..."),setTimeout(()=>{this.Qr(e)},500))}wn(){try{this.config.loaded(this)}catch(e){tO.critical("`loaded` function failed",e)}if(this.Cn(),this.config.internal_or_test_user_hostname&&null!=o&&o.hostname){var e=o.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.sn())&&this.In()},1),this.Tn=new rv(this),this.Tn.load()}Cn(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.mn)||e.enable())}_dom_loaded(){this.is_capturing()&&iD(this.__request_queue,e=>this.yn(e)),this.__request_queue=[],this.Cn()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.En()&&this.capture(iA),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this.mn)||i.unload(),null==(s=this.bn)||s.unload()):this.En()&&this.capture(iA,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(nT?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=rX(e.url,{ip:+!!this.config.ip}),e.headers=f({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(z(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r=f({},e);r.timeout=r.timeout||6e4,r.url=r2(r.url,r.compression);var n=null!=(t=r.transport)?t:"fetch",o=r3.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!=(i=null==(s=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===n)return e[t]}(o))?void 0:s.method)?i:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===rg&&c&&!rJ?r1(r).then(e=>{a(e)}).catch(t=>{F(t)?(rJ=!0,a(f({},r,{compression:void 0,url:r2(e.url,void 0)}))):((e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return F(e)||t===k})(t)&&(rJ=!0),a(r))}):a(r)})(f({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}yn(e){this.bn?this.bn.retriableRequest(e):this._send_request(e)}_execute_array(e){nE++;try{var t,i=[],s=[],r=[];iD(e,e=>{if(e)if(D(t=e[0]))r.push(e);else if(N(e))try{e.call(this)}catch(t){tO.error("Error executing queued PostHog call",e,t)}else D(e)&&"alias"===t?i.push(e):D(e)&&-1!==t.indexOf("capture")&&N(this[t])?r.push(e):s.push(e)});var n=function(e,t){iD(e,function(e){try{if(D(e[0])){var i=t;iN(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){tO.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{nE--}}push(e){if(nE>0&&D(e)&&U(e[0])){var t=nA.prototype[e[0]];N(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.mn){if(this.is_capturing())if(!z(e)&&U(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!U(null==t?void 0:t.$current_url)&&(tO.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.Mn||tO.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==i?void 0:i.timestamp)||c,d=(null==i?void 0:i.uuid)||iQ(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===iR&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var v,g,_,m=this.Rn(null==i?void 0:i.$set_once,e!==iq,e===iL);if(m&&(p.$set_once=m),null!=i&&i._noTruncate||(r=this.config.properties_string_max_length,n=p,o=e=>U(e)?e.slice(0,r):e,a=new Set,p=function e(t,i){var s;return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),D(t)?(s=[],iD(t,t=>{s.push(e(t))})):(s={},iN(t,(t,i)=>{a.has(t)||(s[i]=e(t,i))}
1)),s)}(n)),p.timestamp=h,z(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),"survey dismissed"===e||e===ru){var y=null==t?void 0:t.$survey_id,b=null==t?void 0:t.$survey_iteration;(e=>{try{var t,i=(t=""+nv+e.id,e.current_iteration&&e.current_iteration>0&&(t=""+nv+e.id+"_"+e.current_iteration),t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(e){np.error("Failed to persist survey seen state",e)}})({id:y,current_iteration:b}),p.$set=f({},p.$set,{[(v={id:y,current_iteration:b},_="$survey_"+(g=e===ru?"responded":"dismissed")+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(_="$survey_"+g+"/"+v.id+"/"+v.current_iteration),_)]:!0})}else e===rl&&(p.$set=f({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var x=null==t?void 0:t.$product_tour_type;x&&(p.$set=f({},p.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var w=f({},p.properties.$set,p.$set);if(H(w)||this.setPersonPropertiesForFlags(w),!W(this.config.before_send)){var E=this.Pn(p);if(!E)return;p=E}this.ln.emit("eventCaptured",p);var k={method:"POST",url:null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,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.yn(k):this.mn.enqueue(k),p}tO.critical("This capture call is ignored due to client rate limiting.")}}else tO.error("No event name provided to posthog.capture")}else tO.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,s,r,a){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var l,u=a?void 0:this.persistence.remove_event_timer(e),c=f({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.sn()&&(c.$cookieless_mode=!0),"$snapshot"===e){var d=f({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=d.distinct_id,(!U(c.distinct_id)&&!V(c.distinct_id)||B(c.distinct_id))&&tO.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,g=function(e,t,s){if(!h)return{};var r,n,a,l,u,c,d,p,g,_,f,m,y=e?[...sQ,...t||[]]:[],[b,x]=function(e){for(var t=0;e7.length>t;t++){var[i,s]=e7[t],r=i.exec(e),n=r&&(N(s)?s(r,e):s);if(n)return n}return["",""]}(h),w=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},E={detectGoogleSearchApp:s},k=ij(iB({$os:b,$os_version:x,$browser:e8(h,navigator.vendor,w,E),$device:e9(h),$device_type:(d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==i||null==(a=i.screen)?void 0:a.width,screenHeight:null==i||null==(l=i.screen)?void 0:l.height,devicePixelRatio:null==i?void 0:i.devicePixelRatio},(m=e9(h))===eh||m===ec||"Kobo"===m||"Kindle Fire"===m||m===eH?eu:m===eT||m===eC||m===eM||m===eD?"Console":m===ep?"Wearable":m?ea:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!=(p=null==d?void 0:d.maxTouchPoints)?p:0)>0?600>Math.min(null!=(g=null==d?void 0:d.screenWidth)?g:0,null!=(_=null==d?void 0:d.screenHeight)?_:0)/(null!=(f=null==d?void 0:d.devicePixelRatio)?f:1)?ea:eu:"Desktop"),$timezone:rt(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:sJ(null==o?void 0:o.href,y,s1),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:e4(h,navigator.vendor,w,E),$browser_language:s6(),$browser_language_prefix:"string"==typeof(c=s6())?c.split("-")[0]:void 0,$screen_height:null==i?void 0:i.screen.height,$screen_width:null==i?void 0:i.screen.width,$viewport_height:null==i?void 0:i.innerHeight,$viewport_width:null==i?void 0:i.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&&(k.$sdk_dist_channel=v.SDK_DIST_CHANNEL),k}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:_,windowId:m}=this.sessionManager.checkAndGetSessionAndWindowId(a,s.getTime());c.$session_id=_,c.$window_id=m}this.sessionPropsManager&&ij(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&ij(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(l=this.bn)?void 0:l.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===nu&&(c.$lib_custom_api_host=this.config.api_host),p=e!==iR||a?e!==iA||a?this.pageViewM
1anager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),c=ij(c,p),e===iR&&n&&(c.title=n.title),!z(u)){var y=s.getTime()-u;c.$duration=parseFloat((y/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=ij({},g,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?iN(this.config.property_denylist,function(e){delete c[e]}):tO.error(n$+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(tO.error(nP),c=b(c,e));var x=this.On();return c.$process_person_profile=x,x&&!a&&this.Ln("_calculate_event_properties"),c}Rn(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.On()||this.an&&!i)return e;var s,r=ij({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(tO.error(nP),r=n(r,"$set_once")),t&&(this.an=!0),H(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}An(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.ln.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:nF}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:nF})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:nF})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=n_),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:nF}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:nF})}Fn(e){return!e||B(e)?(tO.critical("Unique user id has not been set in posthog.identify"),!1):e===iw?(tO.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(tO.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return tO.uninitializedWarning("posthog.identify");if(V(e)&&(e=e.toString(),tO.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Fn(e)&&this.Ln("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(tD)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(tN)&&(this.unregister(tN),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(ip)||iI)===iI;e!==s&&n?(this.persistence.set_property(ip,iT),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(iL,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.dn=nn(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(iu))}}setPersonProperties(e,t){if((e||t)&&this.Ln("posthog.setPersonProperties")){var i=nn(this.get_distinct_id(),e,t);this.dn!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.dn=i):tO.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:f({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};
1i&&(n.$group_set=i),this.capture(iq,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else tO.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.Ln("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(tO.info("reset"),!this.__loaded)return tO.uninitializedWarning("posthog.reset");var t,i,s,r,n,o,a,l,u,c=this.get_property(tD),h=this.get_property(tJ);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),z(h)||null==(u=this.persistence)||u.register({[tJ]:h}),null==(s=this.surveys)||s.reset(),null==(r=this.Tn)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(ip,iI),null==(l=this.sessionManager)||l.resetSessionId(),this.dn=null,this.config.cookieless_mode===i$)this.register_once({distinct_id:iw,$device_id:null},"");else{var d=this.config.get_device_id(iQ());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Nn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Dn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(tq)?(tO.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ln("posthog.alias")?(z(t)&&(t=this.get_distinct_id()),e!==t?(this.An(tN,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tO.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=f({},this.config);if(j(e)){ij(this.config,nO(e));var i,s,r,n,o,a,l,u,c,h,d,p=this.gn();null==(i=this.persistence)||i.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rn(f({},this.config,{persistence:"sessionStorage"}),p,!1);var g=this.vn(this.config.debug);K(g)&&(this.config.debug=g),K(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,i8.O()&&i8.N("ph_debug",!0),tO.info("set_config",{config:e,oldConfig:t,newConfig:f({},this.config)})):(v.DEBUG=!1,i8.O()&&i8.q("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.exceptions)||r.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.$n(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){v.LIB_NAME=e,v.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(f({},s,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:nA.qn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:nI;return t!==nI&&(t=nI+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ip))===iT||(null==(t=this.sessionPersistence)?void 0:t.get_property(ip))===iT}On(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===iM&&!this._isIdentified()&&H(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tN])&&(null==(t=this.persistence)||null==(t=t.props)||!t[ib]))}En(){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.On()||this.Ln("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ln("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ln(e){return"never"===this.config.person_profiles?(tO.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.An(ib,!0),!0)}gn(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==iP)}$n(){var e,t,i,s,r=this.gn();return(null==(e=this.persistence)?void 0:e.Tr)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.Tr)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==i$){if(this.sn()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new ni(this),this.pageViewManager=new sU(this),this.persistence&&(this.sessionPropsManager=new r9(this,this.sessionManager,this.persistence));var i,s,r,n,o,a,l,u,c=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=nA.__defaultExtensionClasses)?void 0:l.sessionRecording;c&&(this.sessionRecording=this.rn(this.sessionRecording,new c(this)),this.Sn&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Sn)))}this.consent.optInOut(!0),this.$n(),this.Cn(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==iP&&(null==(i=this.surveys)||i.loadIfEnabled()),(z(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.In()}else tO.warn(nS)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==i$?(this.config.cookieless_mode===iP&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.$n(),this.config.cookieless_mode===iP&&(this.register({distinct_id:iw,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.In(),this.Cn())):tO.warn(nS)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===i$||(this.config.cookieless_mode===iP?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$n()}_is_bot(){return r?ns(r,this.config.custom_blocked_useragents):void 0}In(){n&&("visible"===n.visibilityState?this.un||(this.un=!0,this.capture(iR,{title:n.title},{send_instantly:!0}),this.hn&&(n.removeEventListener(iC,this.hn),this.hn=null)):this.hn||(this.hn=this.In.bind(this),iW(n,iC,this.hn)))}debug(e){!1===e?(null==i||i.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==i||i.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}))}Kr(){var e,t,i,s,r=this.fn||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tO.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!W(r[e]),s=t in r&&!W(r[t]),i?r[e]:!!s&&(tO&&tO.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}Pn(e){if(W(this.config.before_send))return e;var t=D(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(W(i=s(i))){var r="Event '"+e.event+"' was rejected in beforeSend function";return J(e.event)?tO.warn(r+". This can cause unexpected behavior."):tO.info(r),null}i.properties&&!H(i.properties)||tO.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.dr)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}vn(e){var t=K(e)&&!e,i=i8.O()&&"true"===i8.A("ph_debug");return!t&&(!!i||e)}}nA.__defaultExtensionClasses={},nA.qn={trace:nx=()=>{},debug:nx,info:nx,warn:nx,error:nx,fatal:nx},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=iU(e.prototype[t[i]])}(nA,["identify"]);
1class nL{constructor(e){this.disabled=!1===e;var t=j(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var nq="$copy_autocapture",nD=tR("[AutoCapture]");function nN(e,t){return t.length>e?t.slice(0,e)+"...":t}var nj=tR("[ExceptionAutocapture]"),nH=tR("[TracingHeaders]"),nz=tR("[Web Vitals]"),nU="disabled",nB="lazy_loading",nG="awaiting_config",nW="missing_config";tR("[SessionRecording]"),tR("[SessionRecording]");var nV="[SessionRecording]",nY=tR(nV),nK=tR("[Heatmaps]");function nJ(e){return j(e)&&"clientX"in e&&"clientY"in e&&V(e.clientX)&&V(e.clientY)}var nX=tR("[Product Tours]"),nZ=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(tY))},nQ=["$set_once","$set"],n0=tR("[SiteApps]"),n1="Error while initializing PostHog app with config id ";function n2(e,t,i){if(W(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class n3{constructor(e){this.jn=new ne,this.Bn=(e,t)=>this.Hn(e,t)&&this.Un(e,t)&&this.zn(e,t)&&this.Vn(e,t),this.Hn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Wn=new Set,this.Gn=new Set}init(){var e,t;z(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!z(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.Gn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Wn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Wn.has(e)||this.Wn.has(null==t?void 0:t.event))&&this.Gn&&(null==(i=this.Gn)?void 0:i.size)>0&&this.Gn.forEach(e=>{this.Zn(t,e)&&this.jn.emit("actionCaptured",e.name)})}Qn(e){this.onAction("actionCaptured",t=>e(t))}Zn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Bn(e,i))return!0;return!1}onAction(e,t){return this.jn.on(e,t)}Un(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!n2(s,t.url,t.url_matching||"contains"))return!1}return!0}zn(e,t){return!!this.Jn(e,t)&&!!this.Kn(e,t)&&!!this.Yn(e,t)}Jn(e,t){if(null==t||!t.href)return!0;var i=this.Xn(e);if(i.length>0)return i.some(e=>n2(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&n2((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}Kn(e,t){if(null==t||!t.text)return!0;var i=this.Xn(e);if(i.length>0)return i.some(e=>n2(e.text,t.text,t.text_matching||"exact")||n2(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,o,a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!W(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some(e=>n2(e,n,o)))}Yn(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}Xn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Vn(e,t){return null==t||!t.properties||0===t.properties.length||nl(t.properties.reduce((e,t)=>
1{var i=D(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class n5{constructor(e){this._instance=e,this.es=new Map,this.ts=new Map,this.rs=new Map}ns(e,t){return!!e&&nl(e.propertyFilters,null==t?void 0:t.properties)}ss(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}os(e,t,i){var s=(i===ro?this.es:this.ts).get(e),r=[];return this.ls(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.ns(n,t)})}register(e){var t;z(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.us(e),this.hs(e))}hs(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.cs&&(this.cs=new n3(this._instance),this.cs.init(),this.cs.Qn(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.cs)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.rs.get(t.name);i&&i.push(e.id),this.rs.set(t.name,i||[e.id])}}))}))}us(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.es=this.ss(e,ro),this.ts=this.ss(e,ra))}onEvent(e,t){var i,s=this.le(),r=this.ds(),n=this.vs(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var a,l,u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this.fs(o))}}else{if(this.ts.has(e)){var h=this.os(e,t,ra);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this.ps(e.id)}),this.fs(o))}if(this.es.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.es.get(e)});var d=this.os(e,t,ro);this.fs(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.ds(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.rs.has(e)&&this.fs(s.concat(this.rs.get(e)||[]))}fs(e){var t=this.le(),i=[...new Set(e)].filter(e=>!this.gs(e));t.info("updating activated items",{activatedItems:i}),this.ys(i)}getActivatedIds(){var e,t=this.ds();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.es}bs(){return this.cs}}class n8 extends n5{constructor(e){super(e)}ds(){return ia}vs(){return rl}
1ls(e){var t;null==(t=this._instance)||t.getSurveys(e)}ps(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}le(){return np}ys(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ia]:e})}gs(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var n6="SDK is not enabled or survey functionality is not yet loaded",n4="Disabled. Not loading surveys.",n7=null!=i&&i.location?sX(i.location.hash,"__posthog")||sX(location.hash,"state"):null,n9="_postHogToolbarParams",oe=tR("[Toolbar]"),ot=tR("[FeatureFlags]"),oi=tR("[FeatureFlags]",{debugEnabled:!0}),os="\" failed. Feature flags didn't load in time.",or=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},on=e=>{var t={};for(var[i,s]of iH(e||{}))s&&(t[i]=s);return t},oo=tR("[Error tracking]"),oa="Refusing to render web experiment since the viewer is a likely bot",ol={icontains:(e,t)=>!!i&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!i&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!i&&nr(t.href,e),not_regex:(e,t)=>!!i&&!nr(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class ou{get qt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{ou._s("retrieved web experiments from the server"),t.ws=new Map,e.forEach(e=>{if(e.feature_flag_key){t.ws&&(ou._s("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.ws)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);U(s)&&e.variants[s]&&t.xs(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];ou.ks(n)&&t.xs(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())ou._s(oa);else if(!this.qt.disable_web_experiments){if(W(this.ws))return this.ws=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ou._s("applying feature flags",e),e.forEach(e=>{var t;if(this.ws&&null!=(t=this.ws)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.ws)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.xs(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=ou.getWindowLocation();if(null!=e&&e.search){var t=sK(null==e?void 0:e.search,"__experiment_id"),i=sK(null==e?void 0:e.search,"__experiment_variant");t&&i&&(ou._s("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Ss(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.qt.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Ss(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(ou._s("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.xs(s[0].name,t,s[0].variants[t].transforms))}static ks(e){return!W(e.conditions)&&ou.Cs(e)&&ou.Is(e)}static Cs(e){if(W(e.conditions)||W(null==(t=e.conditions)?void 0:t.url))return!0;var t,i,s,r,n=ou.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||ol[null!=(s=null==(r=e.conditions)?void 0:r.urlMatchType)?s:"icontains"](e.conditions.url,n))}
1static getWindowLocation(){return null==i?void 0:i.location}static Is(e){if(W(e.conditions)||W(null==(i=e.conditions)?void 0:i.utm))return!0;var t=s3();if(t.utm_source){var i,s,r,n,o,a,l,u,c,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&p&&v&&d}return!1}static _s(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];tO.info("[WebExperiments] "+e,i)}xs(e,t,i){this._is_bot()?ou._s(oa):"control"!==t?i.forEach(i=>{if(i.selector){ou._s("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):ou._s("Control variants leave the page unmodified.")}_is_bot(){return r&&this._instance?ns(r,this.qt.custom_blocked_useragents):void 0}}var oc=tR("[Conversations]"),oh="Conversations not available yet.",od={featureFlags:class{constructor(e){this.Ts=!1,this.Es=!1,this.Ms=!1,this.Rs=!1,this.Ps=!1,this.Os=!1,this.Ls=!1,this.As=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get Si(){return this._instance.persistence}Fs(e){return this._instance.get_property(e)}Ns(){var e,t;return null!=(e=null==(t=this.Si)?void 0:t.Mr(this.qt.feature_flag_cache_ttl_ms))&&e}Ds(){return!!this.Ns()&&(this.As||this.Ms||(this.As=!0,ot.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}$s(){var e,t=null!=(e=this.qt.evaluation_contexts)?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.Ls||(ot.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Ls=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ot.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}qs(){return this.$s().length>0}js(){var e=this.qt.flag_keys;if(!z(e)){if(D(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||ot.error("Invalid flag key found:",e,"Expected non-empty string"),t});ot.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:i}=this._instance,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,o=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?r:{},a=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,i){var s=null!=i&&i.merge?this.getFlagVariants():{},r=null!=i&&i.merge?this.getFlagPayloads():{},n=f({},s,e),o=f({},r,t),a={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:z(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.Es}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Fs(t4),t=this.Fs(ie),i=this.Fs(it);if(!i&&!t)return e||{};var s=ij({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,o,a=s[r],l=null==t?void 0:t[r],u=z(l)?null!=(n=null==a?void 0:a.enabled)&&n:!!l,c=z(l)?a.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[r],d=f({},a,{enabled:u,variant:u?null!=c?c:null==a?void 0:a.variant:void 0});u!==(null==a?void 0:a.enabled)&&(d.original_enabled=null==a?void 0:a.enabled),c!==(null==a?void 0:a.variant)&&(
1d.original_variant=null==a?void 0:a.variant),h&&(d.metadata=f({},null==a?void 0:a.metadata,{payload:h,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),s[r]=d}return this.Ts||(ot.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Ts=!0),s}getFlagVariants(){var e=this.Fs(t5),t=this.Fs(ie);if(!t)return e||{};for(var i=ij({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Ts||(ot.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Ts=!0),i}getFlagPayloads(){var e=this.Fs(t7),t=this.Fs(it);if(!t)return e||{};for(var i=ij({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Ts||(ot.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Ts=!0),i}reloadFeatureFlags(){this.Rs||this.qt.advanced_disable_feature_flags||this.Bs||(this._instance.ln.emit("featureFlagsReloading",!0),this.Bs=setTimeout(()=>{this.Hs()},5))}Us(){clearTimeout(this.Bs),this.Bs=void 0}ensureFlagsLoaded(){this.Es||this.Ms||this.Bs||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Rs=e}Hs(e){var t;if(this.Us(),!this._instance.Kr())if(this.Ms)this.Ps=!0;else{var i=this.qt.token,s=this.Fs(tD),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},(null==(t=this.Si)?void 0:t.get_initial_props())||{},this.Fs(ii)||{}),group_properties:this.Fs(is),timezone:rt()};G(s)||z(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.qs()&&(r.evaluation_contexts=this.$s());var n=this.js();z(n)||(r.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.Ms=!0,this._instance._send_request({method:"POST",url:a,data:r,compression:this.qt.disable_compression?void 0:r_,timeout:this.qt.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.Ps||(this.$anon_distinct_id=void 0),n=!1),this.Ms=!1,!r.disable_flags||this.Ps){this.Os=!n;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));(u&&a.push("quota_limited"),null==(s=this.Si)||s.register({[ih]:a}),u)?ot.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags(null!=(l=e.json)?l:{},n,{partialResponse:o}),this.Ps&&(this.Ps=!1,this.Hs()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.Os)if(this.Es||this.getFlags()&&this.getFlags().length>0){if(!this.Ds()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else ot.warn('getFeatureFlag for key "'+e+os)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.Os)if(this.Es||this.getFlags()&&this.getFlags().length>0){if(!this.Ds()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Fs(t9)||void 0,l=this.Fs(id)||void 0,u=this.Fs(iu)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Fs(ic);h&&h!==d&&(u={},null==(c=this.Si)||c.register({[iu]:u,[ic]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){D(u[e])?u[e].push(o):u[e]=[o],null==(_=this.Si)||_.register({[iu]:u});var p=this.getFeatureFlagDetails(e),v=[...null!=(f=this.Fs(ih))?f:[]];z(r)&&v.push("flag_missing");var g={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(m=this.qt.bootstrap)||null==(m
1=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.qt.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.Os};z(null==p||null==(b=p.metadata)?void 0:b.version)||(g.$feature_flag_version=p.metadata.version);var _,f,m,y,b,x,w,E,k,S,F,P=null!=(x=null==p||null==(w=p.reason)?void 0:w.description)?x:null==p||null==(E=p.reason)?void 0:E.code;P&&(g.$feature_flag_reason=P),null!=p&&null!=(k=p.metadata)&&k.id&&(g.$feature_flag_id=p.metadata.id),z(null==p?void 0:p.original_variant)&&z(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=z(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(S=p.metadata)&&S.original_payload&&(g.$feature_flag_original_payload=null==p||null==(F=p.metadata)?void 0:F.original_payload),v.length&&(g.$feature_flag_error=v.join(",")),this._instance.capture("$feature_flag_called",g)}if(s){var $=n;if(!z(n))try{$=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:$}}}}else ot.warn('getFeatureFlagResult for key "'+e+os)}getRemoteConfigPayload(e,t){var i=this.qt.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.qs()&&(s.evaluation_contexts=this.$s());var r=this.js();z(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.qt.disable_compression?void 0:r_,timeout:this.qt.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.Os){if(this.Es||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return z(i)?void 0:!!i}ot.warn('isFeatureEnabled for key "'+e+os)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.Si){this.Es=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,s,r,n){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var o,a=((o=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!=(t=o[e].variant)?t:o[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):ot.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(D(u)){ot.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var v=0;u.length>v;v++)p[u[v]]=!0;t&&t.register({[t8]:u,[t5]:p})}else{var g=u,_=c,m=l;if(null!=n&&n.partialResponse)g=f({},i,g),_=f({},s,_),m=f({},r,m);else if(e.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=f({},i,Object.fromEntries(Object.entries(g).filter(e=>{var[t]=e;return y.has(t)}))),_=f({},s,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return y.has(t)}))),m=f({},r,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)})))}else g=f({},i,g),_=f({},s,_),m=f({},r,m);t&&t.register(f({[t8]:Object.keys(on(g)),[t5]:g||{},[t7]:_||{},[t4]:m||{}},h?{[t9]:h}:{},d?{[id]:d}:{}))}}}(e,this.Si,s,r,n,i),t||(this.As=!1),this.zs(t)}}override(e,t){void 0===t&&(t=!1),ot.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Si)return ot.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Si.unregister(ie),this.Si.unregister(it),this.zs(),oi.info("All overrides cleared");if(D(e)){var t,i=or(e);return this.Si.register({[ie]:i}),this.zs(),oi.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Ts=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Si.unregister(ie),oi.info("Flag overrides cleared");else if(e.flags){if(D(e.flags)){var s=or(e.flags);this.Si.register({[ie]:s})}else this.Si.register({[ie]:e.flags});oi.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Si.unregister(it),oi.info("Payload overrides cleared")):e.payloads&&(this.Si.register({[it]:e.payloads}),oi.info("Payload overrides set",{payloads:e.payloads}))),void this.zs()}if(e&&"object"==typeof e)return this.Si.register({[ie]:e}),this.zs(),oi.info("Flag overrides set",{flags:e});ot.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Es){var{flags:t,flagVariants:i}=this.Vs();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Fs(t6)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f({},this.getFlagVariants(),{[e]:t});null==(s=this.Si)||s.register({[t8]:Object.keys(on(a)),[t5]:a}),this.zs()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Fs(t6),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.Si)||i.unregister(t6),null==(s=this.Si)||s.register({[t6]:r}),e(r)}}})}Vs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}zs(e){var{flags:t,flagVariants:i}=this.Vs();
1this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Fs(ii)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this._instance.register({[ii]:f({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(ii),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Fs(is)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=f({},i[t],e[t]),delete e[t]}),this._instance.register({[is]:f({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Fs(is)||{};this._instance.register({[is]:f({},t,{[e]:{}})})}else this._instance.unregister(is)}reset(){this.Es=!1,this.Ms=!1,this.Rs=!1,this.Ps=!1,this.Os=!1,this.$anon_distinct_id=void 0,this.Us(),this.Ts=!1}}},op=f({productTours:class{get Si(){return this._instance.persistence}constructor(e){this.ia=null,this.na=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,i;if(this.Si&&this.Si.register({[tY]:!!e.productTours}),!nZ(this._instance))return!this.ia&&W(null==(t=this.Si)?void 0:t.props[il])||nX.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.ia)||i.stop(),this.ia=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ia&&nZ(this._instance)&&this.ur(()=>this.sa())}ur(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?nX.error("Could not load product tours script",t):e()})}sa(){var e;!this.ia&&null!=(e=d.__PosthogExtensions__)&&e.generateProductTours&&(this.ia=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!D(this.na)||t){var i=this.Si;if(i){var s=i.props[il];if(D(s)&&!t)return this.na=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{if(nZ(this._instance)){var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return nX.error(r),void e([],{isLoaded:!1,error:r})}var n=D(t.json.product_tours)?t.json.product_tours:[];this.na=n,i&&i.register({[il]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.na,{isLoaded:!0})}getActiveProductTours(e){W(this.ia)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ia.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.ia)||t.showTourById(e)}previewTour(e){this.ia?this.ia.previewTour(e):this.ur(()=>{var t;this.sa(),null==(t=this.ia)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.ia)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.ia)||e.nextStep()}previousStep(){var e;null==(e=this.ia)||e.previousStep()}clearCache(){var e;this.na=null,null==(e=this.Si)||e.unregister(il)}resetTour(e){var t;null==(t=this.ia)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.ia)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.ia)||t.cancelPendingTour(e)}}},od),ov=f({surveys:class{get qt(){return this._instance.config}constructor(e){this.ga=void 0,this._surveyManager=null,this.ma=!1,this.ya=[],this.ba=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(W(t))return np.warn("Flags not loaded yet. Not loading surveys.");var i=D(t);this.ga=i?t.length>0:t,np.info("flags response received, isSurveysEnabled: "+this.ga),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(nv)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ma)np.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)np.info(n4);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())np.info("Not loading surveys in cookieless mode without consent.");else{var e=null==d?void 0:d.__PosthogExtensions__;if(e){if(!z(this.ga)||this.qt.advanced_enable_surveys){var t=this.ga||this.qt.advanced_enable_surveys;this.ma=!0;try{var i=e.generateSurveys;if(i)return void this._a(i,t);var s=e.loadExternalDependency;if(!s)return void this.wa(iF);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.wa("Could not load surveys script",i):this._a(e.generateSurveys,t)})}catch(e){throw this.wa("Error initializing surveys",e),e}finally{this.ma=!1}}}else np.error("PostHog Extensions not found.")}}_a(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new n8(this._instance),np.info("Surveys loaded successfully"),this.xa({isLoaded:!0})}wa(e,t){np.error(e,t),this.xa({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ya.push(e),this._surveyManager&&this.xa({isLoaded:!0}),()=>{this.ya=this.ya.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.qt.disable_surveys)return np.info(n4),e([]);var i,s=this._instance.get_property(ir);if(s&&!t)return e(s,{isLoaded:!0});"u">typeof Promise&&this.ba?this.ba.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("u">typeof Promise&&(this.ba=new Promise(e=>{i=e})),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:t=>{this.ba=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;np.error(r);var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,i;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[ir]:l,[io]:Date.now()});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}
1xa(e){for(var t of this.ya)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){np.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!W(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);np.warn("init was not called")}ka(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Sa(e){if(W(this._surveyManager))return{eligible:!1,reason:n6};var t="string"==typeof e?this.ka(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(W(this._surveyManager))return np.warn("init was not called"),{visible:!1,disabledReason:n6};var t=this.Sa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return W(this._surveyManager)?(np.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:n6})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.Sa(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(W(this._surveyManager))np.warn("init was not called");else{var r="string"==typeof e?this.ka(e):e;if(null!=r&&r.id)if(ng.includes(r.type)){var o=null==n?void 0:n.querySelector(t);if(o)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(np.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;np.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,o,i),np.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,o,i);np.warn("Survey element not found")}else np.warn("Surveys of type "+r.type+" cannot be rendered in the app");else np.warn("Survey not found")}}displaySurvey(e,t){var i;if(W(this._surveyManager))np.warn("init was not called");else{var s=this.ka(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=f({},s,{appearance:f({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==rc&&t.initialResponses&&np.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void np.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else np.warn("Survey not found")}}cancelPendingSurvey(e){W(this._surveyManager)?np.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},od),og=f({experiments:ou},od),o_=f({},od,{sessionRecording:class{get qt(){return this._instance.config}get Si(){return this._instance.persistence}get started(){var e;return!(null==(e=this.Ws)||!e.isStarted)}get status(){var e,t;return this.Gs===nG||this.Gs===nW?this.Gs:null!=(e=null==(t=this.Ws)?void 0:t.status)?e:this.Gs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Gs=nU,this.Zs=void 0,this._instance=e,!this._instance.sessionManager)throw nY.error("started without valid sessionManager"),Error(nV+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===i$)throw Error(nV+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Qs(){var e,t=!(null==(e=this._instance.get_property(tJ))||!e.enabled),s=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return i&&t&&s&&!r}startIfEnabledOrStop(e){var t;if(!this.Qs||null==(t=this.Ws)||!t.isStarted){var i=!z(Object.assign)&&!z(Array.from);this.Qs&&i?(this.Js(e),nY.info("starting")):(this.Gs=nU,this.stopRecording())}}Js(e){var t,i,s;this.Qs&&(this.Gs!==nG&&this.Gs!==nW&&(this.Gs=nB),null!=d&&null!=(t=d.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=d.__PosthogExtensions__)&&i.initSessionRecording?this.Ks(e):null==(s=d.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.Ys,t=>{if(t)return nY.error("could not load recorder",t);this.Ks(e)}))}stopRecording(){var e,t;null==(e=this.Zs)||e.call(this),this.Zs=void 0,null==(t=this.Ws)||t.stop()}Xs(){var e,t;null==(e=this.Zs)||e.call(this),this.Zs=void 0,null==(t=this.Ws)||t.discard()}eo(){var e,t;null==(e=this.Si)||e.unregister(t3),null==(t=this.Si)||t.unregister(tX)}ro(e,t){if(W(e))return null;var i=V(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(nY.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}io(e){if(this.Si){var t,i,s=this.Si,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.ro(null==(t=this.qt.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.ro(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;W(o)&&this.eo();var a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[tJ]:f({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:f({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:z(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.Zs)||t.call(this),this.Zs=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.io(e),void this.Xs()):(this.io(e),void this.startIfEnabledOrStop()):(this.Gs===nG&&(this.Gs=nW,nY.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Ws)&&i.log?this.Ws.log(e,t):nY.warn("log called before recorder was ready")}get Ys(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tJ);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}no(){var e,t,i=this._instance.get_property(tJ);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}
1catch(e){return nY.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var s=null!=(e=t.cache_timestamp)?e:Date.now();return 36e5>=Date.now()-s}Ks(e){var t,i;if(null==(t=d.__PosthogExtensions__)||!t.initSessionRecording)return nY.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[iS]:!0});if(this.Ws||(this.Ws=null==(i=d.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Ws._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.no()){if(this.Gs===nW||this.Gs===nG)return;return this.Gs=nG,nY.info("persisted remote config is stale, requesting fresh config before starting"),void new rv(this._instance).load()}this.Gs=nB,this.Ws.start(e)}onRRwebEmit(e){var t;null==(t=this.Ws)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Ws||null==(t=this.Si)||t.register({[tQ]:!0}),null==(e=this.Ws)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Ws||null==(t=this.Si)||t.register({[tZ]:!0}),null==(e=this.Ws)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Ws||null==(i=this.Si)||i.register({["url"===e?t0:t1]:!0}),null==(t=this.Ws)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Ws)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Ws)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.so=!1,this.oo=null,this.ao=!1,this.instance=e,this.rageclicks=new nL(e.config.rageclick),this.lo=null}initialize(){this.startIfEnabled()}get qt(){var e,t,i=j(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}uo(){if(this.isBrowserSupported()){if(i&&n){var e=e=>{e=e||(null==i?void 0:i.event);try{this.ho(e)}catch(e){nD.error("Failed to capture event",e)}};if(iW(n,"submit",e,{capture:!0}),iW(n,"change",e,{capture:!0}),iW(n,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=e=>{e=e||(null==i?void 0:i.event);try{this.ho(e,nq)}catch(e){nD.error("Failed to capture copy/cut event",e)}};iW(n,"copy",t,{capture:!0}),iW(n,"cut",t,{capture:!0})}}}else nD.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.so&&(this.uo(),this.so=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.ao=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[tH]:!!e.autocapture_opt_out}),this.oo=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.lo=e}getElementSelectors(e){var t,i=[];return null==(t=this.lo)||t.forEach(t=>{var s=null==n?void 0:n.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[tH];if(G(this.oo)&&!K(i)&&!this.instance.Kr())return!1;var s=null!=(t=this.oo)?t:!!i;return!!this.instance.config.autocapture&&!s}ho(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var s,r=sd(e);sn(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&sx(r,this.instance.config.rageclick)&&this.ho(e,"$rageclick");var n=t===nq;if(r&&function(e,t,s,r,n){if(void 0===s&&(s=void 0),!i||sw(e)||null!=(o=s)&&o.url_allowlist&&!sl(s.url_allowlist)||null!=(a=s)&&a.url_ignorelist&&sl(s.url_ignorelist))return!1;if(null!=(l=s)&&l.dom_event_allowlist){var o,a,l,u,c=s.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=sE(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(z(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,s)||!sv(d,null==(u=s)?void 0:u.css_selector_allowlist))return!1;var p=i.getComputedStyle(e);
1if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(sp.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.qt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t;if(!ss(e))return{props:{}};for(var c=[e],h=e;h.parentNode&&!sr(h,"body");)if(so(h.parentNode))c.push(h.parentNode.host),h=h.parentNode.host;else{if(!ss(h.parentNode))break;c.push(h.parentNode),h=h.parentNode}var d,p=[],v={},g=!1,_=!1;if(iN(c,e=>{var t=sk(e);if(sr(e,"a")){var i=e.getAttribute("href");g=t&&!!i&&sC(i)&&i}C(su(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};sp.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?nN(1024,sO(e)):nN(1024,sh(e)));var o=su(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),iN(e.attributes,function(i){var r;if((!sS(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&sC(i.value)&&(!U(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=sa(o).join(" ")),n["attr__"+i.name]=nN(1024,o)}});for(var a=1,l=1,u=e;u=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!ss(t))return t}(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l)),ij(v,function(e){if(!sk(e))return{};var t={};return iN(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&sC(s)&&(t[i]=s)}}),t}(e))}),_)return{props:{},explicitNoCapture:_};if(a||(p[0].$el_text=sr(e,"a")||sr(e,"button")?sO(e):sh(e)),g){p[0].attr__href=g;var m,y,b=null==(m=sY(g))?void 0:m.host,x=null==i||null==(y=i.location)?void 0:y.host;b&&x&&b!==x&&(d=g)}return{props:ij({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,i,s,r={text:null==(i=e.$el_text)?void 0:i.slice(0,400),tag_name:e.tag_name,href:null==(s=e.attr__href)?void 0:s.slice(0,2048),attr_class:(t=e.attr__class)?D(t)?t:sa(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return iH(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=f({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return iH(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return o[sR(t.toString())]=sR(i.toString())}),(s+=":")+iH(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},v)}}(r,{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.ao});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===nq){var u,c=sc(null==i||null==(u=i.getSelection())?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return N(null==n?void 0:n.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.co=(null==i||null==(t=i.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tO.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.do&&this.do(),this.do=void 0,tO.info("History API monitoring stopped")}monitorHistoryChanges(){i&&i.history&&(this.vo("pushState"),this.vo("replaceState"),this.fo())}vo(e){var t;if(i&&(null==(t=i.history[e])||!t.__posthog_wrapped__)){var s=this;!function(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);N(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r}catch(e){return()=>{}}}(i.history,e,t=>function(i,r,n){t.call(this,i,r,n),s.po(e)})}}po(e){try{var t,s=null==i||null==(t=i.location)?void 0:t.pathname;if(!s)return;s!==this.co&&this.isEnabled&&this._instance.capture(iR,{navigation_type:e}),this.co=s}catch(t){tO.error("Error capturing "+e+" pageview",t)}}fo(){if(!this.do){var e=()=>{this.po("popstate")};iW(i,"popstate",e),this.do=()=>{i&&i.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.mo=!1,this.so=!1,this.yo=null,this.instance=e,this.mo=!(null==(t=this.instance.persistence)||!t.props[tz]),this.rageclicks=new nL(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return j(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return W(this.qt.capture_heatmaps)?W(this.qt.enable_heatmaps)?this.mo:this.qt.enable_heatmaps:!1!==this.qt.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.so||(nK.info("starting..."),this.bo(),this.At());else{var e;clearInterval(null!=(e=this.yo)?e:void 0),this._o(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tz]:t}),this.mo=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}wo(e){this.Mt(e.originalEvent,"deadclick")}At(){this.yo&&clearInterval(this.yo),this.yo="visible"===(null==n?void 0:n.visibilityState)?setInterval(this.ci.bind(this),this.flushIntervalMilliseconds):null}bo(){i&&n&&(this.xo=this.ci.bind(this),iW(i,iO,this.xo),this.ko=e=>this.Mt(e||(null==i?void 0:i.event)),iW(n,"click",this.ko,{capture:!0}),this.So=e=>this.Co(e||(null==i?void 0:i.event)),iW(n,"mousemove",this.So,{capture:!0}),this.Io=new sD(this.instance,sL,this.wo.bind(this)),this.Io.startIfEnabledOrStop(),this.To=this.At.bind(this),iW(n,iC,this.To),this.so=!0)}_o(){var e;i&&n&&(this.xo&&i.removeEventListener(iO,this.xo),this.ko&&n.removeEventListener("click",this.ko,{capture:!0}),this.So&&n.removeEventListener("mousemove",this.So,{capture:!0}),this.To&&n.removeEventListener(iC,this.To),clearTimeout(this.Eo),null==(e=this.Io)||e.stop(),this.so=!1)}Mo(e,t){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,s){for(var r=e;r&&ss(r)&&!sr(r,"body")&&r!==s;){if(C(t,null==i?void 0:i.getComputedStyle(r).position))return!0;r=sg(r)}return!1}(sd(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:s),target_fixed:o,type:t}}Mt(e,t){var i;if(void 0===t&&(t="click"),!si(e.target)&&nJ(e)){var s=this.Mo(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&sx(sd(e),this.instance.config.rageclick)&&this.Ro(f({}
1,s,{type:"rageclick"})),this.Ro(s)}}Co(e){!si(e.target)&&nJ(e)&&(clearTimeout(this.Eo),this.Eo=setTimeout(()=>{this.Ro(this.Mo(e,"mousemove"))},500))}Ro(e){if(i){var t=i.location.href,s=this.qt.custom_personal_data_properties,r=sJ(t,this.qt.mask_personal_data_properties?[...sQ,...s||[]]:[],s1);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}ci(){this.M&&!H(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:sD,webVitalsAutocapture:class{constructor(e){var t;this.mo=!1,this.so=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Po=()=>{clearTimeout(this.Oo),0!==this.M.metrics.length&&(this._instance.capture("$web_vitals",this.M.metrics.reduce((e,t)=>f({},e,{["$web_vitals_"+t.name+"_event"]:f({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=e=>{this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t,i=this.Lo();if(!z(i))if(W(null==e?void 0:e.name)||W(null==e?void 0:e.value))nz.error("Invalid metric received",e);else if(!this.Ao||this.Ao>e.value){this.M.url!==i&&(this.Po(),this.Oo=setTimeout(this.Po,this.flushToCaptureTimeoutMs)),z(this.M.url)&&(this.M.url=i),this.M.firstMetricTimestamp=z(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),r=f({},e,{$current_url:i,timestamp:Date.now()});z(s)||(r.$session_id=s.sessionId,r.$window_id=s.windowId),this.M.metrics.push(r),this.M.metrics.length===this.allowedMetrics.length&&this.Po()}else nz.error("Ignoring metric with value >= "+this.Ao,e)},this.Fo=()=>{if(!this.so){var e,t,i,s,r=d.__PosthogExtensions__;z(r)||z(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.ht.bind(this)),this.so=!0):nz.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.mo=!(null==(t=this._instance.persistence)||!t.props[tW]),this.startIfEnabled()}get No(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=j(this.No)?null==(e=this.No)?void 0:e.web_vitals_allowed_metrics:void 0;return W(i)?(null==(t=this._instance.persistence)?void 0:t.props[tK])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(j(this.No)?this.No.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=j(this.No)?this.No.web_vitals_attribution:void 0;return null!=e&&e}get Ao(){var e=j(this.No)&&V(this.No.__web_vitals_max_value)?this.No.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==o?void 0:o.protocol;if("http:"!==e&&"https:"!==e)return nz.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=j(this.No)?this.No.web_vitals:K(this.No)?this.No:void 0;return K(t)?t:this.mo}startIfEnabled(){this.isEnabled&&!this.so&&(nz.info("enabled, starting..."),this.ur(this.Fo))}onRemoteConfig(e){if("capturePerformance"in e){var t=j(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=j(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tW]:t}),this._instance.persistence.register({[tK]:i})),this.mo=t,this.startIfEnabled()}}ur(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?nz.error("failed to load script",t):e()})}Lo(){var e=i?i.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return sJ(e,this._instance.config.mask_personal_data_properties?[...sQ,...t||[]]:[],s1)}nz.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,s,r;this.Fo=()=>{var e;if(i&&this.isEnabled&&null!=(e=d.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=
1d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Do&&this.qt.capture_unhandled_errors&&(this.Do=t(this.captureException.bind(this))),!this.$o&&this.qt.capture_unhandled_rejections&&(this.$o=s(this.captureException.bind(this))),!this.qo&&this.qt.capture_console_errors&&(this.qo=r(this.captureException.bind(this)))}catch(e){nj.error("failed to start",e),this.jo()}}},this._instance=e,this.Bo=!(null==(t=this._instance.persistence)||!t.props[tU]),this.Ho=new es({refillRate:null!=(s=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?s:1,bucketSize:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?r:10,refillInterval:1e4,Zt:nj}),this.qt=this.Uo(),this.startIfEnabledOrStop()}Uo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(e)?t=f({},t,e):(z(e)?this.Bo:e)&&(t=f({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(nj.info("enabled"),this.jo(),this.ur(this.Fo)):this.jo()}ur(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return nj.error("failed to load script",t);e()})}jo(){var e,t,i;null==(e=this.Do)||e.call(this),this.Do=void 0,null==(t=this.$o)||t.call(this),this.$o=void 0,null==(i=this.qo)||i.call(this),this.qo=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Bo=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tU]:this.Bo}),this.qt=this.Uo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.Uo()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.Ho.consumeRateLimit(r)?nj.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.zo=[],this.Vo=new tr([new tg,new tS,new tf,new t_,new tE,new tw,new ty,new tk],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),o=s;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=tv.test(a)?a.replace(tv,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){r.push(c);break}}if(r.length>=50)break}}}if(!r.length)return[];var h=Array.from(r);return h.reverse(),h.slice(0,50).map(e=>f({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",tc,tp)),this._instance=e,this.zo=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(tB))?t:[],this.Wo=tT(this.Go()),this.Zo=new tM(this.Wo)}onConfigChange(){this.Wo=tT(this.Go()),this.Zo.setConfig(this.Wo)}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!=(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.zo=r,this._instance.persistence&&this._instance.persistence.register({[tB]:this.zo,[tG]:n})}}get Qo(){var e,t=!!this._instance.get_property(tG),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.Vo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.Wo.enabled)try{if(!U(e)||0===e.trim().length)return void oo.warn("Ignoring exception step because message must be a non-empty string");var i=this.Jo(t),{sanitizedProperties:s,droppedKeys:r}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(t$.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(i);r.length>0&&oo.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Zo.add(f({[tF]:e,[tP]:(new Date).toISOString()}
1,s))}catch(e){oo.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.Ko(t)){if(this.Yo(t))return this.Xo("Exception dropped: matched a suppression rule"),void oo.info("Skipping exception capture because a suppression rule matched");if(!this.Qo&&this.ea(t))return this.Xo("Exception dropped: thrown by a browser extension"),void oo.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ta(t))return this.Xo("Exception dropped: thrown by the PostHog SDK"),void oo.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.Wo.enabled&&W(e.$exception_steps)?this.ra(e):e;try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Mn:!0});return s&&this.Zo.clear(),s}catch(e){return oo.error("Failed to capture exception event. Dropping this exception.",e),void this.Zo.clear()}}catch(e){return void oo.error("Failed to process exception event. Ignoring this exception.",e)}}ra(e){try{var t=this.Zo.getAttachable();return 0===t.length?e:f({},e,{$exception_steps:t})}catch(t){return oo.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Xo(e){this.Wo.enabled&&this.Zo.add({[tF]:e,[tP]:(new Date).toISOString()})}Jo(e){return j(e)?f({},e):{}}Go(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}Yo(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return U(i)&&i.length>0&&e.$exception_types.push(i),U(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.zo.some(e=>{var i=e.values.map(e=>{var i,s=no[e.operator],r=D(e.value)?e.value:[e.value],n=null!=(i=t[e.key])?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}ea(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ta(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}Ko(e){return!W(e)&&D(e)}}},op,{siteApps:class{constructor(e){this._instance=e,this.oa=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}aa(e,t){if(t){var i=this.globalsForEvent(t);this.oa.push(i),this.oa.length>1e3&&(this.oa=this.oa.slice(10))}}get siteAppLoaders(){var e;return null==(e=d._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.aa.bind(this));this.la=()=>{e(),this.oa=[],this.la=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,o,a,l={},u=this._instance.get_property("$groups")||[];for(var[c,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:h};var{$set_once:d,$set:p}=e;return{event:f({},m(e,nQ),{properties:f({},e.properties,p?{$set:f({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:f({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.oa.length&&(n0.info("Processing "+this.oa.length+" events for site app with id "+e.id),this.oa.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.la)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,n0.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){n0.error(n1+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){n0.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}ua(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}ha(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){n0.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.ua(),void this._instance.on("eventCaptured",e=>this.ha(e))):void n0.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.la)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;d["__$$ph_site_app_"+e]=r._instance,null==(t=d.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,t=>{if(t)return n0.error(n1+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else n0.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ov,{tracingHeaders:class{constructor(e){this.ca=void 0,this.da=void 0,this.va=void 0,this.Fo=()=>{var e,t,i=this.fa();
1i?(z(this.ca)&&(this.ca=null==(e=d.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),z(this.da)&&(this.da=null==(t=d.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.jo()},this._instance=e}initialize(){this.startIfEnabledOrStop()}ur(e){var t,i;null!=(t=d.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return nH.error("failed to load script",t);e()})}pa(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}fa(){var e=this.pa();return D(e)?(D(this.va)?this.va.splice(0,this.va.length,...e):this.va=[...e],e.length>0?this.va:void 0):(D(this.va)&&this.va.splice(0),this.va=e||void 0,this.va)}jo(){var e,t;null==(e=this.ca)||e.call(this),null==(t=this.da)||t.call(this),this.ca=void 0,this.da=void 0}startIfEnabledOrStop(){this.fa()?this.ur(this.Fo):this.jo()}}},{toolbar:class{constructor(e){this.instance=e}Ca(e){d.ph_toolbar_state=e}Ia(){var e;return null!=(e=d.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,s){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===s&&(s=void 0),iV(this.instance.config)||!i||!n)return!1;e=null!=e?e:i.location,s=null!=s?s:i.history;try{if(!t){try{i.localStorage.setItem("test","test"),i.localStorage.removeItem("test")}catch(e){return!1}t=null==i?void 0:i.localStorage}var r,o=n7||sX(e.hash,"__posthog")||sX(e.hash,"state"),a=o?iz(()=>JSON.parse(atob(decodeURIComponent(o))))||iz(()=>JSON.parse(decodeURIComponent(o))):null;return a&&"ph_authorize"===a.action?((r=a).source="url",r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(n9)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}Ta(e){var t=d.ph_load_toolbar||d.ph_load_editor;!W(t)&&N(t)?t(e,this.instance):oe.warn("No toolbar load function found")}loadToolbar(e){var t,s=!(null==n||!n.getElementById(ix));if(!i||s)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=f({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(i.localStorage.setItem(n9,JSON.stringify(f({},o,{source:void 0}))),2===this.Ia())?this.Ta(o):0===this.Ia()&&(this.Ca(1),null==(t=d.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{e?(oe.error("[Toolbar] Failed to load",e),this.Ca(0)):(this.Ca(2),this.Ta(o))}),iW(i,"turbolinks:load",()=>{this.Ca(0),this.loadToolbar(o)})),!0}Ea(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},og,{conversations:class{constructor(e){this.Ma=void 0,this._conversationsManager=null,this.Ra=!1,this.Pa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;W(t)||(K(t)?this.Ma=t:(this.Ma=t.enabled,this.Pa=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Ma=void 0,this.Pa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ra||this._instance.config.disable_conversations||iV(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==d?void 0:d.__PosthogExtensions__;if(e&&!z(this.Ma)&&this.Ma)if(this.Pa&&this.Pa.token){this.Ra=!0;try{var t=e.initConversations;if(t)return this.Oa(t),void(this.Ra=!1);var i=e.loadExternalDependency;if(!i)return void this.La(iF);i(this._instance,"conversations",t=>{t||!e.initConversations?this.La("Could not load conversations script",t):this.Oa(e.initConversations),this.Ra=!1})}catch(e){this.La("Error initializing conversations",e),this.Ra=!1}}else oc.error("Conversations enabled but missing token in remote config.")}}Oa(e){if(this.Pa)try{this._conversationsManager=e(this.Pa,this._instance),oc.info("Conversations loaded successfully")}catch(e){this.La("Error completing conversations initialization",e)}else oc.error("Cannot complete initialization: remote config is null")}La(e,t){oc.error(e,t),this._conversationsManager=null,this.Ra=!1}show(){this._conversationsManager?this._conversationsManager.show():oc.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ma&&!G(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return _(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(oc.warn(oh),null)})()}getMessages(e,t){var i=this;return _(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(oc.warn(oh),null)})()}markAsRead(e){var t=this;return _(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oc.warn(oh),null)})()}getTickets(e){var t=this;return _(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oc.warn(oh),null)})()}requestRestoreLink(e){var t=this;return _(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oc.warn(oh),null)})()}restoreFromToken(e){var t=this;return _(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oc.warn(oh),null)})()}restoreFromUrlToken(){var e=this;return _(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oc.warn(oh),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Nn(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Dn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.Aa=!1,this.Fa=!1,this.Zt=tR("[logs]"),this.Na=[],this.Da=0,this.$a=0,this.qa=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Aa=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!W(i)&&i&&(this.Aa=!0,this.loadIfEnabled())}reset(){this.Na=[],this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.Da=0,this.$a=0,this.qa=!1}loadIfEnabled(){if(this.Aa&&!this.Fa){var e=null==d?void 0:d.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.Zt.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.Fa=!0)}):this.Zt.error(iF)}else this.Zt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,s,r,n,o;if(this._instance.is_capturing())if(e&&e.body){var a=null!=(t=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)?t:3e3,l=null!=(s=null==(r=this._instance.config.logs)?void 0:r.maxLogsPerInterval)?s:1e3,u=Date.now();if(a>u-this.$a||(this.$a=u,this.Da=0,this.qa=!1),l>this.Da){this.Da++;var c=function(e,t){var{text:i,number:s}=tt[e.level||"info"]||ti,r=String(Date.now())+"000000",n={};t.distinctId&&(n.posthogDistinctId=t.distinctId),t.sessionId&&(n.sessionId=t.sessionId),t.currentUrl&&(n["url.full"]=t.currentUrl),t.screenName&&(n["screen.name"]=t.screenName),t.appState&&(n["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(n.feature_flags=t.activeFeatureFlags);var o=f({},n,e.attributes||{}),a={timeUnixNano:r,observedTimeUnixNano:r,severityNumber:s,severityText:i,body:{stringValue:e.body},attributes:ts(o)};return e.trace_id&&(a.traceId=e.trace_id),e.span_id&&(a.spanId=e.span_id),z(e.trace_flags)||(a.flags=e.trace_flags),a}(e,this.ja());this.Na.push({record:c}),(null!=(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)?n:100)>this.Na.length?this.Ba():this.flushLogs()}else this.qa||(this.Zt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.qa=!0)}else this.Zt.warn("captureLog requires a body")}get logger(){return this.Ha||(this.Ha={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>
1this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ha}flushLogs(e){if(this.ii&&(clearTimeout(this.ii),this.ii=void 0),0!==this.Na.length){var t,i,s,r=this.Na;this.Na=[];var n=this._instance.config.logs,o=f({"service.name":(null==n?void 0:n.serviceName)||"unknown_service"},(null==n?void 0:n.environment)&&{"deployment.environment":n.environment},(null==n?void 0:n.serviceVersion)&&{"service.version":n.serviceVersion},null==n?void 0:n.resourceAttributes),a=(t=r.map(e=>e.record),i=v.LIB_NAME,s=v.LIB_VERSION,{resourceLogs:[{resource:{attributes:ts(o)},scopeLogs:[{scope:{name:i,version:s},logRecords:t}]}]}),l=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.yn({method:"POST",url:l,data:a,compression:"best-available",batchKey:"logs",transport:e})}}Ba(){var e,t;this.ii||(this.ii=setTimeout(()=>{this.ii=void 0,this.flushLogs()},null!=(e=null==(t=this._instance.config.logs)?void 0:t.flushIntervalMs)?e:3e3))}ja(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if(null!=d&&null!=(e=d.location)&&e.href&&(t.currentUrl=d.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}});nA.__defaultExtensionClasses=f({},o_);var of=(v.SDK_DIST_CHANNEL="npm",t=nw[nI]=new nA,function(){function e(){e.done||(e.done=!0,nT=!1,iN(nw,function(e){e._dom_loaded()}))}null!=n&&n.addEventListener?"complete"===n.readyState?e():iW(n,"DOMContentLoaded",e,{capture:!1}):i&&tO.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t);e.s(["default",0,of])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.