From 1b889c33fc0e727946cd7c40291e4e7b5e21a615 Mon Sep 17 00:00:00 2001 From: Paul Kilmurray Date: Mon, 15 Jun 2026 13:03:51 +0200 Subject: [PATCH 1/2] fix: strip $session_entry_* URL props from analytics (site admin URLs leaking) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PostHog data check on prod found site admin URLs (e.g. https://shop.example/wp-admin/admin.php?page=woocommerce-pos) reaching PostHog via the newer posthog-js $session_entry_url/$session_entry_referrer/etc. family — before_send only stripped the older $current_url/$host/$pathname/$referrer/ $referring_domain. Strip the whole $session_entry_* family too (privacy / wp.org guideline 7). 326 events/day were carrying these. --- assets/js/welcome.js | 2 +- src/shared/analytics.ts | 20 +++++++++++++++----- tests/analytics-config.test.mjs | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/assets/js/welcome.js b/assets/js/welcome.js index 39f18b4..937b731 100644 --- a/assets/js/welcome.js +++ b/assets/js/welcome.js @@ -1,5 +1,5 @@ (function(){"use strict";function Va(i,e){for(var t=0;tr[s]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var _=typeof window<"u"?window:void 0,oe=typeof globalThis<"u"?globalThis:_;typeof self>"u"&&(oe.self=oe),typeof File>"u"&&(oe.File=function(){});var _e=oe==null?void 0:oe.navigator,k=oe==null?void 0:oe.document,le=oe==null?void 0:oe.location,Yi=oe==null?void 0:oe.fetch,Zi=oe!=null&&oe.XMLHttpRequest&&"withCredentials"in new oe.XMLHttpRequest?oe.XMLHttpRequest:void 0,Rs=oe==null?void 0:oe.AbortController,qa=oe==null?void 0:oe.CompressionStream,ge=_e==null?void 0:_e.userAgent,A=_??{},Ts="1.369.0",de={DEBUG:!1,LIB_VERSION:Ts,LIB_NAME:"web",JS_SDK_VERSION:Ts};function Is(i,e,t,r,s,n,o){try{var a=i[n](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(r,s)}function xe(i){return function(){var e=this,t=arguments;return new Promise((function(r,s){var n=i.apply(e,t);function o(l){Is(n,r,s,o,a,"next",l)}function a(l){Is(n,r,s,o,a,"throw",l)}o(void 0)}))}}function w(){return w=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},w.apply(null,arguments)}function Cs(i,e){if(i==null)return{};var t={};for(var r in i)if({}.hasOwnProperty.call(i,r)){if(e.indexOf(r)!==-1)continue;t[r]=i[r]}return t}function $s(){return($s=xe((function*(i,e,t){e===void 0&&(e=!0);try{var r=new Blob([i],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(r).blob()}catch(s){if(t!=null&&t.rethrow)throw s;return e&&console.error("Failed to gzip compress data",s),null}}))).apply(this,arguments)}var Ba=["$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"],Wa=["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"],Fs=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Wa.concat(e).some((r=>{var s=r.toLowerCase();return t.indexOf(s)!==-1}))};function B(i,e){return i.indexOf(e)!==-1}var si=function(i){return i.trim()},Qi=function(i){return i.replace(/^\$/,"")},Ls=Object.prototype,As=Ls.hasOwnProperty,ni=Ls.toString,z=Array.isArray||function(i){return ni.call(i)==="[object Array]"},$e=i=>typeof i=="function",ae=i=>i===Object(i)&&!z(i),st=i=>{if(ae(i)){for(var e in i)if(As.call(i,e))return!1;return!0}return!1},I=i=>i===void 0,se=i=>ni.call(i)=="[object String]",oi=i=>se(i)&&i.trim().length===0,Fe=i=>i===null,W=i=>I(i)||Fe(i),Se=i=>ni.call(i)=="[object Number]"&&i==i,nt=i=>Se(i)&&i>0,Oe=i=>ni.call(i)==="[object Boolean]",za=i=>i instanceof FormData,Xa=i=>B(Ba,i);function Ms(i){return i===null||typeof i!="object"}function ai(i,e){return{}.toString.call(i)==="[object "+e+"]"}function er(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var Ga=[!0,"true",1,"1","yes"],tr=i=>B(Ga,i),Ka=[!1,"false",0,"0","no"];function Re(i,e,t,r,s){return e>t&&(r.warn("min cannot be greater than max."),e=t),Se(i)?i>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),Re(s||t,e,t,r))}class Ja{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=Re(e.bucketSize,0,100,e.qt),this.$t=Re(e.refillRate,0,this.jt,e.qt),this.Vt=Re(e.refillInterval,0,864e5,e.qt)}Ht(e,t){var r=Math.floor((t-e.lastAccess)/this.Vt);r>0&&(e.tokens=Math.min(e.tokens+r*this.$t,this.jt),e.lastAccess=e.lastAccess+r*this.Vt)}consumeRateLimit(e){var t,r=Date.now(),s=String(e),n=this.Pt[s];return n?this.Ht(n,r):this.Pt[s]=n={tokens:this.jt,lastAccess:r},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.Dt)==null||t.call(this,e)),n.tokens===0)}stop(){this.Pt={}}}var li,js,ir,me="Mobile",ui="iOS",Le="Android",ot="Tablet",Ds=Le+" "+ot,Ns="iPad",Hs="Apple",Us=Hs+" Watch",kt="Safari",at="BlackBerry",Vs="Samsung",qs=Vs+"Browser",Bs=Vs+" Internet",Ge="Chrome",Ya=Ge+" OS",Ws=Ge+" "+ui,rr="Internet Explorer",zs=rr+" "+me,sr="Opera",Za=sr+" Mini",nr="Edge",Xs="Microsoft "+nr,lt="Firefox",Gs=lt+" "+ui,Pt="Nintendo",Ot="PlayStation",ut="Xbox",Ks=Le+" "+me,Js=me+" "+kt,Rt="Windows",or=Rt+" Phone",Ys="Nokia",ar="Ouya",Zs="Generic",Qa=Zs+" "+me.toLowerCase(),Qs=Zs+" "+ot.toLowerCase(),lr="Konqueror",fe="(\\d+(\\.\\d+)?)",ur=new RegExp("Version/"+fe),el=new RegExp(ut,"i"),tl=new RegExp(Ot+" \\w+","i"),il=new RegExp(Pt+" \\w+","i"),cr=new RegExp(at+"|PlayBook|BB10","i"),rl={"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"},en=function(i,e){return e=e||"",B(i," OPR/")&&B(i,"Mini")?Za:B(i," OPR/")?sr:cr.test(i)?at:B(i,"IE"+me)||B(i,"WPDesktop")?zs:B(i,qs)?Bs:B(i,nr)||B(i,"Edg/")?Xs:B(i,"FBIOS")?"Facebook "+me:B(i,"UCWEB")||B(i,"UCBrowser")?"UC Browser":B(i,"CriOS")?Ws:B(i,"CrMo")||B(i,Ge)?Ge:B(i,Le)&&B(i,kt)?Ks:B(i,"FxiOS")?Gs:B(i.toLowerCase(),lr.toLowerCase())?lr:((t,r)=>r&&B(r,Hs)||(function(s){return B(s,kt)&&!B(s,Ge)&&!B(s,Le)})(t))(i,e)?B(i,me)?Js:kt:B(i,lt)?lt:B(i,"MSIE")||B(i,"Trident/")?rr:B(i,"Gecko")?lt:""},sl={[zs]:[new RegExp("rv:"+fe)],[Xs]:[new RegExp(nr+"?\\/"+fe)],[Ge]:[new RegExp("("+Ge+"|CrMo)\\/"+fe)],[Ws]:[new RegExp("CriOS\\/"+fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+fe)],[kt]:[ur],[Js]:[ur],[sr]:[new RegExp("(Opera|OPR)\\/"+fe)],[lt]:[new RegExp(lt+"\\/"+fe)],[Gs]:[new RegExp("FxiOS\\/"+fe)],[lr]:[new RegExp("Konqueror[:/]?"+fe,"i")],[at]:[new RegExp(at+" "+fe),ur],[Ks]:[new RegExp("android\\s"+fe,"i")],[Bs]:[new RegExp(qs+"\\/"+fe)],[rr]:[new RegExp("(rv:|MSIE )"+fe)],Mozilla:[new RegExp("rv:"+fe)]},nl=function(i,e){var t=en(i,e),r=sl[t];if(I(r))return null;for(var s=0;r.length>s;s++){var n=i.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},tn=[[new RegExp(ut+"; "+ut+" (.*?)[);]","i"),i=>[ut,i&&i[1]||""]],[new RegExp(Pt,"i"),[Pt,""]],[new RegExp(Ot,"i"),[Ot,""]],[cr,[at,""]],[new RegExp(Rt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[or,""];if(new RegExp(me).test(e)&&!/IEMobile\b/.test(e))return[Rt+" "+me,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=rl[t[1]]||"";return/arm/i.test(e)&&(r="RT"),[Rt,r]}return[Rt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[ui,[i[3],i[4],i[5]||"0"].join(".")]:[ui,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=I(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+Le+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Le+")","i"),i=>i&&i[2]?[Le,[i[2],i[3],i[4]||"0"].join(".")]:[Le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ya,""]],[/Linux|debian/i,["Linux",""]]],rn=function(i){return il.test(i)?Pt:tl.test(i)?Ot:el.test(i)?ut:new RegExp(ar,"i").test(i)?ar:new RegExp("("+or+"|WPDesktop)","i").test(i)?or:/iPad/.test(i)?Ns:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Us:cr.test(i)?at:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Ys,"i").test(i)?Ys:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(me).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?Le:Ds:new RegExp("(pda|"+me+")","i").test(i)?Qa:new RegExp(ot,"i").test(i)&&!new RegExp(ot+" pc","i").test(i)?Qs:""},ol=i=>i instanceof Error;function al(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ir&&t.length===js||(js=t.length,ir=t.reduce(((r,s)=>{li||(li={});var n=li[s];if(n)r[n[0]]=n[1];else for(var o=i(s),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,c=e[s];if(u&&c){r[u]=c,li[s]=[u,c];break}}return r}),{})),ir}}class ll{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var t=this;return xe((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&z(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),w({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return xe((function*(){var r=e;for(var s of t.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,w({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:al(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var s=(n,o)=>{if(4>=o){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return w({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,r),next:n=>s(n,r+1)})}}var ct="?";function hr(i,e,t,r,s){var n={platform:i,filename:e,function:t===""?ct:t,in_app:!0};return I(r)||(n.lineno=r),I(s)||(n.colno=s),n}var sn=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,r=i.indexOf("safari-web-extension")!==-1;return t||r?[i.indexOf("@")!==-1?i.split("@")[0]:ct,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},ul=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,cl=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,hl=/\((\S*)(?::(\d+))(?::(\d+))\)/,dl=(i,e)=>{var t=ul.exec(i);if(t){var[,r,s,n]=t;return hr(e,r,ct,+s,+n)}var o=cl.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=hl.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=sn(o[1]||ct,o[2]);return hr(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},fl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gl=(i,e)=>{var t=fl.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=pl.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var s=t[3],n=t[1]||ct;return[n,s]=sn(n,s),hr(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},nn=/\(error: (.*)\)/;class vl{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=se(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ai(e,"DOMException")}isDOMError(e){return ai(e,"DOMError")}}class _l{match(e){return(t=>t instanceof Error)(e)}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 r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class ml{constructor(){}match(e){return ai(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var yl=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class bl{match(e){return typeof e=="string"}coerce(e,t){var r,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,s=e.match(yl);return s&&(t=s[1],r=s[2]),[t,r]}}var wl=["fatal","error","warning","log","info","debug"];function on(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var s=t.slice(0,r).join(", ");if(e>=s.length)return r===t.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class xl{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return er(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+on(e)}isSeverityLevel(e){return se(e)&&!oi(e)&&wl.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(ol(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class Sl{match(e){return er(e)}coerce(e,t){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+on(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class El{match(e){return Ms(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class kl{match(e){return ai(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!er(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var r,s=this.getUnhandledRejectionReason(e);return Ms(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var an=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,r={C(s){if(_&&(de.DEBUG||A.POSTHOG_DEBUG||t)&&!I(_.console)&&_.console){for(var n=("__rrweb_original__"in _.console[s])?_.console[s].__rrweb_original__:_.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];n(i,...a)}},info(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.C("log",...n)},warn(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.C("warn",...n)},error(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];r.C("error",...n)},critical(){for(var s=arguments.length,n=new Array(s),o=0;s>o;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>an(i+" "+s,n)};return r},O=an("[PostHog.js]"),Z=O.createLogger,Pl=Z("[ExternalScriptsLoader]"),ci=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Pl.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=k==null?void 0:k.querySelectorAll("script");if(r){for(var s,n=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v}var a=()=>{if(!k)return t("document not found");var l=k.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")k.head.appendChild(l);else{var u,c=k.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):k.body.appendChild(l)}};k!=null&&k.body?a():k==null||k.addEventListener("DOMContentLoaded",a)};A.__PosthogExtensions__=A.__PosthogExtensions__||{},A.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config")if(i._resolvedSdkVersion){var r=i.requestRouter.endpointFor("assets","/static/"+i._resolvedSdkVersion+"/"+e+".js");ci(i,r,t)}else{var s="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}var o=i.requestRouter.endpointFor("assets",s);ci(i,o,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");ci(i,a,t)}},A.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var r=i.requestRouter.endpointFor("api",e);ci(i,r,t)};var ln="$people_distinct_id",hi="$device_id",Tt="__alias",It="__timers",un="$autocapture_disabled_server_side",dr="$heatmaps_enabled_server_side",cn="$exception_capture_enabled_server_side",fr="$error_tracking_suppression_rules",hn="$error_tracking_capture_extension_exceptions",dn="$web_vitals_enabled_server_side",fn="$dead_clicks_enabled_server_side",pn="$product_tours_enabled_server_side",gn="$web_vitals_allowed_metrics",di="$session_recording_remote_config",fi="$sesid",vn="$session_is_sampled",ht="$enabled_feature_flags",Ct="$early_access_features",pr="$feature_flag_details",$t="$stored_person_properties",Ke="$stored_group_properties",gr="$surveys",Ft="$flag_call_reported",vr="$flag_call_reported_session_id",_r="$feature_flag_errors",pi="$feature_flag_evaluated_at",Ee="$user_state",mr="$client_session_props",yr="$capture_rate_limit",br="$initial_campaign_params",wr="$initial_referrer_info",gi="$initial_person_info",vi="$epp",_n="__POSTHOG_TOOLBAR__",_i="$posthog_cookieless",Ol=[ln,Tt,"__cmpns",It,"$session_recording_enabled_server_side",dr,fi,ht,fr,Ee,Ct,pr,Ke,$t,gr,Ft,vr,_r,pi,mr,yr,br,wr,vi,gi],xr="PostHog loadExternalDependency extension not found.",Ae="on_reject",ke="always",dt="anonymous",ft="identified",Sr="identified_only",mi="visibilitychange",yi="beforeunload",pt="$pageview",Er="$pageleave",kr="$identify",mn="$groupidentify";function bi(i,e){z(i)&&i.forEach(e)}function J(i,e){if(!W(i))if(z(i))i.forEach(e);else if(za(i))i.forEach(((r,s)=>e(r,s)));else for(var t in i)As.call(i,t)&&e(i[t],t)}var ie=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;e>r;r++)t[r-1]=arguments[r];for(var s of t)for(var n in s)s[n]!==void 0&&(i[n]=s[n]);return i};function wi(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var yn=function(i){try{return i()}catch{return}},Rl=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.apply(this,t)}catch(s){O.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),O.critical(s)}}},Pr=function(i){var e={};return J(i,(function(t,r){(se(t)&&t.length>0||Se(t))&&(e[r]=t)})),e},Tl=["herokuapp.com","vercel.app","netlify.app"];function Il(i){var e=i==null?void 0:i.hostname;if(!se(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of Tl)if(t===r)return!1;return!0}function ne(i,e,t,r){var{capture:s=!1,passive:n=!0}=r??{};i==null||i.addEventListener(e,t,{capture:s,passive:n})}function bn(i){return i.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return Se(i)&&isFinite(i)&&Math.floor(i)===i});class xi{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>t||0>r||0>s||e>0xffffffffffff||t>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new xi(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new xi(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}}class Cl{constructor(){this.I=0,this.S=0,this.k=new $l}generate(){var e=this.generateOrAbort();if(I(e)){this.I=0;var t=this.generateOrAbort();if(I(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return xi.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var wn,xn=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};_&&!I(_.crypto)&&crypto.getRandomValues&&(xn=i=>crypto.getRandomValues(i));class $l{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(xn(this.T),this.N=0),this.T[this.N++]}}var je=()=>Fl().toString(),Fl=()=>(wn||(wn=new Cl)).generate(),Lt="",Ll=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Te={Ut:()=>!!k,Yt(i){O.error("cookieStore error: "+i)},Gt(i){if(k){try{for(var e=i+"=",t=k.cookie.split(";").filter((n=>n.length)),r=0;t.length>r;r++){for(var s=t[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},Wt(i){var e;try{e=JSON.parse(Te.Gt(i))||{}}catch{}return e},Xt(i,e,t,r,s){if(k)try{var n="",o="",a=(function(c,h){if(h){var d=(function(p,g){if(g===void 0&&(g=k),Lt)return Lt;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var P=p.split("."),S=Math.min(P.length,8),F="dmn_chk_"+je();!Lt&&S--;){var C=P.slice(S).join("."),R=F+"=1;domain=."+C+";path=/";g.cookie=R+";max-age=3",g.cookie.includes(F)&&(g.cookie=R+";max-age=0",Lt=C)}return Lt})(c);if(!d){var f=(p=>{var g=p.match(Ll);return g?g[0]:""})(c);f!==d&&O.info("Warning: cookie subdomain discovery mismatch",f,d),d=f}return d?"; domain=."+d:""}return""})(k.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&O.warn("cookieStore warning: large cookie, len="+u.length),k.cookie=u,u}catch{return}},Jt(i,e){if(k!=null&&k.cookie)try{Te.Xt(i,"",-1,e)}catch{return}}},Or=null,Q={Ut(){if(!Fe(Or))return Or;var i=!0;if(I(_))i=!1;else try{var e="__mplssupport__";Q.Xt(e,"xyz"),Q.Gt(e)!=='"xyz"'&&(i=!1),Q.Jt(e)}catch{i=!1}return i||O.error("localStorage unsupported; falling back to cookie store"),Or=i,i},Yt(i){O.error("localStorage error: "+i)},Gt(i){try{return _==null?void 0:_.localStorage.getItem(i)}catch(e){Q.Yt(e)}return null},Wt(i){try{return JSON.parse(Q.Gt(i))||{}}catch{}return null},Xt(i,e){try{_==null||_.localStorage.setItem(i,JSON.stringify(e))}catch(t){Q.Yt(t)}},Jt(i){try{_==null||_.localStorage.removeItem(i)}catch(e){Q.Yt(e)}}},Al=[hi,"distinct_id",fi,vn,vi,gi,Ee],Si={},Ml={Ut:()=>!0,Yt(i){O.error("memoryStorage error: "+i)},Gt:i=>Si[i]||null,Wt:i=>Si[i]||null,Xt(i,e){Si[i]=e},Jt(i){delete Si[i]}},Je=null,ue={Ut(){if(!Fe(Je))return Je;if(Je=!0,I(_))Je=!1;else try{var i="__support__";ue.Xt(i,"xyz"),ue.Gt(i)!=='"xyz"'&&(Je=!1),ue.Jt(i)}catch{Je=!1}return Je},Yt(i){O.error("sessionStorage error: ",i)},Gt(i){try{return _==null?void 0:_.sessionStorage.getItem(i)}catch(e){ue.Yt(e)}return null},Wt(i){try{return JSON.parse(ue.Gt(i))||null}catch{}return null},Xt(i,e){try{_==null||_.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){ue.Yt(t)}},Jt(i){try{_==null||_.sessionStorage.removeItem(i)}catch(e){ue.Yt(e)}}};class jl{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===ke||this.consent===0||this.consent===-1&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===Ae)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}optInOut(e){this.ti.Xt(this.ei,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.ti.Gt(this.ei);return tr(e)?1:B(Ka,e)?0:-1}get ti(){var e=this.Rt.opt_out_capturing_persistence_type,t=e==="localStorage"?Q:Te;if(!this.ii||this.ii!==t){this.ii=t;var r=e==="localStorage"?Te:Q;r.Gt(this.ei)&&(this.ii.Gt(this.ei)||this.optInOut(tr(r.Gt(this.ei))),r.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[_e==null?void 0:_e.doNotTrack,_e==null?void 0:_e.msDoNotTrack,A.doNotTrack].some((e=>tr(e)))}}var Ei=Z("[Dead Clicks]"),Dl=()=>!0,Nl=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(fn)),r=i.instance.config.capture_dead_clicks;return Oe(r)?r:!!ae(r)||t};class Sn{get lazyLoadedDeadClicksAutocapture(){return this.ri}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[fn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni((()=>{this.si()})):this.stop()}ni(e){var t,r;(t=A.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(r=A.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Ei.error("failed to load script",s):e()}))}si(){var e;if(k){if(!this.ri&&(e=A.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=ae(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ri=A.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ri.start(k),Ei.info("starting...")}}else Ei.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,Ei.info("stopping..."))}}var Rr=Z("[SegmentIntegration]"),En="posthog-js";function kn(i,e){var{organization:t,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,h,d;if(n!=="*"&&!n.includes(a.level)||!i.__loaded)return a;a.tags||(a.tags={});var f=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=f,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var p,g=((l=a.exception)==null?void 0:l.values)||[],P=g.map((F=>w({},F,{stacktrace:F.stacktrace?w({},F.stacktrace,{type:"raw",frames:(F.stacktrace.frames||[]).map((C=>w({},C,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((u=g[0])==null?void 0:u.value)||a.message,$exception_type:(c=g[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:P,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(d=g[0])==null?void 0:d.type,$sentry_tags:a.tags};return t&&r&&(S.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&((p=i.exceptions)==null||p.sendExceptionEvent(S)),a}}class Hl{constructor(e,t,r,s,n,o){this.name=En,this.setupOnce=function(a){a(kn(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}}class Pn{constructor(e){this.oi=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(O.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.li()}li(){var e;this.ui=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.oi)}destroy(){var e;(e=this.ui)==null||e.call(this),this.ui=void 0}doPageView(e,t){var r,s=this.hi(e,t);return this.ai={pathname:(r=_==null?void 0:_.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.hi(e,(t=this.ai)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ai)==null?void 0:e.pageViewId}}hi(e,t){var r=this.ai;if(!r)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:h}=n;if(!(I(o)||I(a)||I(l)||I(u)||I(c)||I(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var d=o>1?Re(a/o,0,1,O):1,f=o>1?Re(l/o,0,1,O):1,p=u>1?Re(c/u,0,1,O):1,g=u>1?Re(h/u,0,1,O):1;s=ie(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var ki=i=>{var e=k==null?void 0:k.createElement("a");return I(e)?null:(e.href=i,e)},Pi=function(i,e){for(var t,r=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){t=n;break}}if(!z(t)||2>t.length)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{O.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},At=function(i,e,t){if(!i||!e||!e.length)return i;for(var r=i.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");z(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(l[c]))}var d=a;return o!=null&&(d+="?"+u.join("&")),s!=null&&(d+="#"+s),d},Oi=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Ri="https?://(.*)",gt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ul=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...gt],Mt="",Vl=["li_fat_id"];function On(i,e,t){if(!k)return{};var r,s=e?[...gt,...t||[]]:[],n=Rn(At(k.URL,s,Mt),i),o=(r={},J(Vl,(function(a){var l=Te.Gt(a);r[a]=l||null})),r);return ie(o,n)}function Rn(i,e){var t=Ul.concat(e||[]),r={};return J(t,(function(s){var n=Pi(i,s);r[s]=n||null})),r}function Tn(i){var e=(function(n){return n?n.search(Ri+"google.([^/?]*)")===0?"google":n.search(Ri+"bing.com")===0?"bing":n.search(Ri+"yahoo.com")===0?"yahoo":n.search(Ri+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",r={};if(!Fe(e)){r.$search_engine=e;var s=k?Pi(k.referrer,t):"";s.length&&(r.ph_keyword=s)}return r}function In(){return navigator.language||navigator.userLanguage}var Ti="$direct";function Cn(){return(k==null?void 0:k.referrer)||Ti}function $n(i,e){var t=i?[...gt,...e||[]]:[],r=le==null?void 0:le.href.substring(0,1e3);return{r:Cn().substring(0,1e3),u:r?At(r,t,Mt):void 0}}function Fn(i){var e,{r:t,u:r}=i,s={$referrer:t,$referring_domain:t==null?void 0:t==Ti?Ti:(e=ki(t))==null?void 0:e.host};if(r){s.$current_url=r;var n=ki(r);s.$host=n==null?void 0:n.host,s.$pathname=n==null?void 0:n.pathname;var o=Rn(r);ie(s,o)}if(t){var a=Tn(t);ie(s,a)}return s}function Ln(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ql(){try{return new Date().getTimezoneOffset()}catch{return}}var Bl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Tr{constructor(e,t){this.Rt=e,this.props={},this.ci=!1,this.di=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.ti=this.vi(e),this.load(),e.debug&&O.info("Persistence loaded",e.persistence,w({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.fi}vi(e){Bl.indexOf(e.persistence.toLowerCase())===-1&&(O.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...Al,...s];return w({},Q,{Wt(o){try{var a={};try{a=Te.Wt(o)||{}}catch{}var l=ie(a,JSON.parse(Q.Gt(o)||"{}"));return Q.Xt(o,l),l}catch{}return null},Xt(o,a,l,u,c,h){try{Q.Xt(o,a,void 0,void 0,h);var d={};n.forEach((f=>{a[f]&&(d[f]=a[f])})),Object.keys(d).length&&Te.Xt(o,d,l,u,c,h)}catch(f){Q.Yt(f)}},Jt(o,a){try{_==null||_.localStorage.removeItem(o),Te.Jt(o,a)}catch(l){Q.Yt(l)}}})})(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&Q.Ut()?Q:r==="localstorage+cookie"&&t.Ut()?t:r==="sessionstorage"&&ue.Ut()?ue:r==="memory"?Ml:r==="cookie"?Te:t.Ut()?t:Te}pi(e){var t=e??this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[pi];return!r||typeof r!="number"||Date.now()-r>t}properties(){var e={};return J(this.props,((t,r)=>{if(r===ht&&ae(t)){if(!this.pi())for(var s=Object.keys(t),n=0;s.length>n;n++)e["$feature/"+s[n]]=t[s[n]]}else Ol.indexOf(r)===-1&&(e[r]=t)})),e}load(){if(!this.fi){var e=this.ti.Wt(this.di);e&&(this.props=ie({},e))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(ae(e)){I(t)&&(t="None"),this.gi=I(r)?this.bi:r;var s=!1;if(J(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(ae(e)){this.gi=I(t)?this.bi:t;var r=!1;if(J(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.ci){var e=On(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);st(Pr(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=k==null?void 0:k.referrer)?Tn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Cn(),$referring_domain:k!=null&&k.referrer&&((e=ki(k.referrer))==null?void 0:e.host)||Ti},void 0)}set_initial_person_info(){this.props[br]||this.props[wr]||this.register_once({[gi]:$n(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};J([wr,br],(o=>{var a=this.props[o];a&&J(a,(function(l,u){e["$initial_"+Qi(u)]=l}))}));var t,r,s=this.props[gi];if(s){var n=(t=Fn(s),r={},J(t,(function(o,a){r["$initial_"+Qi(a)]=o})),r);ie(e,n)}return e}safe_merge(e){return J(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){if(this.bi=this.gi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),u=[...a].sort();return l.every(((c,h)=>c===u[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.vi(e),n=this.props;this.clear(),this.ti=s,this.props=n,this.save()}}set_disabled(e){this.fi=e,this.fi?this.remove():this.save()}set_cross_subdomain(e){e!==this.mi&&(this.mi=e,this.remove(),this.save())}set_secure(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[It]||{};r[e]=t,this.props[It]=r,this.save()}remove_event_timer(e){var t=(this.props[It]||{})[e];return I(t)||(delete this.props[It][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var jt={Activation:"events",Cancellation:"cancelEvents"},Ir={Popover:"popover",API:"api",Widget:"widget"},Dt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Cr={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},$r={Popover:"popover",Inline:"inline"},Wl={SHOWN:"product tour shown"},An={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Mn=Z("[RateLimiter]");class zl{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{Mn.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void Mn.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(yr))!==null&&t!==void 0?t:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var u=1>l.tokens;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(s=this.instance.persistence)==null||s.set_property(yr,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()e(this.remoteConfig))):e()}Ii(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 Nt.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void Nt.warn("Remote config is disabled. Falling back to local config.");this.wi((e=>{if(!e)return Nt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii((t=>{this.Ci(t),this.Si()}));this.Ci(e),this.Si()}))}catch(e){Nt.error("Error loading remote config",e)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||(k==null?void 0:k.visibilityState)==="hidden"||this._instance.reloadFeatureFlags()}Si(){var e;if(!this.xi){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.xi=setInterval((()=>{this.refresh()}),t))}}Ci(e){var t;e||Nt.error("Failed to fetch remote config from PostHog."),this._instance.Ci(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}}var Ie={GZipJS:"gzip-js",Base64:"base64"},ye=Uint8Array,ve=Uint16Array,vt=Uint32Array,Fr=new ye([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]),Lr=new ye([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]),Dn=new ye([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nn=function(i,e){for(var t=new ve(31),r=0;31>r;++r)t[r]=e+=1<r;++r)for(var n=t[r];t[r+1]>n;++n)s[n]=n-t[r]<<5|r;return[t,s]},Hn=Nn(Fr,2),Ar=Hn[1];Hn[0][28]=258,Ar[258]=28;for(var Un=Nn(Lr,0)[1],Vn=new ve(32768),Y=0;32768>Y;++Y){var _t=(43690&Y)>>>1|(21845&Y)<<1;Vn[Y]=((65280&(_t=(61680&(_t=(52428&_t)>>>2|(13107&_t)<<2))>>>4|(3855&_t)<<4))>>>8|(255&_t)<<8)>>>1}var Ht=function(i,e,t){for(var r=i.length,s=0,n=new ve(e);r>s;++s)++n[i[s]-1];var o,a=new ve(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new ve(r),s=0;r>s;++s)o[s]=Vn[a[i[s]-1]++]>>>15-i[s];return o},Ye=new ye(288);for(Y=0;144>Y;++Y)Ye[Y]=8;for(Y=144;256>Y;++Y)Ye[Y]=9;for(Y=256;280>Y;++Y)Ye[Y]=7;for(Y=280;288>Y;++Y)Ye[Y]=8;var Ii=new ye(32);for(Y=0;32>Y;++Y)Ii[Y]=5;var Xl=Ht(Ye,9),Gl=Ht(Ii,5),qn=function(i){return(i/8>>0)+(7&i&&1)},Bn=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var r=new(i instanceof ve?ve:i instanceof vt?vt:ye)(t-e);return r.set(i.subarray(e,t)),r},Me=function(i,e,t){var r=e/8>>0;i[r]|=t<<=7&e,i[r+1]|=t>>>8},Ut=function(i,e,t){var r=e/8>>0;i[r]|=t<<=7&e,i[r+1]|=t>>>8,i[r+2]|=t>>>16},Mr=function(i,e){for(var t=[],r=0;i.length>r;++r)i[r]&&t.push({s:r,f:i[r]});var s=t.length,n=t.slice();if(!s)return[new ye(0),0];if(s==1){var o=new ye(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(E,$){return E.f-$.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=t[t[h].f>t[u].f?u++:h++],l=t[u!=c&&t[h].f>t[u].f?u++:h++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var f=new ve(d+1),p=jr(t[c-1],f,0);if(p>e){r=0;var g=0,P=p-e,S=1<r;++r){var F=n[r].s;if(e>=f[F])break;g+=S-(1<>>=P;g>0;){var C=n[r].s;e>f[C]?g-=1<=0&&g;--r){var R=n[r].s;f[R]==e&&(--f[R],++g)}p=e}return[new ye(f),p]},jr=function(i,e,t){return i.s==-1?Math.max(jr(i.l,e,t+1),jr(i.r,e,t+1)):e[i.s]=t},Wn=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new ve(++e),r=0,s=i[0],n=1,o=function(l){t[r++]=l},a=1;e>=a;++a)if(i[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=i[a]}return[t.subarray(0,r),e]},Vt=function(i,e){for(var t=0,r=0;e.length>r;++r)t+=i[r]*e[r];return t},Dr=function(i,e,t){var r=t.length,s=qn(e+2);i[s]=255&r,i[s+1]=r>>>8,i[s+2]=255^i[s],i[s+3]=255^i[s+1];for(var n=0;r>n;++n)i[s+n+4]=t[n];return 8*(s+4+r)},zn=function(i,e,t,r,s,n,o,a,l,u,c){Me(e,c++,t),++s[256];for(var h=Mr(s,15),d=h[0],f=h[1],p=Mr(n,15),g=p[0],P=p[1],S=Wn(d),F=S[0],C=S[1],R=Wn(g),E=R[0],$=R[1],x=new ve(19),b=0;F.length>b;++b)x[31&F[b]]++;for(b=0;E.length>b;++b)x[31&E[b]]++;for(var y=Mr(x,7),T=y[0],D=y[1],j=19;j>4&&!T[Dn[j-1]];--j);var H,U,v,m,L=u+5<<3,M=Vt(s,Ye)+Vt(n,Ii)+o,q=Vt(s,d)+Vt(n,g)+o+14+3*j+Vt(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=L&&q>=L)return Dr(e,c,i.subarray(l,l+u));if(Me(e,c,1+(M>q)),c+=2,M>q){H=Ht(d,f),U=d,v=Ht(g,P),m=g;var N=Ht(T,D);for(Me(e,c,C-257),Me(e,c+5,$-1),Me(e,c+10,j-4),c+=14,b=0;j>b;++b)Me(e,c+3*b,T[Dn[b]]);c+=3*j;for(var G=[F,E],re=0;2>re;++re){var ee=G[re];for(b=0;ee.length>b;++b)Me(e,c,N[X=31&ee[b]]),c+=T[X],X>15&&(Me(e,c,ee[b]>>>5&127),c+=ee[b]>>>12)}}else H=Xl,U=Ye,v=Gl,m=Ii;for(b=0;a>b;++b)if(r[b]>255){var X;Ut(e,c,H[257+(X=r[b]>>>18&31)]),c+=U[X+257],X>7&&(Me(e,c,r[b]>>>23&31),c+=Fr[X]);var te=31&r[b];Ut(e,c,v[te]),c+=m[te],te>3&&(Ut(e,c,r[b]>>>5&8191),c+=Lr[te])}else Ut(e,c,H[r[b]]),c+=U[r[b]];return Ut(e,c,H[256]),c+U[256]},Kl=new vt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Jl=(function(){for(var i=new vt(256),e=0;256>e;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),Nr=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Yl(i,e){e===void 0&&(e={});var t=(function(){var h=4294967295;return{p(d){for(var f=h,p=0;d.length>p;++p)f=Jl[255&f^d[p]]^f>>>8;h=f},d(){return 4294967295^h}}})(),r=i.length;t.p(i);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,(function(h,d,f,p,g,P){var S=h.length,F=new ye(p+S+5*(1+Math.floor(S/7e3))+g),C=F.subarray(p,F.length-g),R=0;if(!d||8>S)for(var E=0;S>=E;E+=65535){var $=E+65535;S>$?R=Dr(C,R,h.subarray(E,$)):(C[E]=!0,R=Dr(C,R,h.subarray(E,S)))}else{for(var x=Kl[d-1],b=x>>>13,y=8191&x,T=(1<E;++E){var X=v(E),te=32767&E,Et=j[X];if(D[te]=Et,j[X]=te,E>=re){var Ki=S-E;if((q>7e3||G>24576)&&Ki>423){R=zn(h,C,0,m,L,M,N,G,ee,E-ee,R),G=q=N=0,ee=E;for(var Pe=0;286>Pe;++Pe)L[Pe]=0;for(Pe=0;30>Pe;++Pe)M[Pe]=0}var rt=2,Ji=0,$h=y,ze=te-Et&32767;if(Ki>2&&X==v(E-ze))for(var Fh=Math.min(b,Ki)-1,Lh=Math.min(32767,E),Ah=Math.min(258,Ki);Lh>=ze&&--$h&&te!=Et;){if(h[E+rt]==h[E+rt-ze]){for(var Xe=0;Ah>Xe&&h[E+Xe]==h[E+Xe-ze];++Xe);if(Xe>rt){if(rt=Xe,Ji=ze,Xe>Fh)break;var Mh=Math.min(ze,Xe-2),Da=0;for(Pe=0;Mh>Pe;++Pe){var Ps=E-ze+Pe+32768&32767,Na=Ps-D[Ps]+32768&32767;Na>Da&&(Da=Na,Et=Ps)}}}ze+=(te=Et)-(Et=D[te])+32768&32767}if(Ji){m[G++]=268435456|Ar[rt]<<18|Un[Ji];var Ha=31&Ar[rt],Ua=31&Un[Ji];N+=Fr[Ha]+Lr[Ua],++L[257+Ha],++M[Ua],re=E+rt,++q}else m[G++]=h[E],++L[h[E]]}}R=zn(h,C,!0,m,L,M,N,G,ee,E-ee,R)}return Bn(F,0,p+qn(R)+g)})(n=i,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),c=u.length;return(function(h,d){var f=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Nr(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),f){h[3]=8;for(var p=0;f.length>=p;++p)h[p+10]=f.charCodeAt(p)}})(u,e),Nr(u,c-8,t.d()),Nr(u,c-4,r),u}var Zl=!!Zi||!!Yi,Xn="text/plain",Gn=!1,Ci=function(i,e,t){var r;t===void 0&&(t=!0);var[s,n]=i.split("?"),o=w({},e),a=(r=n==null?void 0:n.split("&").map((u=>{var c,[h,d]=u.split("="),f=t&&(c=o[h])!==null&&c!==void 0?c:d;return delete o[h],h+"="+f})))!==null&&r!==void 0?r:[],l=(function(u,c){var h,d;c===void 0&&(c="&");var f=[];return J(u,(function(p,g){I(p)||I(g)||g==="undefined"||(h=encodeURIComponent((P=>P instanceof File)(p)?p.name:p.toString()),d=encodeURIComponent(g),f[f.length]=d+"="+h)})),f.join(c)})(o);return l&&a.push(l),s+"?"+a.join("&")},mt=(i,e)=>JSON.stringify(i,((t,r)=>typeof r=="bigint"?r.toString():r),e),Hr=i=>{if(i.zt)return i.zt;var{data:e,compression:t}=i;if(e){if(t===Ie.GZipJS){var r=Yl((function(a,l){var u=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new ye(a.length+(a.length>>>1)),h=0,d=function(P){c[h++]=P},f=0;u>f;++f){if(h+5>c.length){var p=new ye(h+8+(u-f<<1));p.set(c),c=p}var g=a.charCodeAt(f);128>g?d(g):2048>g?(d(192|g>>>6),d(128|63&g)):g>55295&&57344>g?(d(240|(g=65536+(1047552&g)|1023&a.charCodeAt(++f))>>>18),d(128|g>>>12&63),d(128|g>>>6&63),d(128|63&g)):(d(224|g>>>12),d(128|g>>>6&63),d(128|63&g))}return Bn(c,0,h)})(mt(e)),{mtime:0});return{contentType:Xn,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(t===Ie.Base64){var s=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((l,u)=>String.fromCharCode(parseInt(u,16)))))})(mt(e)),n=(a=>"data="+encodeURIComponent(typeof a=="string"?a:mt(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=mt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ql=(function(){var i=xe((function*(e){var t=mt(e.data),r=yield(function(n,o,a){return $s.apply(this,arguments)})(t,de.DEBUG,{rethrow:!0});if(!r)return e;var s=yield r.arrayBuffer();return w({},e,{zt:{contentType:Xn,body:s,estimatedSize:s.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),Kn=(i,e)=>Ci(i,{_:new Date().getTime().toString(),ver:de.JS_SDK_VERSION,compression:e}),$i=[];Yi&&$i.push({transport:"fetch",method(i){var e,t,{contentType:r,body:s,estimatedSize:n}=(e=Hr(i))!==null&&e!==void 0?e:{},o=new Headers;J(i.headers,(function(c,h){o.append(h,c)})),r&&o.append("Content-Type",r);var a=i.url,l=null;if(Rs){var u=new Rs;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),i.timeout)}}Yi(a,w({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&52428.8>(n||0),body:s,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then((c=>c.text().then((h=>{var d={statusCode:c.status,text:h};if(c.status===200)try{d.json=JSON.parse(h)}catch(f){O.error(f)}i.callback==null||i.callback(d)})))).catch((c=>{O.error(c),i.callback==null||i.callback({statusCode:0,error:c})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Zi&&$i.push({transport:"XHR",method(i){var e,t=new Zi;t.open(i.method||"GET",i.url,!0);var{contentType:r,body:s}=(e=Hr(i))!==null&&e!==void 0?e:{};J(i.headers,(function(n,o){t.setRequestHeader(o,n)})),r&&t.setRequestHeader("Content-Type",r),i.timeout&&(t.timeout=i.timeout),i.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(n)}},t.send(s)}}),_e!=null&&_e.sendBeacon&&$i.push({transport:"sendBeacon",method(i){var e=Ci(i.url,{beacon:"1"});try{var t,{contentType:r,body:s}=(t=Hr(i))!==null&&t!==void 0?t:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});_e.sendBeacon(e,n)}catch{}}});var Ur=3e3;class eu{constructor(e,t){this.Ti=!0,this.Ai=[],this.Ei=Re((t==null?void 0:t.flush_interval_ms)||Ur,250,5e3,O.createLogger("flush interval"),Ur),this.Ri=e}enqueue(e){this.Ai.push(e),this.Ni||this.Mi()}unload(){this.Fi();var e=this.Ai.length>0?this.Oi():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Ri(w({},r,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Mi()}Mi(){var e=this;this.Ti||(this.Ni=setTimeout((()=>{if(this.Fi(),this.Ai.length>0){var t=this.Oi(),r=function(){var n=t[s],o=new Date().getTime();n.data&&z(n.data)&&J(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Ri(n)};for(var s in t)r()}}),this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var e={};return J(this.Ai,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;I(e[n])&&(e[n]=w({},s,{data:[]})),(r=e[n].data)==null||r.push(s.data)})),this.Ai=[],e}}var tu=["retriesPerformedSoFar"];class iu{constructor(e){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=e,this.Ai=[],this.Di=!0,!I(_)&&"onLine"in _.navigator&&(this.Di=_.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},ne(_,"online",this.Bi),ne(_,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=Cs(e,tu);nt(t)&&(r.url=Ci(r.url,{retry_count:t})),this._instance._send_request(w({},r,{callback:s=>{s.statusCode===200||s.statusCode>=400&&500>s.statusCode||(t??0)>=10?r.callback==null||r.callback(s):this.Zi(w({retriesPerformedSoFar:t},r))}}))}Zi(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=(function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(u+c*(u-l))})(t),s=Date.now()+r;this.Ai.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),O.warn(n),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Vi&&clearTimeout(this.Vi),this.Ai.length===0)return this.Pi=!1,void(this.Vi=void 0);this.Vi=setTimeout((()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()}),this.Li)}ji(){var e=Date.now(),t=[],r=this.Ai.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Ai=t,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Vi&&(clearTimeout(this.Vi),this.Vi=void 0),this.Pi=!1,I(_)||(this.Bi&&(_.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(_.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(w({},e,{transport:"sendBeacon"}))}catch(t){O.error(t)}this.Ai=[]}}class ru{constructor(e){this.Hi=()=>{var t,r,s,n;this.zi||(this.zi={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.zi.lastScrollY=Math.ceil(a),this.zi.maxScrollY=Math.max(a,(t=this.zi.maxScrollY)!==null&&t!==void 0?t:0),this.zi.maxScrollHeight=Math.max(l,(r=this.zi.maxScrollHeight)!==null&&r!==void 0?r:0),this.zi.lastContentY=u,this.zi.maxContentY=Math.max(u,(s=this.zi.maxContentY)!==null&&s!==void 0?s:0),this.zi.maxContentHeight=Math.max(c,(n=this.zi.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Ui(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var e=this.zi;return setTimeout(this.Hi,0),e}startMeasuringScrollPosition(){ne(_,"scroll",this.Hi,{capture:!0}),ne(_,"scrollend",this.Hi,{capture:!0}),ne(_,"resize",this.Hi)}scrollElement(){if(!this.Ui)return _==null?void 0:_.document.documentElement;var e=z(this.Ui)?this.Ui:[this.Ui];for(var t of e){var r=_==null?void 0:_.document.querySelector(t);if(r)return r}}scrollY(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollTop||0}return _&&(_.scrollY||_.pageYOffset||_.document.documentElement.scrollTop)||0}scrollX(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollLeft||0}return _&&(_.scrollX||_.pageXOffset||_.document.documentElement.scrollLeft)||0}}var su=i=>$n(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class Jn{constructor(e,t,r,s){this.Yi=n=>{var o=this.Gi();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Wi(this._instance)};this.Xi.register({[mr]:a})}},this._instance=e,this.Ji=t,this.Xi=r,this.Wi=s||su,this.Ji.onSessionId(this.Yi)}Gi(){return this.Xi.props[mr]}getSetOnceProps(){var e,t=(e=this.Gi())==null?void 0:e.props;return t?"r"in t?Fn(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 J(Pr(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Qi(r)]=t})),e}}class Vr{constructor(){this.Ki={}}on(e,t){return this.Ki[e]||(this.Ki[e]=[]),this.Ki[e].push(t),()=>{this.Ki[e]=this.Ki[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Ki[e]||[])r(t);for(var s of this.Ki["*"]||[])s(e,t)}}var qr=Z("[SessionId]");class Yn{on(e,t){return this.Qi.on(e,t)}constructor(e,t,r){var s;if(this.tr=[],this.er=void 0,this.Qi=new Vr,this.ir=(u,c)=>!(!nt(u)||!nt(c))&&Math.abs(u-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===ke)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Xi=e.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=t||je,this.ar=r||je;var n=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*Re(this.Rt.session_idle_timeout_seconds||1800,60,36e3,qr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+n+"_window_id",this.hr="ph_"+n+"_primary_window_exists",this.cr()){var o=ue.Wt(this.ur),a=ue.Wt(this.hr);o&&!a?this.rr=o:ue.Jt(this.ur),ue.Xt(this.hr,!0)}if((s=this.Rt.bootstrap)!=null&&s.sessionID)try{var l=(u=>{var c=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,new Date().getTime(),l)}catch(u){qr.error("Invalid sessionID in bootstrap",u)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return I(this.tr)&&(this.tr=[]),this.tr.push(e),this.nr&&e(this.nr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}cr(){return this.Rt.persistence!=="memory"&&!this.Xi.fi&&ue.Ut()}pr(e){e!==this.rr&&(this.rr=e,this.cr()&&ue.Xt(this.ur,e))}gr(){return this.rr?this.rr:this.cr()?ue.Wt(this.ur):null}dr(e,t,r){e===this.nr&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.nr=e,this.Xi.register({[fi]:[t,e,r]}))}mr(){var e=this.Xi.props[fi];return z(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&_&&(_.removeEventListener(yi,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&ue.Jt(this.hr)},ne(_,yi,this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Rt.cookieless_mode===ke)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),[s,n,o]=this.mr(),a=this.gr(),l=nt(o)&&Math.abs(r-o)>864e5,u=!1,c=!n,h=!c&&!e&&this.ir(r,s);c||h||l?(n=this.sr(),a=this.ar(),qr.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.ar(),u=!0);var d=nt(s)&&e&&!l?s:r,f=nt(o)?o:new Date().getTime();return this.pr(a),this.dr(n,d,f),e||this.lr(),u&&this.tr.forEach((p=>p(n,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:f,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}lr(){clearTimeout(this.yr),this.yr=setTimeout((()=>{var[e]=this.mr();if(this.ir(new Date().getTime(),e)){var t=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var Zn=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Fs(t,e))return!0;try{var r=i==null?void 0:i.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>Fs(s==null?void 0:s.brand,e))))return!0}catch{}return!!i.webdriver},Fi=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Qn(i,e,t){return mt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var eo={exact:(i,e)=>e.some((t=>i.some((r=>t===r)))),is_not:(i,e)=>e.every((t=>i.every((r=>t!==r)))),regex:(i,e)=>e.some((t=>i.some((r=>Fi(t,r))))),not_regex:(i,e)=>e.every((t=>i.every((r=>!Fi(t,r))))),icontains:(i,e)=>e.map(Li).some((t=>i.map(Li).some((r=>t.includes(r))))),not_icontains:(i,e)=>e.map(Li).every((t=>i.map(Li).every((r=>!t.includes(r))))),gt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r>parseFloat(s)))})),lt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>ri.toLowerCase();function to(i,e){return!i||Object.entries(i).every((t=>{var[r,s]=t,n=e==null?void 0:e[r];if(I(n)||Fe(n))return!1;var o=[String(n)],a=eo[s.operator];return!!a&&a(s.values,o)}))}var Br="custom",io="i.posthog.com";class nu{constructor(e){this.br={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"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=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+io,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.br[this.apiHost]||(this.br[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":Br),this.br[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Br)return this.apiHost+t;var r=io+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var K=Z("[Surveys]"),Wr="seenSurvey_",ou=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t},ro=i=>((e,t)=>{var r=""+Wr+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+Wr+t.id+"_"+t.current_iteration),r})(0,i),au=[Ir.Popover,Ir.Widget,Ir.API],lu={ignoreConditions:!1,ignoreDelay:!1,displayType:$r.Popover},uu=Z("[PostHog ExternalIntegrations]"),cu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class hu{constructor(e){this._instance=e}ni(e,t){var r;(r=A.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return uu.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,u;!s||(a=A.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.ni(cu[o],(()=>{var c;(c=A.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)})),!s&&(l=A.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=A.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(r)}}}var yt,qt={},zr=0,Xr=()=>{},so='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Bt="Surveys module not available",no="sanitize_properties is deprecated. Use before_send instead",oo="Invalid value for property_denylist config: ",du=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,bt="posthog",ao=!Zl&&(ge==null?void 0:ge.indexOf("MSIE"))===-1&&(ge==null?void 0:ge.indexOf("Mozilla"))===-1,lo=i=>{var e;return w({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Il(k==null?void 0:k.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Xr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,debug:le&&se(le==null?void 0:le.search)&&le.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(_==null||(e=_.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){O.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sr,before_send:void 0,request_queue_config:{flush_interval_ms:Ur},error_tracking:{},_onCapture:Xr,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},fu=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],uo=i=>{var e={};for(var[t,r]of fu)I(i[t])||(e[r]=i[t]);var s=ie({},e,i);return z(i.property_blacklist)&&(I(i.property_denylist)?s.property_denylist=i.property_blacklist:z(i.property_denylist)?s.property_denylist=[...i.property_blacklist,...i.property_denylist]:O.error(oo+i.property_denylist)),s};class pu{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(e){O.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class be{_r(e,t){if(e){var r=this.Ir.indexOf(e);r!==-1&&this.Ir.splice(r,1)}return this.Ir.push(t),t.initialize==null||t.initialize(),t}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new pu,this.Cr=!1,this.version=de.LIB_VERSION,this.Sr=new Vr,this.Ir=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=lo(),this.SentryIntegration=Hl,this.sentryIntegration=r=>(function(s,n){var o=kn(s,n);return{name:En,processEvent:a=>o(a)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kr=!1,this.Tr=null,this.Ar=null,this.Er=null,this.scrollManager=new ru(this),this.pageViewManager=new Pn(this),this.rateLimiter=new zl(this),this.requestRouter=new nu(this),this.consent=new jl(this),this.externalIntegrations=new hu(this);var t=(e=be.__defaultExtensionClasses)!==null&&e!==void 0?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:(r,s,n)=>{var o=se(r)?{[r]:s}:r;this.setPersonProperties(o),n==null||n({})},set_once:(r,s,n)=>{var o=se(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),n==null||n({})}},this.on("eventCaptured",(r=>O.info('send "'+(r==null?void 0:r.event)+'"',r)))}init(e,t,r){if(r&&r!==bt){var s,n=(s=qt[r])!==null&&s!==void 0?s:new be;return n._init(e,t,r),qt[r]=n,qt[bt][r]=n,n}return this._init(e,t,r)}_init(e,t,r){var s,n,o,a;if(t===void 0&&(t={}),I(e)||oi(e))return O.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.Rr(t.debug),this.Nr=t,this.Mr=[],t.person_profiles?this.Ar=t.person_profiles:t.process_person&&(this.Ar=t.process_person),this.set_config(ie({},lo(t.defaults),uo(t),{name:r,token:e})),this.config.on_xhr_error&&O.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Ie.GZipJS;var l=this.Fr();this.persistence=new Tr(this.config,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Tr(w({},this.config,{persistence:"sessionStorage"}),l);var u=w({},this.persistence.props),c=w({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Or=new eu((R=>this.Pr(R)),this.config.request_queue_config),this.Lr=new iu(this),this.__request_queue=[];var h=this.config.cookieless_mode===ke||this.config.cookieless_mode===Ae&&this.consent.isExplicitlyOptedOut();h||(this.sessionManager=new Yn(this),this.sessionPropsManager=new Jn(this,this.sessionManager,this.persistence));var d=(s=A._POSTHOG_REMOTE_CONFIG)==null||(s=s[this.config.token])==null?void 0:s.config,f=d==null||(n=d.sdkVersion)==null?void 0:n.resolved;if(f&&(du.test(f)?this._resolvedSdkVersion=f:O.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+f)),this.config.__preview_deferred_init_extensions?(O.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(h)}),0)):(O.info("Initializing extensions synchronously"),this.Dr(h)),de.DEBUG=de.DEBUG||this.config.debug,de.DEBUG&&O.info("Starting in debug mode",{this:this,config:t,thisC:w({},this.config),p:u,s:c}),!this.config.identity_distinct_id||(o=t.bootstrap)!=null&&o.distinctID||(t.bootstrap=w({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var p=t.bootstrap.distinctID,g=this.get_distinct_id(),P=this.persistence.get_property(Ee);if(t.bootstrap.isIdentifiedID&&g!=null&&g!==p&&P===dt)this.identify(p);else if(t.bootstrap.isIdentifiedID&&g!=null&&g!==p&&P===ft)O.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 S=this.config.get_device_id(je()),F=t.bootstrap.isIdentifiedID?S:p;this.persistence.set_property(Ee,t.bootstrap.isIdentifiedID?ft:dt),this.register({distinct_id:p,$device_id:F})}}if(h)this.register_once({distinct_id:_i,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(je());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(Ee,dt)}return ne(_,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(R,E){var $=R.config.segment;if(!$)return E();(function(x,b){var y=x.config.segment;if(!y)return b();var T=j=>{var H=()=>j.anonymousId()||je();x.config.get_device_id=H,j.id()&&(x.register({distinct_id:j.id(),$device_id:H()}),x.persistence.set_property(Ee,ft)),b()},D=y.user();"then"in D&&$e(D.then)?D.then(T):T(D)})(R,(()=>{$.register((x=>{Promise&&Promise.resolve||Rr.warn("This browser does not have Promise support, and can not use the segment integration");var b=(y,T)=>{if(!T)return y;y.event.userId||y.event.anonymousId===x.get_distinct_id()||(Rr.info("No userId set, resetting PostHog"),x.reset()),y.event.userId&&y.event.userId!==x.get_distinct_id()&&(Rr.info("UserId set, identifying with PostHog"),x.identify(y.event.userId));var D=x.calculateEventProperties(T,y.event.properties);return y.event.properties=Object.assign({},D,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:y=>b(y,y.event.event),page:y=>b(y,pt),identify:y=>b(y,kr),screen:y=>b(y,"$screen")}})(R)).then((()=>{E()}))}))})(this,(()=>this.Br())):this.Br(),$e(this.config._onCapture)&&this.config._onCapture!==Xr&&(O.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(R=>this.config._onCapture(R.event,R)))),this.config.ip&&O.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}Dr(e){var t,r,s,n,o,a,l,u=performance.now(),c=w({},be.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.featureFlags&&this.Ir.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new c.featureFlags(this)),c.exceptions&&this.Ir.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new c.exceptions(this)),c.historyAutocapture&&this.Ir.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ir.push(new c.tracingHeaders(this)),c.siteApps&&this.Ir.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ir.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this.Ir.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ir.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new c.surveys(this)),c.logs&&this.Ir.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new c.logs(this)),c.conversations&&this.Ir.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ir.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ir.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ir.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ir.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ir.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Nl)),c.toolbar&&this.Ir.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.Ir.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new c.experiments(this)),this.Ir.forEach((d=>{d.initialize&&h.push((()=>{d.initialize==null||d.initialize()}))})),h.push((()=>{if(this.jr){var d=this.jr;this.jr=void 0,this.Ci(d)}})),this.qr(h,u)}qr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.qr(e,t)}),0);var r=e.shift();if(r)try{r()}catch(n){O.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&O.info("PostHog extensions initialized ("+s+"ms)")}Ci(e){var t;if(!k||!k.body)return O.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ci(e)}),500);this.config.__preview_deferred_init_extensions&&(this.jr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=B(e.supportedCompression,Ie.GZipJS)?Ie.GZipJS:B(e.supportedCompression,Ie.Base64)?Ie.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ar?this.Ar:Sr}),this.Ir.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e)))}Br(){try{this.config.loaded(this)}catch(r){O.critical("`loaded` function failed",r)}if(this.Zr(),this.config.internal_or_test_user_hostname&&le!=null&&le.hostname){var e=le.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===ke)&&this.$r()}),1),this.Vr=new jn(this),this.Vr.load()}Zr(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Or)==null||e.enable())}_dom_loaded(){this.is_capturing()&&bi(this.__request_queue,(e=>this.Pr(e))),this.__request_queue=[],this.Zr()}_handle_unload(){var e,t,r,s;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Hr()&&this.capture(Er),(t=this.logs)==null||t.flushLogs("sendBeacon"),(r=this.Or)==null||r.unload(),(s=this.Lr)==null||s.unload()):this.Hr()&&this.capture(Er,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ao?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ci(e.url,{ip:this.config.ip?1:0}),e.headers=w({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,s,n,o=w({},t);o.timeout=o.timeout||6e4,o.url=Kn(o.url,o.compression);var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=$i.filter((c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport))),u=(s=(n=(function(c,h){for(var d=0;c.length>d;d++)if(c[d].transport===a)return c[d]})(l))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===Ie.GZipJS&&qa&&!Gn?Ql(o).then((c=>{u(c)})).catch((c=>{if((h=>!(!h||typeof h!="object")&&("name"in h?String(h.name):"")==="NotReadableError")(c))return Gn=!0,void u(w({},o,{compression:void 0,url:Kn(t.url,void 0)}));u(o)})):u(o)})(w({},e,{callback:t=>{var r,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,t),e.callback==null||e.callback(t)}}))))}Pr(e){this.Lr?this.Lr.retriableRequest(e):this._send_request(e)}_execute_array(e){zr++;try{var t,r=[],s=[],n=[];bi(e,(a=>{a&&(z(t=a[0])?n.push(a):$e(a)?a.call(this):z(a)&&t==="alias"?r.push(a):z(a)&&t.indexOf("capture")!==-1&&$e(this[t])?n.push(a):s.push(a))}));var o=function(a,l){bi(a,(function(u){if(z(u[0])){var c=l;J(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else l[u[0]].apply(l,u.slice(1))}))};o(r,this),o(s,this),o(n,this)}finally{zr--}}push(e){if(zr>0&&z(e)&&se(e[0])){var t=be.prototype[e[0]];$e(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Or){if(this.is_capturing())if(!I(e)&&se(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){t!=null&&t.$current_url&&!se(t==null?void 0:t.$current_url)&&(O.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||r!=null&&r.zr||O.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(r==null?void 0:r.timestamp)||h,f=je(),p={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},d,f)};e===pt&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),r!=null&&r.$set&&(p.$set=r==null?void 0:r.$set);var g,P=this.Ur(r==null?void 0:r.$set_once,e!==mn,e===kr);if(P&&(p.$set_once=P),r!=null&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=x=>se(x)?x.slice(0,n):x,l=new Set,p=(function x(b,y){return b!==Object(b)?a?a(b):b:l.has(b)?void 0:(l.add(b),z(b)?(T=[],bi(b,(D=>{T.push(x(D))}))):(T={},J(b,((D,j)=>{l.has(D)||(T[j]=x(D))}))),T);var T})(o)),p.timestamp=d,I(r==null?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),e===Dt.DISMISSED||e===Dt.SENT){var S=t==null?void 0:t[Cr.SURVEY_ID],F=t==null?void 0:t[Cr.SURVEY_ITERATION];g={id:S,current_iteration:F},localStorage.getItem(ro(g))||localStorage.setItem(ro(g),"true"),p.$set=w({},p.$set,{[ou({id:S,current_iteration:F},e===Dt.SENT?"responded":"dismissed")]:!0})}else e===Dt.SHOWN&&(p.$set=w({},p.$set,{[Cr.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Wl.SHOWN){var C=t==null?void 0:t[An.TOUR_TYPE];C&&(p.$set=w({},p.$set,{[An.TOUR_LAST_SEEN_DATE+"/"+C]:new Date().toISOString()}))}var R=w({},p.properties.$set,p.$set);if(st(R)||this.setPersonPropertiesForFlags(R),!W(this.config.before_send)){var E=this.Yr(p);if(!E)return;p=E}this.Sr.emit("eventCaptured",p);var $={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Pr($):this.Or.enqueue($),p}O.critical("This capture call is ignored due to client rate limiting.")}}else O.error("No event name provided to posthog.capture")}else O.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=w({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode==ke||this.config.cookieless_mode==Ae&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=w({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!se(a.distinct_id)&&!Se(a.distinct_id)||oi(a.distinct_id))&&O.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=(function(S,F){var C,R,E,$;if(!ge)return{};var x,b,y,T,D,j,H,U,v=S?[...gt,...F||[]]:[],[m,L]=(function(M){for(var q=0;tn.length>q;q++){var[N,G]=tn[q],re=N.exec(M),ee=re&&($e(G)?G(re,M):G);if(ee)return ee}return["",""]})(ge);return ie(Pr({$os:m,$os_version:L,$browser:en(ge,navigator.vendor),$device:rn(ge),$device_type:(b=ge,y={userAgentDataPlatform:(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,maxTouchPoints:(R=navigator)==null?void 0:R.maxTouchPoints,screenWidth:_==null||(E=_.screen)==null?void 0:E.width,screenHeight:_==null||($=_.screen)==null?void 0:$.height,devicePixelRatio:_==null?void 0:_.devicePixelRatio},U=rn(b),U===Ns||U===Ds||U==="Kobo"||U==="Kindle Fire"||U===Qs?ot:U===Pt||U===ut||U===Ot||U===ar?"Console":U===Us?"Wearable":U?me:(y==null?void 0:y.userAgentDataPlatform)==="Android"&&((T=y==null?void 0:y.maxTouchPoints)!==null&&T!==void 0?T:0)>0?600>Math.min((D=y==null?void 0:y.screenWidth)!==null&&D!==void 0?D:0,(j=y==null?void 0:y.screenHeight)!==null&&j!==void 0?j:0)/((H=y==null?void 0:y.devicePixelRatio)!==null&&H!==void 0?H:1)?me:ot:"Desktop"),$timezone:Ln(),$timezone_offset:ql()}),{$current_url:At(le==null?void 0:le.href,v,Mt),$host:le==null?void 0:le.host,$pathname:le==null?void 0:le.pathname,$raw_user_agent:ge.length>1e3?ge.substring(0,997)+"...":ge,$browser_version:nl(ge,navigator.vendor),$browser_language:In(),$browser_language_prefix:(x=In(),typeof x=="string"?x.split("-")[0]:void 0),$screen_height:_==null?void 0:_.screen.height,$screen_width:_==null?void 0:_.screen.width,$viewport_height:_==null?void 0:_.innerHeight,$viewport_width:_==null?void 0:_.innerWidth,$lib:de.LIB_NAME,$lib_version:de.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=h,a.$window_id=d}this.sessionPropsManager&&ie(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ie(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Lr)==null?void 0:f.length}catch(S){a.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===Br&&(a.$lib_custom_api_host=this.config.api_host),u=e!==pt||n?e!==Er||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=ie(a,u),e===pt&&k&&(a.title=k.title),!I(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}ge&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ie({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),z(this.config.property_denylist)?J(this.config.property_denylist,(function(S){delete a[S]})):O.error(oo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(O.error(no),a=g(a,e));var P=this.Gr();return a.$process_person_profile=P,P&&!n&&this.Wr("_calculate_event_properties"),a}Ur(e,t,r){var s;if(t===void 0&&(t=!0),r===void 0&&(r=!1),!this.persistence||!this.Gr()||this.Cr&&!r)return e;var n=this.persistence.get_initial_props(),o=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),a=ie({},n,o||{},e||{}),l=this.config.sanitize_properties;return l&&(O.error(no),a=l(a,"$set_once")),t&&(this.Cr=!0),st(a)?void 0:a}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var s;(s=this.persistence)==null||s.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Xr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var s;return t===void 0&&(t=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.Sr.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:Bt}),()=>{})}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Bt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Bt})}renderSurvey(e,t){var r;(r=this.surveys)==null||r.renderSurvey(e,t)}displaySurvey(e,t){var r;t===void 0&&(t=lu),(r=this.surveys)==null||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return(t=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Bt}}canRenderSurveyAsync(e,t){var r,s;return t===void 0&&(t=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,t))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Bt})}Jr(e){return!e||oi(e)?(O.critical("Unique user id has not been set in posthog.identify"),!1):e===_i?(O.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())||(O.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return O.uninitializedWarning("posthog.identify");if(Se(e)&&(e=e.toString(),O.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jr(e)&&this.Wr("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(hi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(Tt)&&(this.unregister(Tt),this.register({distinct_id:e}));var n,o=(this.persistence.get_property(Ee)||dt)===dt;e!==s&&o?(this.persistence.set_property(Ee,ft),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(kr,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this.Er=Qn(e,t,r),(n=this.featureFlags)==null||n.setAnonymousDistinctId(s)):(t||r)&&this.setPersonProperties(t,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Ft))}}setPersonProperties(e,t){if((e||t)&&this.Wr("posthog.setPersonProperties")){var r=Qn(this.get_distinct_id(),e,t);this.Er!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Er=r):O.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var s=this.getGroups(),n=s[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:w({},s,{[e]:t})}),n||r){var o={$group_type:e,$group_key:t};r&&(o.$group_set=r),this.capture(mn,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else O.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;t===void 0&&(t=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var r;t===void 0&&(t=!0),this.Wr("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,r,s,n,o,a,l,u;if(O.info("reset"),!this.__loaded)return O.uninitializedWarning("posthog.reset");var c=this.get_property(hi);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(n=this.Vr)==null||n.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(l=this.persistence)==null||l.set_property(Ee,dt),(u=this.sessionManager)==null||u.resetSessionId(),this.Er=null,this.config.cookieless_mode===ke)this.register_once({distinct_id:_i,$device_id:null},"");else{var h=this.config.get_device_id(je());this.register_once({distinct_id:h,$device_id:e?h: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 r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(r=this.conversations)==null||r.Kr()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Qr()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&r){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,t){return e===this.get_property(ln)?(O.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wr("posthog.alias")?(I(t)&&(t=this.get_distinct_id()),e!==t?(this.Xr(Tt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(O.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=w({},this.config);if(ae(e)){var r,s,n,o,a,l,u,c,h;ie(this.config,uo(e));var d=this.Fr();(r=this.persistence)==null||r.update_config(this.config,t,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Tr(w({},this.config,{persistence:"sessionStorage"}),d);var f=this.Rr(this.config.debug);Oe(f)&&(this.config.debug=f),Oe(this.config.debug)&&(this.config.debug?(de.DEBUG=!0,Q.Ut()&&Q.Xt("ph_debug",!0),O.info("set_config",{config:e,oldConfig:t,newConfig:w({},this.config)})):(de.DEBUG=!1,Q.Ut()&&Q.Jt("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(c=this.surveys)==null||c.loadIfEnabled(),this.tn(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){de.LIB_NAME=e,de.LIB_VERSION=t}startSessionRecording(e){var t,r,s,n,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(w({},s,t))}}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:be.en}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return(t=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:bt;return t!==bt&&(t=bt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Ee))===ft||((t=this.sessionPersistence)==null?void 0:t.get_property(Ee))===ft}Gr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===Sr&&!this._isIdentified()&&st(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Tt])&&((t=this.persistence)==null||(t=t.props)==null||!t[vi]))}Hr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gr()||this.Wr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wr(e){return this.config.person_profiles==="never"?(O.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xr(vi,!0),!0)}Fr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ae)}tn(){var e,t,r,s,n=this.Fr();return((e=this.persistence)==null?void 0:e.fi)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.fi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==ke){if(this.config.cookieless_mode===Ae&&this.consent.isExplicitlyOptedOut()){var r,s,n,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new Yn(this),this.pageViewManager=new Pn(this),this.persistence&&(this.sessionPropsManager=new Jn(this,this.sessionManager,this.persistence));var l=(n=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&n!==void 0?n:(a=be.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this._r(this.sessionRecording,new l(this)))}var u,c;this.consent.optInOut(!0),this.tn(),this.Zr(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ae&&((u=this.surveys)==null||u.loadIfEnabled()),(I(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e==null?void 0:e.captureEventName)!==null&&c!==void 0?c:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$r()}else O.warn(so)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==ke?(this.config.cookieless_mode===Ae&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===Ae&&(this.register({distinct_id:_i,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.$r())):O.warn(so)}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 e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===ke||(this.config.cookieless_mode===Ae?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return _e?Zn(_e,this.config.custom_blocked_useragents):void 0}$r(){k&&(k.visibilityState==="visible"?this.kr||(this.kr=!0,this.capture(pt,{title:k.title},{send_instantly:!0}),this.Tr&&(k.removeEventListener(mi,this.Tr),this.Tr=null)):this.Tr||(this.Tr=this.$r.bind(this),ne(k,mi,this.Tr)))}debug(e){e===!1?(_==null||_.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(_==null||_.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}))}ki(){var e,t,r,s,n,o,a=this.Nr||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(O.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):(r="advanced_disable_decide",s=O,n=(t="advanced_disable_flags")in(e=a)&&!W(e[t]),o=r in e&&!W(e[r]),n?e[t]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]))}Yr(e){if(W(this.config.before_send))return e;var t=z(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of t){if(r=s(r),W(r)){var n="Event '"+e.event+"' was rejected in beforeSend function";return Xa(e.event)?O.warn(n+". This can cause unexpected behavior."):O.info(n),null}r.properties&&!st(r.properties)||O.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.ai)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Rr(e){var t=Oe(e)&&!e,r=Q.Ut()&&Q.Gt("ph_debug")==="true";return!t&&(!!r||e)}}function co(i){return i instanceof Element&&(i.id===_n||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Ai(i){return!!i&&i.nodeType===1}function De(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function ho(i){return!!i&&i.nodeType===3}function fo(i){return!!i&&i.nodeType===11}function Gr(i){return i?si(i).split(/\s+/):[]}function po(i){var e=_==null?void 0:_.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Mi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return Gr(e)}function go(i){return W(i)?null:si(i).split(/(\s+)/).filter((e=>zt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wt(i){var e="";return Yr(i)&&!wo(i)&&i.childNodes&&i.childNodes.length&&J(i.childNodes,(function(t){var r;ho(t)&&t.textContent&&(e+=(r=go(t.textContent))!==null&&r!==void 0?r:"")})),si(e)}function vo(i){return I(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}be.__defaultExtensionClasses={},be.en={trace:yt=()=>{},debug:yt,info:yt,warn:yt,error:yt,fatal:yt},(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=Rl(i.prototype[e[t]])})(be,["identify"]);var Kr=["a","button","form","input","select","textarea","label"];function _o(i,e){if(I(e))return!0;var t,r=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var s of i)if(t=r(s))return t.v;return!1}function mo(i){var e=i.parentNode;return!(!e||!Ai(e))&&e}var gu=["next","previous","prev",">","<"],yo=[".ph-no-rageclick",".ph-no-capture"],Jr=i=>!i||De(i,"html")||!Ai(i),bo=(i,e)=>{if(!_||Jr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[i],s=i;s.parentNode&&!De(s,"body");)if(fo(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=mo(s);if(!n)break;if(e||Kr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=_.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}r.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:r}};function Yr(i){for(var e=i;e.parentNode&&!De(e,"body");e=e.parentNode){var t=Mi(e);if(B(t,"ph-sensitive")||B(t,"ph-no-capture"))return!1}if(B(Mi(i),"ph-include"))return!0;var r=i.type||"";if(se(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=i.name||i.id||"";return!se(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function wo(i){return!!(De(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||De(i,"select")||De(i,"textarea")||i.getAttribute("contenteditable")==="true")}var xo="(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})",vu=new RegExp("^(?:"+xo+")$"),_u=new RegExp(xo),So="\\d{3}-?\\d{2}-?\\d{4}",mu=new RegExp("^("+So+")$"),yu=new RegExp("("+So+")");function zt(i,e){return e===void 0&&(e=!0),!(W(i)||se(i)&&(i=si(i),(e?vu:_u).test((i||"").replace(/[- ]/g,""))||(e?mu:yu).test(i)))}function Eo(i){var e=Wt(i);return zt(e=(e+" "+ko(i)).trim())?e:""}function ko(i){var e="";return i&&i.childNodes&&i.childNodes.length&&J(i.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Wt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+ko(t)).trim())}catch(n){O.error("[AutoCapture]",n)}})),e}function Po(i){return i.replace(/"|\\"/g,'\\"')}function bu(i){var e=i.attr__class;return e?z(e)?e:Gr(e):void 0}class Oo{constructor(e){this.disabled=e===!1;var t=ae(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)r-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var Zr="$copy_autocapture",Ro=Z("[AutoCapture]");function Qr(i,e){return e.length>i?e.slice(0,i)+"...":e}function wu(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Ai(e));return e}function xu(i,e){for(var t,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[i],c=i;c.parentNode&&!De(c,"body");)fo(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,d,f=[],p={},g=!1,P=!1;if(J(u,(E=>{var $=Yr(E);E.tagName.toLowerCase()==="a"&&(g=E.getAttribute("href"),g=$&&g&&zt(g)&&g),B(Mi(E),"ph-no-capture")&&(P=!0),f.push((function(b,y,T,D){var j=b.tagName.toLowerCase(),H={tag_name:j};Kr.indexOf(j)>-1&&!T&&(H.$el_text=j.toLowerCase()==="a"||j.toLowerCase()==="button"?Qr(1024,Eo(b)):Qr(1024,Wt(b)));var U=Mi(b);U.length>0&&(H.classes=U.filter((function(M){return M!==""}))),J(b.attributes,(function(M){var q;if((!wo(b)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(D==null||!D.includes(M.name))&&!y&&zt(M.value)&&(!se(q=M.name)||q.substring(0,10)!=="_ngcontent"&&q.substring(0,7)!=="_nghost")){var N=M.value;M.name==="class"&&(N=Gr(N).join(" ")),H["attr__"+M.name]=Qr(1024,N)}}));for(var v=1,m=1,L=b;L=wu(L);)v++,L.tagName===b.tagName&&m++;return H.nth_child=v,H.nth_of_type=m,H})(E,n,o,a));var x=(function(b){if(!Yr(b))return{};var y={};return J(b.attributes,(function(T){if(T.name&&T.name.indexOf("data-ph-capture-attribute")===0){var D=T.name.replace("data-ph-capture-attribute-",""),j=T.value;D&&j&&zt(j)&&(y[D]=j)}})),y})(E);ie(p,x)})),P)return{props:{},explicitNoCapture:P};if(o||(f[0].$el_text=i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?Eo(i):Wt(i)),g){var S,F;f[0].attr__href=g;var C=(S=ki(g))==null?void 0:S.host,R=_==null||(F=_.location)==null?void 0:F.host;C&&R&&C!==R&&(h=g)}return{props:ie({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:(d=f,(function(E){return E.map(($=>{var x,b,y="";if($.tag_name&&(y+=$.tag_name),$.attr_class)for(var T of($.attr_class.sort(),$.attr_class))y+="."+T.replace(/"/g,"");var D=w({},$.text?{text:$.text}:{},{"nth-child":(x=$.nth_child)!==null&&x!==void 0?x:0,"nth-of-type":(b=$.nth_of_type)!==null&&b!==void 0?b:0},$.href?{href:$.href}:{},$.attr_id?{attr_id:$.attr_id}:{},$.attributes),j={};return wi(D).sort(((H,U)=>{var[v]=H,[m]=U;return v.localeCompare(m)})).forEach((H=>{var[U,v]=H;return j[Po(U.toString())]=Po(v.toString())})),(y+=":")+wi(j).map((H=>{var[U,v]=H;return U+'="'+v+'"'})).join("")})).join(";")})((function(E){return E.map(($=>{var x,b,y={text:(x=$.$el_text)==null?void 0:x.slice(0,400),tag_name:$.tag_name,href:(b=$.attr__href)==null?void 0:b.slice(0,2048),attr_class:bu($),attr_id:$.attr__id,nth_child:$.nth_child,nth_of_type:$.nth_of_type,attributes:{}};return wi($).filter((T=>{var[D]=T;return D.indexOf("attr__")===0})).forEach((T=>{var[D,j]=T;return y.attributes[D]=j})),y}))})(d)))},(t=f[0])!=null&&t.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}var Xt=Z("[ExceptionAutocapture]");function To(i,e,t){try{if(!(e in i))return()=>{};var r=i[e],s=t(r);return $e(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=s,()=>{i[e]=r}}catch{return()=>{}}}var Su=Z("[TracingHeaders]"),Ne=Z("[Web Vitals]"),Io=9e5,Co="disabled",$o="lazy_loading",Gt="awaiting_config",ji="missing_config";Z("[SessionRecording]"),Z("[SessionRecording]");var es="[SessionRecording]",He=Z(es),Eu=Z("[Heatmaps]");function Fo(i){return ae(i)&&"clientX"in i&&"clientY"in i&&Se(i.clientX)&&Se(i.clientY)}var Lo=Z("[Product Tours]"),ts="ph_product_tours",ku=["$set_once","$set"],Ue=Z("[SiteApps]"),Ao="Error while initializing PostHog app with config id ";function wt(i,e,t){if(W(i))return!1;switch(t){case"exact":return i===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class Pu{constructor(e){this.rn=new Vr,this.nn=(t,r)=>this.sn(t,r)&&this.an(t,r)&&this.ln(t,r)&&this.un(t,r),this.sn=(t,r)=>r==null||!r.event||(t==null?void 0:t.event)===(r==null?void 0:r.event),this._instance=e,this.hn=new Set,this.cn=new Set}init(){var e,t;I((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((r,s)=>{this.on(r,s)}))}register(e){var t,r;if(!I((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.cn)==null||a.add(o),(l=o.steps)==null||l.forEach((u=>{var c;(c=this.hn)==null||c.add((u==null?void 0:u.event)||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var r;t!=null&&e.length!=0&&(this.hn.has(e)||this.hn.has(t==null?void 0:t.event))&&this.cn&&((r=this.cn)==null?void 0:r.size)>0&&this.cn.forEach((s=>{this.dn(t,s)&&this.rn.emit("actionCaptured",s.name)}))}vn(e){this.onAction("actionCaptured",(t=>e(t)))}dn(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var r of t.steps)if(this.nn(e,r))return!0;return!1}onAction(e,t){return this.rn.on(e,t)}an(e,t){if(t!=null&&t.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!wt(s,t.url,t.url_matching||"contains"))return!1}return!0}ln(e,t){return!!this.fn(e,t)&&!!this.pn(e,t)&&!!this.gn(e,t)}fn(e,t){var r;if(t==null||!t.href)return!0;var s=this.mn(e);if(s.length>0)return s.some((a=>wt(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&wt((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}pn(e,t){var r;if(t==null||!t.text)return!0;var s=this.mn(e);if(s.length>0)return s.some((u=>wt(u.text,t.text,t.text_matching||"exact")||wt(u.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],d=/(?::|")text="(.*?)"/g;!W(c=d.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((u=>wt(u,o,a))))}gn(e,t){var r,s;if(t==null||!t.selector)return!0;var n=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}mn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}un(e,t){return t==null||!t.properties||t.properties.length===0||to(t.properties.reduce(((r,s)=>{var n=z(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r}),{}),e==null?void 0:e.properties)}}class Ou{constructor(e){this._instance=e,this.yn=new Map,this.bn=new Map,this.wn=new Map}_n(e,t){return!!e&&to(e.propertyFilters,t==null?void 0:t.properties)}In(e,t){var r=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}}))})),r}Cn(e,t,r){var s=(r===jt.Activation?this.yn:this.bn).get(e),n=[];return this.Sn((o=>{n=o.filter((a=>s==null?void 0:s.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find((u=>u.name===e));return this._n(l,t)}))}register(e){var t;I((t=this._instance)==null?void 0:t._addCaptureHook)||(this.kn(e),this.xn(e))}xn(e){var t=e.filter((r=>{var s,n;return((s=r.conditions)==null?void 0:s.actions)&&((n=r.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Tn==null&&(this.Tn=new Pu(this._instance),this.Tn.init(),this.Tn.vn((r=>{this.onAction(r)}))),t.forEach((r=>{var s,n,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(n=r.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Tn)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.wn.get(u.name);c&&c.push(r.id),this.wn.set(u.name,c||[r.id])}})))})))}kn(e){var t,r=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),s=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.cancelEvents)&&((a=n.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));r.length===0&&s.length===0||((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.yn=this.In(e,jt.Activation),this.bn=this.In(e,jt.Cancellation))}onEvent(e,t){var r,s=this.re(),n=this.An(),o=this.En(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[n])||[];if(o===e&&t&&a.length>0){var l,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(u=t.properties)==null?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);0>h||(a.splice(h,1),this.Rn(a))}}else{if(this.bn.has(e)){var d=this.Cn(e,t,jt.Cancellation);d.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((p=>p.id))}),d.forEach((p=>{var g=a.indexOf(p.id);0>g||a.splice(g,1),this.Nn(p.id)})),this.Rn(a))}if(this.yn.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.yn.get(e)});var f=this.Cn(e,t,jt.Activation);this.Rn(a.concat(f.map((p=>p.id))||[]))}}}onAction(e){var t,r=this.An(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[];this.wn.has(e)&&this.Rn(s.concat(this.wn.get(e)||[]))}Rn(e){var t,r=this.re(),s=this.An(),n=[...new Set(e)].filter((o=>!this.Mn(o)));r.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.An();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.yn}Fn(){return this.Tn}}class Ru extends Ou{constructor(e){super(e)}An(){return"$surveys_activated"}En(){return Dt.SHOWN}Sn(e){var t;(t=this._instance)==null||t.getSurveys(e)}Nn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}re(){return K}Mn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var is="SDK is not enabled or survey functionality is not yet loaded",Mo="Disabled. Not loading surveys.",Tu=_!=null&&_.location?Oi(_.location.hash,"__posthog")||Oi(location.hash,"state"):null,jo="_postHogToolbarParams",Do=Z("[Toolbar]"),pe=Z("[FeatureFlags]"),Ze=Z("[FeatureFlags]",{debugEnabled:!0}),rs=`" failed. Feature flags didn't load in time.`,ss="$active_feature_flags",Ve="$override_feature_flags",No="$feature_flag_payloads",Kt="$override_feature_flag_payloads",Ho="$feature_flag_request_id",Uo=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},Vo=i=>{var e={};for(var[t,r]of wi(i||{}))r&&(e[t]=r);return e},ns=Z("[Error tracking]"),qo="Refusing to render web experiment since the viewer is a likely bot",Iu={icontains:(i,e)=>!!_&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!_&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!_&&Fi(e.href,i),not_regex:(i,e)=>!!_&&!Fi(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class ce{get Rt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((s=>{ce.On("retrieved web experiments from the server"),t.Pn=new Map,s.forEach((n=>{if(n.feature_flag_key){var o;t.Pn&&(ce.On("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Pn)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);se(a)&&n.variants[a]&&t.Ln(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];ce.Dn(u)&&t.Ln(n.name,l,u.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())ce.On(qo);else if(!this.Rt.disable_web_experiments){if(W(this.Pn))return this.Pn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ce.On("applying feature flags",e),e.forEach((t=>{var r;if(this.Pn&&(r=this.Pn)!=null&&r.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.Pn)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.Ln(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=ce.getWindowLocation();if(e!=null&&e.search){var t=Pi(e==null?void 0:e.search,"__experiment_id"),r=Pi(e==null?void 0:e.search,"__experiment_variant");t&&r&&(ce.On("previewing web experiments "+t+" && "+r),this.getWebExperiments((s=>{this.Bn(parseInt(t),r,s)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.Rt.disable_web_experiments&&!r)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.Rt.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Bn(e,t,r){var s=r.filter((n=>n.id===e));s&&s.length>0&&(ce.On("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ln(s[0].name,t,s[0].variants[t].transforms))}static Dn(e){return!W(e.conditions)&&ce.jn(e)&&ce.qn(e)}static jn(e){var t;if(W(e.conditions)||W((t=e.conditions)==null?void 0:t.url))return!0;var r,s,n,o=ce.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||Iu[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return _==null?void 0:_.location}static qn(e){var t;if(W(e.conditions)||W((t=e.conditions)==null?void 0:t.utm))return!0;var r=On();if(r.utm_source){var s,n,o,a,l,u,c,h,d=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,g=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return d&&p&&g&&f}return!1}static On(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;t>s;s++)r[s-1]=arguments[s];O.info("[WebExperiments] "+e,r)}Ln(e,t,r){this._is_bot()?ce.On(qo):t!=="control"?r.forEach((s=>{if(s.selector){var n;ce.On("applying transform of variant "+t+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o==null||o.forEach((a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):ce.On("Control variants leave the page unmodified.")}_is_bot(){return _e&&this._instance?Zn(_e,this.Rt.custom_blocked_useragents):void 0}}var we=Z("[Conversations]"),Qe="Conversations not available yet.",Bo={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}},Cu=Bo.info;function Wo(i){if(Oe(i))return{boolValue:i};if(Se(i))return Number.isInteger(i)?{intValue:i}:{doubleValue:i};if(typeof i=="string")return{stringValue:i};if(z(i))return{arrayValue:{values:i.map((e=>Wo(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function zo(i){var e=[];for(var t in i){var r=i[t];Fe(r)||I(r)||e.push({key:t,value:Wo(r)})}return e}var Di={featureFlags:class{constructor(i){this.Zn=!1,this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.Yn=!1,this.Gn=!1,this._instance=i,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Wn(i){return this._instance.get_property(i)}Xn(){var i,e;return(i=(e=this.Xi)==null?void 0:e.pi(this.Rt.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}Jn(){return!!this.Xn()&&(this.Gn||this.Vn||(this.Gn=!0,pe.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Kn(){var i,e=(i=this.Rt.evaluation_contexts)!==null&&i!==void 0?i:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(pe.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),e!=null&&e.length?e.filter((t=>{var r=t&&typeof t=="string"&&t.trim().length>0;return r||pe.error("Invalid evaluation context found:",t,"Expected non-empty string"),r})):[]}Qn(){return this.Kn().length>0}initialize(){var i,e,{config:t}=this._instance,r=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(r).length){var s,n,o=(s=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},a=Object.keys(r).filter((u=>!!r[u])).reduce(((u,c)=>(u[c]=r[c]||!1,u)),{}),l=Object.keys(o).filter((u=>a[u])).reduce(((u,c)=>(o[c]&&(u[c]=o[c]),u)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(i,e,t){var r=t!=null&&t.merge?this.getFlagVariants():{},s=t!=null&&t.merge?this.getFlagPayloads():{},n=w({},r,i),o=w({},s,e),a={};for(var[l,u]of Object.entries(n)){var c=typeof u=="string";a[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:I(o==null?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.$n}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.Wn(pr),e=this.Wn(Ve),t=this.Wn(Kt);if(!t&&!e)return i||{};var r=ie({},i||{}),s=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=e==null?void 0:e[n],c=I(u)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!u,h=I(u)?l.variant:typeof u=="string"?u:void 0,d=t==null?void 0:t[n],f=w({},l,{enabled:c,variant:c?h??(l==null?void 0:l.variant):void 0});c!==(l==null?void 0:l.enabled)&&(f.original_enabled=l==null?void 0:l.enabled),h!==(l==null?void 0:l.variant)&&(f.original_variant=l==null?void 0:l.variant),d&&(f.metadata=w({},l==null?void 0:l.metadata,{payload:d,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[n]=f}return this.Zn||(pe.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:r}),this.Zn=!0),r}getFlagVariants(){var i=this.Wn(ht),e=this.Wn(Ve);if(!e)return i||{};for(var t=ie({},i),r=Object.keys(e),s=0;r.length>s;s++)t[r[s]]=e[r[s]];return this.Zn||(pe.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Zn=!0),t}getFlagPayloads(){var i=this.Wn(No),e=this.Wn(Kt);if(!e)return i||{};for(var t=ie({},i||{}),r=Object.keys(e),s=0;r.length>s;s++)t[r[s]]=e[r[s]];return this.Zn||(pe.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Zn=!0),t}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.ts||(this._instance.Sr.emit("featureFlagsReloading",!0),this.ts=setTimeout((()=>{this.es()}),5))}rs(){clearTimeout(this.ts),this.ts=void 0}ensureFlagsLoaded(){this.$n||this.Vn||this.ts||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Hn=i}es(i){var e;if(this.rs(),!this._instance.ki())if(this.Vn)this.zn=!0;else{var t=this.Rt.token,r=this.Wn(hi),s={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:w({},((e=this.Xi)==null?void 0:e.get_initial_props())||{},this.Wn($t)||{}),group_properties:this.Wn(Ke),timezone:Ln()};Fe(r)||I(r)||(s.$device_id=r),(i!=null&&i.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Qn()&&(s.evaluation_contexts=this.Kn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Vn=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Rt.disable_compression?void 0:Ie.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback:o=>{var a,l,u,c=!0;if(o.statusCode===200&&(this.zn||(this.$anon_distinct_id=void 0),c=!1),this.Vn=!1,!s.disable_flags||this.zn){this.Un=!c;var h=[];o.error?o.error instanceof Error?h.push(o.error.name==="AbortError"?"timeout":"connection_error"):h.push("unknown_error"):o.statusCode!==200&&h.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var d,f=!((l=o.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));f&&h.push("quota_limited"),(u=this.Xi)==null||u.register({[_r]:h}),f?pe.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."):(s.disable_flags||this.receivedFeatureFlags((d=o.json)!==null&&d!==void 0?d:{},c,{partialResponse:!!this.Rt.advanced_only_evaluate_survey_feature_flags}),this.zn&&(this.zn=!1,this.es()))}}})}}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var r=this.getFeatureFlagResult(i,e);return(t=r==null?void 0:r.variant)!==null&&t!==void 0?t:r==null?void 0:r.enabled}}else pe.warn('getFeatureFlag for key "'+i+rs)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var t=this.getFlagVariants(),r=i in t,s=t[i],n=this.getFlagPayloads()[i],o=String(s),a=this.Wn(Ho)||void 0,l=this.Wn(pi)||void 0,u=this.Wn(Ft)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Wn(vr);h&&h!==d&&(u={},(c=this.Xi)==null||c.register({[Ft]:u,[vr]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in u)||!u[i].includes(o))){var f,p,g,P,S,F,C,R,E,$;z(u[i])?u[i].push(o):u[i]=[o],(f=this.Xi)==null||f.register({[Ft]:u});var x=this.getFeatureFlagDetails(i),b=[...(p=this.Wn(_r))!==null&&p!==void 0?p:[]];I(s)&&b.push("flag_missing");var y={$feature_flag:i,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((g=this.Rt.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[i])||null,$feature_flag_bootstrapped_payload:((P=this.Rt.bootstrap)==null||(P=P.featureFlagPayloads)==null?void 0:P[i])||null,$used_bootstrap_value:!this.Un};I(x==null||(S=x.metadata)==null?void 0:S.version)||(y.$feature_flag_version=x.metadata.version);var T,D=(F=x==null||(C=x.reason)==null?void 0:C.description)!==null&&F!==void 0?F:x==null||(R=x.reason)==null?void 0:R.code;D&&(y.$feature_flag_reason=D),x!=null&&(E=x.metadata)!=null&&E.id&&(y.$feature_flag_id=x.metadata.id),I(x==null?void 0:x.original_variant)&&I(x==null?void 0:x.original_enabled)||(y.$feature_flag_original_response=I(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&($=x.metadata)!=null&&$.original_payload&&(y.$feature_flag_original_payload=x==null||(T=x.metadata)==null?void 0:T.original_payload),b.length&&(y.$feature_flag_error=b.join(",")),this._instance.capture("$feature_flag_called",y)}if(r){var j=n;if(!I(n))try{j=JSON.parse(n)}catch{}return{key:i,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:j}}}}else pe.warn('getFeatureFlagResult for key "'+i+rs)}getRemoteConfigPayload(i,e){var t=this.Rt.token,r={distinct_id:this._instance.get_distinct_id(),token:t};this.Qn()&&(r.evaluation_contexts=this.Kn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Rt.disable_compression?void 0:Ie.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback(s){var n,o=(n=s.json)==null?void 0:n.featureFlagPayloads;e((o==null?void 0:o[i])||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.Un){if(this.$n||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return I(t)?void 0:!!t}pe.warn('isFeatureEnabled for key "'+i+rs)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.Xi){this.$n=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,u,c,h){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var d=(b=>{var y=b.flags;return y?(b.featureFlags=Object.fromEntries(Object.keys(y).map((T=>{var D;return[T,(D=y[T].variant)!==null&&D!==void 0?D:y[T].enabled]}))),b.featureFlagPayloads=Object.fromEntries(Object.keys(y).filter((T=>y[T].enabled)).filter((T=>{var D;return(D=y[T].metadata)==null?void 0:D.payload})).map((T=>{var D;return[T,(D=y[T].metadata)==null?void 0:D.payload]})))):pe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(o),f=d.flags,p=d.featureFlags,g=d.featureFlagPayloads;if(p){var P=o.requestId,S=o.evaluatedAt;if(z(p)){pe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var F={};if(p)for(var C=0;p.length>C;C++)F[p[C]]=!0;a&&a.register({[ss]:p,[ht]:F})}else{var R=p,E=g,$=f;if(h!=null&&h.partialResponse)R=w({},l,R),E=w({},u,E),$=w({},c,$);else if(o.errorsWhileComputingFlags)if(f){var x=new Set(Object.keys(f).filter((b=>{var y;return!((y=f[b])!=null&&y.failed)})));R=w({},l,Object.fromEntries(Object.entries(R).filter((b=>{var[y]=b;return x.has(y)})))),E=w({},u,Object.fromEntries(Object.entries(E||{}).filter((b=>{var[y]=b;return x.has(y)})))),$=w({},c,Object.fromEntries(Object.entries($||{}).filter((b=>{var[y]=b;return x.has(y)}))))}else R=w({},l,R),E=w({},u,E),$=w({},c,$);a&&a.register(w({[ss]:Object.keys(Vo(R)),[ht]:R||{},[No]:E||{},[pr]:$||{}},P?{[Ho]:P}:{},S?{[pi]:S}:{}))}}})(i,this.Xi,r,s,n,t),e||(this.Gn=!1),this.ns(e)}}override(i,e){e===void 0&&(e=!1),pe.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this.Xi)return pe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.Xi.unregister(Ve),this.Xi.unregister(Kt),this.ns(),Ze.info("All overrides cleared");if(z(i)){var e=Uo(i);return this.Xi.register({[Ve]:e}),this.ns(),Ze.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,r=i;if(this.Zn=!!((t=r.suppressWarning)!==null&&t!==void 0&&t),"flags"in r){if(r.flags===!1)this.Xi.unregister(Ve),Ze.info("Flag overrides cleared");else if(r.flags){if(z(r.flags)){var s=Uo(r.flags);this.Xi.register({[Ve]:s})}else this.Xi.register({[Ve]:r.flags});Ze.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.Xi.unregister(Kt),Ze.info("Payload overrides cleared")):r.payloads&&(this.Xi.register({[Kt]:r.payloads}),Ze.info("Payload overrides set",{payloads:r.payloads}))),void this.ns()}if(i&&typeof i=="object")return this.Xi.register({[Ve]:i}),this.ns(),Ze.info("Flag overrides set",{flags:i});pe.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.$n){var{flags:e,flagVariants:t}=this.ss();i(e,t)}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var r,s=(this.Wn(Ct)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},o={$feature_flag:i,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),t&&(o.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=w({},this.getFlagVariants(),{[i]:e});(r=this.Xi)==null||r.register({[ss]:Object.keys(Vo(a)),[ht]:a}),this.ns()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var r=this.Wn(Ct),s=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(r&&!e)return i(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:n=>{var o,a;if(n.json){var l=n.json.earlyAccessFeatures;return(o=this.Xi)==null||o.unregister(Ct),(a=this.Xi)==null||a.register({[Ct]:l}),i(l)}}})}ss(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,r)=>(t[r]=e[r],t)),{})}}ns(i){var{flags:e,flagVariants:t}=this.ss();this.featureFlagEventHandlers.forEach((r=>r(e,t,{errorsLoading:i})))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Wn($t)||{},r=(i==null?void 0:i.$set)||(i!=null&&i.$set_once?{}:i),s=i==null?void 0:i.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in t||(n[o]=s[o]));this._instance.register({[$t]:w({},t,n,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister($t)}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Wn(Ke)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((r=>{t[r]=w({},t[r],i[r]),delete i[r]})),this._instance.register({[Ke]:w({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.Wn(Ke)||{};this._instance.register({[Ke]:w({},e,{[i]:{}})})}else this._instance.unregister(Ke)}reset(){this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.$anon_distinct_id=void 0,this.rs(),this.Zn=!1}}},$u={sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var i;return!((i=this.os)==null||!i.isStarted)}get status(){var i,e;return this.ls===Gt||this.ls===ji?this.ls:(i=(e=this.os)==null?void 0:e.status)!==null&&i!==void 0?i:this.ls}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.ls=Co,this.us=void 0,this._instance=i,!this._instance.sessionManager)throw He.error("started without valid sessionManager"),new Error(es+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===ke)throw new Error(es+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get hs(){var i,e=!((i=this._instance.get_property(di))==null||!i.enabled),t=!this.Rt.disable_session_recording,r=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return _&&e&&t&&!r}startIfEnabledOrStop(i){var e;if(!this.hs||(e=this.os)==null||!e.isStarted){var t=!I(Object.assign)&&!I(Array.from);this.hs&&t?(this.cs(i),He.info("starting")):(this.ls=Co,this.stopRecording())}}cs(i){var e,t,r;this.hs&&(this.ls!==Gt&&this.ls!==ji&&(this.ls=$o),A!=null&&(e=A.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=A.__PosthogExtensions__)!=null&&t.initSessionRecording?this.ds(i):(r=A.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.vs,(s=>{if(s)return He.error("could not load recorder",s);this.ds(i)})))}stopRecording(){var i,e;(i=this.us)==null||i.call(this),this.us=void 0,(e=this.os)==null||e.stop()}fs(){var i,e;(i=this.us)==null||i.call(this),this.us=void 0,(e=this.os)==null||e.discard()}ps(){var i;(i=this.Xi)==null||i.unregister(vn)}gs(i,e){if(W(i))return null;var t,r=Se(i)?i:parseFloat(i);return typeof(t=r)!="number"||!Number.isFinite(t)||0>t||t>1?(He.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):r}ys(i){if(this.Xi){var e,t,r=this.Xi,s=()=>{var n,o=i.sessionRecording===!1?void 0:i.sessionRecording,a=this.gs((n=this.Rt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.gs(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=a??l;W(u)&&this.ps();var c=o==null?void 0:o.minimumDurationMilliseconds;r.register({[di]:w({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:w({capturePerformance:i.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:u,minimumDurationMilliseconds:I(c)?null:c,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};s(),(e=this.us)==null||e.call(this),this.us=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(s)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.ys(i),void this.fs()):(this.ys(i),void this.startIfEnabledOrStop()):(this.ls===Gt&&(this.ls=ji,He.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.os)!=null&&t.log?this.os.log(i,e):He.warn("log called before recorder was ready")}get vs(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(di);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}bs(){var i,e=this._instance.get_property(di);if(!e)return!1;var t=(i=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-t}ds(i){var e,t;if((e=A.__PosthogExtensions__)==null||!e.initSessionRecording)return He.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.os||(this.os=(t=A.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.os._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.bs())return this.ls===ji||this.ls===Gt?void 0:(this.ls=Gt,He.info("persisted remote config is stale, requesting fresh config before starting"),void new jn(this._instance).load());this.ls=$o,this.os.start(i)}onRRwebEmit(i){var e;(e=this.os)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.os||(e=this.Xi)==null||e.register({$replay_override_linked_flag:!0}),(i=this.os)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.os||(e=this.Xi)==null||e.register({$replay_override_sampling:!0}),(i=this.os)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.os||(t=this.Xi)==null||t.register({[i==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.os)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.os)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.os)==null||!t.tryAddCustomEvent(i,e))}}},Fu={autocapture:class{constructor(i){this.ws=!1,this._s=null,this.Is=!1,this.instance=i,this.rageclicks=new Oo(i.config.rageclick),this.Cs=null}initialize(){this.startIfEnabled()}get Rt(){var i,e,t=ae(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((r=>new RegExp(r))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),t}Ss(){if(this.isBrowserSupported()){if(_&&k){var i=t=>{t=t||(_==null?void 0:_.event);try{this.ks(t)}catch(r){Ro.error("Failed to capture event",r)}};if(ne(k,"submit",i,{capture:!0}),ne(k,"change",i,{capture:!0}),ne(k,"click",i,{capture:!0}),this.Rt.capture_copied_text){var e=t=>{this.ks(t=t||(_==null?void 0:_.event),Zr)};ne(k,"copy",e,{capture:!0}),ne(k,"cut",e,{capture:!0})}}}else Ro.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ws&&(this.Ss(),this.ws=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.Is=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[un]:!!i.autocapture_opt_out}),this._s=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.Cs=i}getElementSelectors(i){var e,t=[];return(e=this.Cs)==null||e.forEach((r=>{var s=k==null?void 0:k.querySelectorAll(r);s==null||s.forEach((n=>{i===n&&t.push(r)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[un];if(Fe(this._s)&&!Oe(t)&&!this.instance.ki())return!1;var r=(e=this._s)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!r}ks(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,r=vo(i);ho(r)&&(r=r.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&(function(h,d){if(!_||Jr(h))return!1;var f,p,g;if(Oe(d)?(f=!!d&&yo,p=void 0):(f=(g=d==null?void 0:d.css_selector_ignorelist)!==null&&g!==void 0?g:yo,p=d==null?void 0:d.content_ignorelist),f===!1)return!1;var{targetElementList:P}=bo(h,!1);return!(function(S,F){if(S===!1||I(S))return!1;var C;if(S===!0)C=gu;else{if(!z(S))return!1;if(S.length>10)return O.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;C=S.map((R=>R.toLowerCase()))}return F.some((R=>{var{safeText:E,ariaLabel:$}=R;return C.some((x=>E.includes(x)||$.includes(x)))}))})(p,P.map((S=>{var F;return{safeText:Wt(S).toLowerCase(),ariaLabel:((F=S.getAttribute("aria-label"))==null?void 0:F.toLowerCase().trim())||""}})))&&!_o(P,f)})(r,this.instance.config.rageclick)&&this.ks(i,"$rageclick");var s=e===Zr;if(r&&(function(h,d,f,p,g){var P,S,F,C;if(f===void 0&&(f=void 0),!_||Jr(h)||(P=f)!=null&&P.url_allowlist&&!po(f.url_allowlist)||(S=f)!=null&&S.url_ignorelist&&po(f.url_ignorelist))return!1;if((F=f)!=null&&F.dom_event_allowlist){var R=f.dom_event_allowlist;if(R&&!R.some((y=>d.type===y)))return!1}var{parentIsUsefulElement:E,targetElementList:$}=bo(h,p);if(!(function(y,T){var D=T==null?void 0:T.element_allowlist;if(I(D))return!0;var j,H=function(v){if(D.some((m=>v.tagName.toLowerCase()===m)))return{v:!0}};for(var U of y)if(j=H(U))return j.v;return!1})($,f)||!_o($,(C=f)==null?void 0:C.css_selector_allowlist))return!1;var x=_.getComputedStyle(h);if(x&&x.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var b=h.tagName.toLowerCase();switch(b){case"html":return!1;case"form":return(g||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(d.type)>=0;default:return E?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Kr.indexOf(b)>-1||h.getAttribute("contenteditable")==="true")}})(r,i,this.Rt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=xu(r,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this.Is});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===Zr){var l,u=go(_==null||(l=_.getSelection())==null?void 0:l.toString()),c=i.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return $e(k==null?void 0:k.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.xs=(_==null||(e=_.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(O.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ts&&this.Ts(),this.Ts=void 0,O.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(_&&_.history){var t=this;(i=_.history.pushState)!=null&&i.__posthog_wrapped__||To(_.history,"pushState",(r=>function(s,n,o){r.call(this,s,n,o),t.As("pushState")})),(e=_.history.replaceState)!=null&&e.__posthog_wrapped__||To(_.history,"replaceState",(r=>function(s,n,o){r.call(this,s,n,o),t.As("replaceState")})),this.Es()}}As(i){try{var e,t=_==null||(e=_.location)==null?void 0:e.pathname;if(!t)return;t!==this.xs&&this.isEnabled&&this._instance.capture(pt,{navigation_type:i}),this.xs=t}catch(r){O.error("Error capturing "+i+" pageview",r)}}Es(){if(!this.Ts){var i=()=>{this.As("popstate")};ne(_,"popstate",i),this.Ts=()=>{_&&_.removeEventListener("popstate",i)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(i){var e;this.Rs=!1,this.ws=!1,this.Ns=null,this.instance=i,this.Rs=!((e=this.instance.persistence)==null||!e.props[dr]),this.rageclicks=new Oo(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return ae(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(i=this.Rt.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return W(this.Rt.capture_heatmaps)?W(this.Rt.enable_heatmaps)?this.Rs:this.Rt.enable_heatmaps:this.Rt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ws)return;Eu.info("starting..."),this.Ms(),this.Tt()}else{var i;clearInterval((i=this.Ns)!==null&&i!==void 0?i:void 0),this.Fs(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[dr]:e}),this.Rs=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.T;return this.T=void 0,i}Os(i){this.wt(i.originalEvent,"deadclick")}Tt(){this.Ns&&clearInterval(this.Ns),this.Ns=(k==null?void 0:k.visibilityState)==="visible"?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Ms(){_&&k&&(this.Ps=this.ji.bind(this),ne(_,yi,this.Ps),this.Ls=i=>this.wt(i||(_==null?void 0:_.event)),ne(k,"click",this.Ls,{capture:!0}),this.Ds=i=>this.Bs(i||(_==null?void 0:_.event)),ne(k,"mousemove",this.Ds,{capture:!0}),this.js=new Sn(this.instance,Dl,this.Os.bind(this)),this.js.startIfEnabledOrStop(),this.qs=this.Tt.bind(this),ne(k,mi,this.qs),this.ws=!0)}Fs(){var i;_&&k&&(this.Ps&&_.removeEventListener(yi,this.Ps),this.Ls&&k.removeEventListener("click",this.Ls,{capture:!0}),this.Ds&&k.removeEventListener("mousemove",this.Ds,{capture:!0}),this.qs&&k.removeEventListener(mi,this.qs),clearTimeout(this.Zs),(i=this.js)==null||i.stop(),this.ws=!1)}$s(i,e){var t=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){for(var u=o;u&&Ai(u)&&!De(u,"body");){if(u===l)return!1;if(B(a,_==null?void 0:_.getComputedStyle(u).position))return!0;u=mo(u)}return!1})(vo(i),["fixed","sticky"],s);return{x:i.clientX+(n?0:r),y:i.clientY+(n?0:t),target_fixed:n,type:e}}wt(i,e){var t;if(e===void 0&&(e="click"),!co(i.target)&&Fo(i)){var r=this.$s(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&this.Vs(w({},r,{type:"rageclick"})),this.Vs(r)}}Bs(i){!co(i.target)&&Fo(i)&&(clearTimeout(this.Zs),this.Zs=setTimeout((()=>{this.Vs(this.$s(i,"mousemove"))}),500))}Vs(i){if(_){var e=_.location.href,t=this.Rt.custom_personal_data_properties,r=this.Rt.mask_personal_data_properties?[...gt,...t||[]]:[],s=At(e,r,Mt);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(i)}}ji(){this.T&&!st(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Sn,webVitalsAutocapture:class{constructor(i){var e;this.Rs=!1,this.ws=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.zs),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,r)=>w({},t,{["$web_vitals_"+r.name+"_event"]:w({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(I(s))Ne.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Us();I(n)||(W(t==null?void 0:t.name)||W(t==null?void 0:t.value)?Ne.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==n&&(this.Hs(),this.zs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),I(this.T.url)&&(this.T.url=n),this.T.firstMetricTimestamp=I(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(w({},t,{$current_url:n,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Ne.error("Ignoring metric with value >= "+this.Ys,t))}},this.Gs=()=>{if(!this.ws){var t,r,s,n,o=A.__PosthogExtensions__;I(o)||I(o.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:r,onFCP:s,onINP:n}=o.postHogWebVitalsCallbacks),t&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.nt.bind(this)),this.ws=!0):Ne.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Rs=!((e=this._instance.persistence)==null||!e.props[dn]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=ae(this.Ws)?(i=this.Ws)==null?void 0:i.web_vitals_allowed_metrics:void 0;return W(t)?((e=this._instance.persistence)==null?void 0:e.props[gn])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(ae(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=ae(this.Ws)?this.Ws.web_vitals_attribution:void 0;return i!=null&&i}get Ys(){var i=ae(this.Ws)&&Se(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Io;return i>0&&6e4>=i?Io:i}get isEnabled(){var i=le==null?void 0:le.protocol;if(i!=="http:"&&i!=="https:")return Ne.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=ae(this.Ws)?this.Ws.web_vitals:Oe(this.Ws)?this.Ws:void 0;return Oe(e)?e:this.Rs}startIfEnabled(){this.isEnabled&&!this.ws&&(Ne.info("enabled, starting..."),this.ni(this.Gs))}onRemoteConfig(i){if("capturePerformance"in i){var e=ae(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=ae(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[dn]:e}),this._instance.persistence.register({[gn]:t})),this.Rs=e,this.startIfEnabled()}}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?Ne.error("failed to load script",r):i()}))}Us(){var i=_?_.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...gt,...e||[]]:[];return At(i,t,Mt)}Ne.error("Could not determine current URL")}}},Lu={exceptionObserver:class{constructor(i){var e,t,r;this.Gs=()=>{var s;if(_&&this.isEnabled&&(s=A.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=A.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=A.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=A.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Xs&&this.Rt.capture_unhandled_errors&&(this.Xs=n(this.captureException.bind(this))),!this.Js&&this.Rt.capture_unhandled_rejections&&(this.Js=o(this.captureException.bind(this))),!this.Ks&&this.Rt.capture_console_errors&&(this.Ks=a(this.captureException.bind(this)))}catch(l){Xt.error("failed to start",l),this.Qs()}}},this._instance=i,this.eo=!((e=this._instance.persistence)==null||!e.props[cn]),this.io=new Ja({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,qt:Xt}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ae(i)?e=w({},e,i):(I(i)?this.eo:i)&&(e=w({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Xt.info("enabled"),this.Qs(),this.ni(this.Gs)):this.Qs()}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return Xt.error("failed to load script",r);i()}))}Qs(){var i,e,t;(i=this.Xs)==null||i.call(this),this.Xs=void 0,(e=this.Js)==null||e.call(this),this.Js=void 0,(t=this.Ks)==null||t.call(this),this.Ks=void 0}onRemoteConfig(i){"autocaptureExceptions"in i&&(this.eo=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[cn]:this.eo}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(i){var e,t,r,s=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.io.consumeRateLimit(s)?Xt.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.no=[],this.so=new ll([new vl,new kl,new ml,new _l,new Sl,new xl,new bl,new El],(function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),o=1;s>o;o++)n[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var u=[],c=a.split(` -`),h=l;c.length>h;h++){var d=c[h];if(1024>=d.length){var f=nn.test(d)?d.replace(nn,"$1"):d;if(!f.match(/\S*Error: /)){for(var p of n){var g=p(f,r);if(g){u.push(g);break}}if(u.length>=50)break}}}return(function(P){if(!P.length)return[];var S=Array.from(P);return S.reverse(),S.slice(0,50).map((F=>{return w({},F,{filename:F.filename||(C=S,C[C.length-1]||{}).filename,function:F.function||ct});var C}))})(u)}})("web:javascript",dl,gl)),this._instance=i,this.no=(e=(t=this._instance.persistence)==null?void 0:t.get_property(fr))!==null&&e!==void 0?e:[]}onRemoteConfig(i){var e,t,r;if("errorTracking"in i){var s=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.no=s,this._instance.persistence&&this._instance.persistence.register({[fr]:this.no,[hn]:n})}}get oo(){var i,e=!!this._instance.get_property(hn),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.so.buildFromUnknown(i,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}sendExceptionEvent(i){var e=i.$exception_list;if(this.ao(e)){if(this.lo(e))return void ns.info("Skipping exception capture because a suppression rule matched");if(!this.oo&&this.uo(e))return void ns.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ho(e))return void ns.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}lo(i){if(i.length===0)return!1;var e=i.reduce(((t,r)=>{var{type:s,value:n}=r;return se(s)&&s.length>0&&t.$exception_types.push(s),se(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.no.some((t=>{var r=t.values.map((s=>{var n,o=eo[s.operator],a=z(s.value)?s.value:[s.value],l=(n=e[s.key])!==null&&n!==void 0?n:[];return a.length>0&&o(a,l)}));return t.type==="OR"?r.some(Boolean):r.every(Boolean)}))}uo(i){return i.flatMap((e=>{var t,r;return(t=(r=e.stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ho(i){if(i.length>0){var e,t,r,s,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ao(i){return!W(i)&&z(i)}}},Au=w({productTours:class{get Xi(){return this._instance.persistence}constructor(i){this.co=null,this.do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this.Xi&&this.Xi.register({[pn]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.co||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(pn)||this.ni((()=>this.vo()))}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(r=>{r?Lo.error("Could not load product tours script",r):i()}))}vo(){var i;!this.co&&(i=A.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.co=A.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!z(this.do)||e){var t=this.Xi;if(t){var r=t.props[ts];if(z(r)&&!e)return this.do=r,void i(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var n=s.statusCode;if(n!==200||!s.json){var o="Product Tours API could not be loaded, status: "+n;return Lo.error(o),void i([],{isLoaded:!1,error:o})}var a=z(s.json.product_tours)?s.json.product_tours:[];this.do=a,t&&t.register({[ts]:a}),i(a,{isLoaded:!0})}})}else i(this.do,{isLoaded:!0})}getActiveProductTours(i){W(this.co)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.co.getActiveProductTours(i)}showProductTour(i){var e;(e=this.co)==null||e.showTourById(i)}previewTour(i){this.co?this.co.previewTour(i):this.ni((()=>{var e;this.vo(),(e=this.co)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.co)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.co)==null||i.nextStep()}previousStep(){var i;(i=this.co)==null||i.previousStep()}clearCache(){var i;this.do=null,(i=this.Xi)==null||i.unregister(ts)}resetTour(i){var e;(e=this.co)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.co)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.co)==null||e.cancelPendingTour(i)}}},Di),Mu={siteApps:class{constructor(i){this._instance=i,this.fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}po(i,e){if(e){var t=this.globalsForEvent(e);this.fo.push(t),this.fo.length>1e3&&(this.fo=this.fo.slice(10))}}get siteAppLoaders(){var i;return(i=A._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.po.bind(this));this.mo=()=>{i(),this.fo=[],this.mo=void 0}}}globalsForEvent(i){var e,t,r,s,n,o,a;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:f,$set:p}=i;return{event:w({},Cs(i,ku),{properties:w({},i.properties,p?{$set:w({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:w({},(r=(s=i.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.fo.length&&(Ue.info("Processing "+this.fo.length+" events for site app with id "+i.id),this.fo.forEach((a=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this.mo)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,Ue.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),r&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback(o){s(o)}});n&&(e.processEvent=n),r=!0}catch(o){Ue.error(Ao+i.id,o),s(!1)}if(r&&e.loaded)try{t()}catch(o){Ue.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}yo(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}bo(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(r){Ue.error("Error while processing event "+i.event+" for site app "+t.id,r)}}}onRemoteConfig(i){var e,t,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.yo(),void this._instance.on("eventCaptured",(l=>this.bo(l)))):void Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.mo)==null||t.call(this),(r=i.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var u;A["__$$ph_site_app_"+l]=s._instance,(u=A.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,a,(c=>{if(c)return Ue.error(Ao+l,c)}))};for(var{id:o,url:a}of i.siteApps)n(o)}else Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ju={tracingHeaders:class{constructor(i){this.wo=void 0,this._o=void 0,this.Gs=()=>{var e,t;I(this.wo)&&((e=A.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),I(this._o)&&((t=A.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=i}initialize(){this.startIfEnabledOrStop()}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&i(),(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return Su.error("failed to load script",r);i()}))}startIfEnabledOrStop(){var i,e;this._instance.config.__add_tracing_headers?this.ni(this.Gs):((i=this.wo)==null||i.call(this),(e=this._o)==null||e.call(this),this.wo=void 0,this._o=void 0)}}},Du=w({surveys:class{get Rt(){return this._instance.config}constructor(i){this.Io=void 0,this._surveyManager=null,this.Co=!1,this.So=[],this.ko=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Rt.disable_surveys){var e=i.surveys;if(W(e))return K.warn("Flags not loaded yet. Not loading surveys.");var t=z(e);this.Io=t?e.length>0:e,K.info("flags response received, isSurveysEnabled: "+this.Io),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;elocalStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.Co)K.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)K.info(Mo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())K.info("Not loading surveys in cookieless mode without consent.");else{var i=A==null?void 0:A.__PosthogExtensions__;if(i){if(!I(this.Io)||this.Rt.advanced_enable_surveys){var e=this.Io||this.Rt.advanced_enable_surveys;this.Co=!0;try{var t=i.generateSurveys;if(t)return void this.xo(t,e);var r=i.loadExternalDependency;if(!r)return void this.To(xr);r(this._instance,"surveys",(s=>{s||!i.generateSurveys?this.To("Could not load surveys script",s):this.xo(i.generateSurveys,e)}))}catch(s){throw this.To("Error initializing surveys",s),s}finally{this.Co=!1}}}else K.error("PostHog Extensions not found.")}}xo(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Ru(this._instance),K.info("Surveys loaded successfully"),this.Ao({isLoaded:!0})}To(i,e){K.error(i,e),this.Ao({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.So.push(i),this._surveyManager&&this.Ao({isLoaded:!0}),()=>{this.So=this.So.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Rt.disable_surveys)return K.info(Mo),i([]);var t,r=this._instance.get_property(gr);if(r&&!e)return i(r,{isLoaded:!0});typeof Promise<"u"&&this.ko?this.ko.then((s=>{var{surveys:n,context:o}=s;return i(n,o)})):(typeof Promise<"u"&&(this.ko=new Promise((s=>{t=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:s=>{var n;this.ko=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;K.error(a);var l={isLoaded:!1,error:a};return i([],l),void(t==null||t({surveys:[],context:l}))}var u,c=s.json.surveys||[],h=c.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&((function(p){var g;return!((g=p.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(f)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(f))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[gr]:c});var d={isLoaded:!0};i(c,d),t==null||t({surveys:c,context:d})}}))}Ao(i){for(var e of this.So)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){K.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!W(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);K.warn("init was not called")}Eo(i){var e=null;return this.getSurveys((t=>{var r;e=(r=t.find((s=>s.id===i)))!==null&&r!==void 0?r:null})),e}Ro(i){if(W(this._surveyManager))return{eligible:!1,reason:is};var e=typeof i=="string"?this.Eo(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(W(this._surveyManager))return K.warn("init was not called"),{visible:!1,disabledReason:is};var e=this.Ro(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return W(this._surveyManager)?(K.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:is})):new Promise((t=>{this.getSurveys((r=>{var s,n=(s=r.find((a=>a.id===i)))!==null&&s!==void 0?s:null;if(n){var o=this.Ro(n);t({visible:o.eligible,disabledReason:o.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var r;if(W(this._surveyManager))K.warn("init was not called");else{var s=typeof i=="string"?this.Eo(i):i;if(s!=null&&s.id)if(au.includes(s.type)){var n=k==null?void 0:k.querySelector(e);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(K.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;K.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,n,t),K.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,t);K.warn("Survey element not found")}else K.warn("Surveys of type "+s.type+" cannot be rendered in the app");else K.warn("Survey not found")}}displaySurvey(i,e){var t;if(W(this._surveyManager))K.warn("init was not called");else{var r=this.Eo(i);if(r){var s=r;if((t=r.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=w({},r,{appearance:w({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==$r.Popover&&e.initialResponses&&K.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(r);if(!n.visible)return void K.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==$r.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else K.warn("Survey not found")}}cancelPendingSurvey(i){W(this._surveyManager)?K.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},Di),Nu={toolbar:class{constructor(i){this.instance=i}No(i){A.ph_toolbar_state=i}Mo(){var i;return(i=A.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),bn(this.instance.config)||!_||!k)return!1;i=i??_.location,t=t??_.history;try{if(!e){try{_.localStorage.setItem("test","test"),_.localStorage.removeItem("test")}catch{return!1}e=_==null?void 0:_.localStorage}var r,s=Tu||Oi(i.hash,"__posthog")||Oi(i.hash,"state"),n=s?yn((()=>JSON.parse(atob(decodeURIComponent(s)))))||yn((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((r=JSON.parse(e.getItem(jo)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Fo(i){var e=A.ph_load_toolbar||A.ph_load_editor;!W(e)&&$e(e)?e(i,this.instance):Do.warn("No toolbar load function found")}loadToolbar(i){var e=!(k==null||!k.getElementById(_n));if(!_||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=w({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(_.localStorage.setItem(jo,JSON.stringify(w({},r,{source:void 0}))),this.Mo()===2)this.Fo(r);else if(this.Mo()===0){var s;this.No(1),(s=A.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Do.error("[Toolbar] Failed to load",n),void this.No(0);this.No(2),this.Fo(r)})),ne(_,"turbolinks:load",(()=>{this.No(0),this.loadToolbar(r)}))}return!0}Oo(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Hu=w({experiments:ce},Di),Uu={conversations:class{constructor(i){this.Po=void 0,this._conversationsManager=null,this.Lo=!1,this.Do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;W(e)||(Oe(e)?this.Po=e:(this.Po=e.enabled,this.Do=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Po=void 0,this.Do=null}loadIfEnabled(){if(!(this._conversationsManager||this.Lo||this._instance.config.disable_conversations||bn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=A==null?void 0:A.__PosthogExtensions__;if(i&&!I(this.Po)&&this.Po)if(this.Do&&this.Do.token){this.Lo=!0;try{var e=i.initConversations;if(e)return this.Bo(e),void(this.Lo=!1);var t=i.loadExternalDependency;if(!t)return void this.jo(xr);t(this._instance,"conversations",(r=>{r||!i.initConversations?this.jo("Could not load conversations script",r):this.Bo(i.initConversations),this.Lo=!1}))}catch(r){this.jo("Error initializing conversations",r),this.Lo=!1}}else we.error("Conversations enabled but missing token in remote config.")}}Bo(i){if(this.Do)try{this._conversationsManager=i(this.Do,this._instance),we.info("Conversations loaded successfully")}catch(e){this.jo("Error completing conversations initialization",e)}else we.error("Cannot complete initialization: remote config is null")}jo(i,e){we.error(i,e),this._conversationsManager=null,this.Lo=!1}show(){this._conversationsManager?this._conversationsManager.show():we.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Po===!0&&!Fe(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var r=this;return xe((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(i,e,t):(we.warn(Qe),null)}))()}getMessages(i,e){var t=this;return xe((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(we.warn(Qe),null)}))()}markAsRead(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(we.warn(Qe),null)}))()}getTickets(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(we.warn(Qe),null)}))()}requestRestoreLink(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(we.warn(Qe),null)}))()}restoreFromToken(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(we.warn(Qe),null)}))()}restoreFromUrlToken(){var i=this;return xe((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(we.warn(Qe),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}Kr(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Qr(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Vu={logs:class{constructor(i){var e;this.qo=!1,this.Zo=!1,this.qt=Z("[logs]"),this.$o=[],this.Vo=0,this.Ho=0,this.zo=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.qo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!W(t)&&t&&(this.qo=!0,this.loadIfEnabled())}reset(){this.$o=[],this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Vo=0,this.Ho=0,this.zo=!1}loadIfEnabled(){if(this.qo&&!this.Zo){var i=A==null?void 0:A.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var r;t||(r=i.logs)==null||!r.initializeLogs?this.qt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.Zo=!0)})):this.qt.error(xr)}else this.qt.error("PostHog Extensions not found.")}}captureLog(i){var e,t,r,s,n,o;if(this._instance.is_capturing())if(i&&i.body){var a=(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3,l=(r=(s=this._instance.config.logs)==null?void 0:s.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,u=Date.now();if(a>u-this.Ho||(this.Ho=u,this.Vo=0,this.zo=!1),l>this.Vo){this.Vo++;var c=(function(h,d){var f=h.level||"info",{text:p,number:g}=Bo[f]||Cu,P=String(Date.now())+"000000",S={};d.distinctId&&(S.posthogDistinctId=d.distinctId),d.sessionId&&(S.sessionId=d.sessionId),d.currentUrl&&(S["url.full"]=d.currentUrl),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(S.feature_flags=d.activeFeatureFlags);var F=w({},S,h.attributes||{}),C={timeUnixNano:P,observedTimeUnixNano:P,severityNumber:g,severityText:p,body:{stringValue:h.body},attributes:zo(F)};return h.trace_id&&(C.traceId=h.trace_id),h.span_id&&(C.spanId=h.span_id),I(h.trace_flags)||(C.flags=h.trace_flags),C})(i,this.Uo());this.$o.push({record:c}),((n=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&n!==void 0?n:100)>this.$o.length?this.Yo():this.flushLogs()}else this.zo||(this.qt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.zo=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.Go||(this.Go={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Go}flushLogs(i){if(this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.$o.length!==0){var e=this.$o;this.$o=[];var t=this._instance.config.logs,r=w({"service.name":(t==null?void 0:t.serviceName)||"unknown_service"},(t==null?void 0:t.environment)&&{"deployment.environment":t.environment},(t==null?void 0:t.serviceVersion)&&{"service.version":t.serviceVersion},t==null?void 0:t.resourceAttributes),s=(function(o,a){return{resourceLogs:[{resource:{attributes:zo(a)},scopeLogs:[{scope:{name:de.LIB_NAME},logRecords:o}]}]}})(e.map((o=>o.record)),r),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Pr({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:i})}}Yo(){var i,e;this.Ni||(this.Ni=setTimeout((()=>{this.Ni=void 0,this.flushLogs()}),(i=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3))}Uo(){var i,e={lib:de.LIB_NAME};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t}if(A!=null&&(i=A.location)!=null&&i.href&&(e.currentUrl=A.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},qu=w({},Di,$u,Fu,Lu,Au,Mu,Du,ju,Nu,Hu,Uu,Vu);be.__defaultExtensionClasses=w({},qu);var Xo,qe=(Xo=qt[bt]=new be,(function(){function i(){i.done||(i.done=!0,ao=!1,J(qt,(function(e){e._dom_loaded()})))}k!=null&&k.addEventListener?k.readyState==="complete"?i():ne(k,"DOMContentLoaded",i,{capture:!1}):_&&O.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Xo);function Go(i){return Array.isArray(i)&&i.every(e=>typeof e=="string")}function Bu(i){if(!i||typeof i!="object")return!1;const e=i;return typeof e.wc_version=="string"&&typeof e.php_version=="string"&&typeof e.site_uuid=="string"&&typeof e.user_uuid=="string"&&typeof e.user_role=="string"&&typeof e.wc_currency=="string"&&typeof e.wc_country=="string"&&typeof e.days_since_install=="number"&&typeof e.product_count=="number"&&typeof e.order_count=="number"&&typeof e.pos_user_count=="number"&&Go(e.active_gateways)&&Go(e.active_extensions)}function Wu(i){return!i||typeof i!="object"?!1:typeof i.profile_url=="string"}function zu(i){if(!i||typeof i!="object")return!1;const e=i;return typeof e.schema_version=="number"&&typeof e.locale=="string"&&typeof e.plugin_version=="string"&&typeof e.pro_active=="boolean"}function et(){var r;const i=(r=window.wcpos)==null?void 0:r.landing;if(!zu(i))return;const e={schema_version:i.schema_version,locale:i.locale,plugin_version:i.plugin_version,pro_active:i.pro_active},t=i;return typeof t.anon_id=="string"&&(e.anon_id=t.anon_id),Bu(t.profile)&&(e.profile=t.profile),Wu(t.updates_server)&&(e.updates_server=t.updates_server),e}const Xu=new Date("2011-12-01"),Gu=new Date("2014-05-11"),Ku="$129",Ju="$399",Yu="6,000+",Zu="https://demo.wcpos.com/pos",Qu="https://github.com/orgs/wcpos/projects/4/views/1",ec="https://wordpress.org/support/plugin/woocommerce-pos/reviews/#new-post",tc="https://wcpos.com/pro",os="https://cdn.jsdelivr.net/gh/wcpos/wp-admin-landing@v2/assets",Jt=2,Yt=1;function ic(i,e=new Date){let t=e.getFullYear()-i.getFullYear();const r=new Date(i);return r.setFullYear(i.getFullYear()+t),e(s!=null&&s.properties&&(delete s.properties.$current_url,delete s.properties.$host,delete s.properties.$pathname,delete s.properties.$referrer,delete s.properties.$referring_domain),s)});const r=oc();return qe.register({plugin_version:(i==null?void 0:i.plugin_version)??"unknown",pro_active:(i==null?void 0:i.pro_active)??!1,locale:(i==null?void 0:i.locale)??"en_US",has_profile:!!(i!=null&&i.profile),has_anon_id:!!e,analytics_schema_version:Jt,...r}),t||(qe.capture("$pageview"),hc((i==null?void 0:i.pro_active)??!1)),qe}function cc(){const i=et(),e=i==null?void 0:i.profile;!i||!(e!=null&&e.site_uuid)||qe.identify(e.site_uuid,{locale:i.locale,plugin_version:i.plugin_version,pro_active:i.pro_active,wc_version:e.wc_version,days_since_install:e.days_since_install,product_count:e.product_count,order_count:e.order_count,pos_user_count:e.pos_user_count,wc_currency:e.wc_currency,wc_country:e.wc_country,user_role:e.user_role})}function hc(i){try{i&&!window.localStorage.getItem(Yo)&&(qe.capture("pro_activated_observed"),window.localStorage.setItem(Yo,"1"))}catch{}}function ls(i,e){qe.capture(i,e)}function dc(i,e){const t=et(),r=new URL(i);return r.searchParams.set("ref","wp-admin"),r.searchParams.set("utm_source","wp-admin-landing"),r.searchParams.set("utm_medium","landing"),r.searchParams.set("utm_campaign",`landing-${e}`),r.searchParams.set("utm_content",e),r.searchParams.set("lv",e),r.searchParams.set("aid",qe.get_distinct_id()),r.searchParams.set("pv",(t==null?void 0:t.plugin_version)??"unknown"),r.toString()}const V=i=>typeof i=="string",Zt=()=>{let i,e;const t=new Promise((r,s)=>{i=r,e=s});return t.resolve=i,t.reject=e,t},Zo=i=>i==null?"":String(i),fc=(i,e,t)=>{i.forEach(r=>{e[r]&&(t[r]=e[r])})},pc=/###/g,Qo=i=>i&&i.includes("###")?i.replace(pc,"."):i,ea=i=>!i||V(i),Qt=(i,e,t)=>{const r=V(e)?e.split("."):e;let s=0;for(;s{const{obj:r,k:s}=Qt(i,e,Object);if(r!==void 0||e.length===1){r[s]=t;return}let n=e[e.length-1],o=e.slice(0,e.length-1),a=Qt(i,o,Object);for(;a.obj===void 0&&o.length;)n=`${o[o.length-1]}.${n}`,o=o.slice(0,o.length-1),a=Qt(i,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${n}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${n}`]=t},gc=(i,e,t,r)=>{const{obj:s,k:n}=Qt(i,e,Object);s[n]=s[n]||[],s[n].push(t)},Ni=(i,e)=>{const{obj:t,k:r}=Qt(i,e);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},vc=(i,e,t)=>{const r=Ni(i,t);return r!==void 0?r:Ni(e,t)},ia=(i,e,t)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in i?V(i[r])||i[r]instanceof String||V(e[r])||e[r]instanceof String?t&&(i[r]=e[r]):ia(i[r],e[r],t):i[r]=e[r]);return i},tt=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),_c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},mc=i=>V(i)?i.replace(/[&<>"'\/]/g,e=>_c[e]):i;class yc{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const bc=[" ",",","?","!",";"],wc=new yc(20),xc=(i,e,t)=>{e=e||"",t=t||"";const r=bc.filter(o=>!e.includes(o)&&!t.includes(o));if(r.length===0)return!0;const s=wc.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let n=!s.test(i);if(!n){const o=i.indexOf(t);o>0&&!s.test(i.substring(0,o))&&(n=!0)}return n},us=(i,e,t=".")=>{if(!i)return;if(i[e])return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;const r=e.split(t);let s=i;for(let n=0;ni==null?void 0:i.replace(/_/g,"-"),Sc={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){var t,r;(r=(t=console==null?void 0:console[i])==null?void 0:t.apply)==null||r.call(t,console,e)}};class Hi{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Sc,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,s){return s&&!this.debug?null:(V(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Hi(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Hi(this.logger,e)}}var Ce=new Hi;class Ui{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(t)||0;this.observers[r].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,n])=>{for(let o=0;o{for(let o=0;o-1&&this.options.ns.splice(t,1)}getResource(e,t,r,s={}){var u,c;const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.includes(".")?a=e.split("."):(a=[e,t],r&&(Array.isArray(r)?a.push(...r):V(r)&&n?a.push(...r.split(n)):a.push(r)));const l=Ni(this.data,a);return!l&&!t&&!r&&e.includes(".")&&(e=a[0],t=a[1],r=a.slice(2).join(".")),l||!o||!V(r)?l:us((c=(u=this.data)==null?void 0:u[e])==null?void 0:c[t],r,n)}addResource(e,t,r,s,n={silent:!1}){const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.includes(".")&&(a=e.split("."),s=t,t=a[1]),this.addNamespaces(t),ta(this.data,a,s),n.silent||this.emit("added",e,t,r,s)}addResources(e,t,r,s={silent:!1}){for(const n in r)(V(r[n])||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});s.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,s,n,o={silent:!1,skipCopy:!1}){let a=[e,t];e.includes(".")&&(a=e.split("."),s=r,r=t,t=a[1]),this.addNamespaces(t);let l=Ni(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?ia(l,r,n):l={...l,...r},ta(this.data,a,l),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var sa={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,r,s){return i.forEach(n=>{var o;e=((o=this.processors[n])==null?void 0:o.process(e,t,r,s))??e}),e}};const na=Symbol("i18next/PATH_KEY");function Ec(){const i=[],e=Object.create(null);let t;return e.get=(r,s)=>{var n;return(n=t==null?void 0:t.revoke)==null||n.call(t),s===na?i:(i.push(s),t=Proxy.revocable(r,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function xt(i,e){const{[na]:t}=i(Ec()),r=(e==null?void 0:e.keySeparator)??".",s=(e==null?void 0:e.nsSeparator)??":";if(t.length>1&&s){const n=e==null?void 0:e.ns,o=Array.isArray(n)?n:null;if(o&&o.length>1&&o.slice(1).includes(t[0]))return`${t[0]}${s}${t.slice(1).join(r)}`}return t.join(r)}const cs=i=>!V(i)&&typeof i!="boolean"&&typeof i!="number";class Vi extends Ui{constructor(e,t={}){super(),fc(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ce.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r={...t};if(e==null)return!1;const s=this.resolve(e,r);if((s==null?void 0:s.res)===void 0)return!1;const n=cs(s.res);return!(r.returnObjects===!1&&n)}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const o=r&&e.includes(r),a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!xc(e,r,s);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:V(n)?[n]:n};const u=e.split(r);(r!==s||r===s&&this.options.ns.includes(u[0]))&&(n=u.shift()),e=u.join(s)}return{key:e,namespaces:V(n)?[n]:n}}translate(e,t,r){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=xt(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(H=>typeof H=="function"?xt(H,{...this.options,...s}):String(H));const n=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let c=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;c===void 0&&(c=":");const h=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return d?n?{res:`${u}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${c}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:a;const f=this.resolve(e,s);let p=f==null?void 0:f.res;const g=(f==null?void 0:f.usedKey)||a,P=(f==null?void 0:f.exactUsedKey)||a,S=["[object Number]","[object Function]","[object RegExp]"],F=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject,R=s.count!==void 0&&!V(s.count),E=Vi.hasDefaultValue(s),$=R?this.pluralResolver.getSuffix(h,s.count,s):"",x=s.ordinal&&R?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",b=R&&!s.ordinal&&s.count===0,y=b&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${$}`]||s[`defaultValue${x}`]||s.defaultValue;let T=p;C&&!p&&E&&(T=y);const D=cs(T),j=Object.prototype.toString.apply(T);if(C&&T&&D&&!S.includes(j)&&!(V(F)&&Array.isArray(T))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const H=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,T,{...s,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(f.res=H,f.usedParams=this.getUsedParamsDetails(s),f):H}if(o){const H=Array.isArray(T),U=H?[]:{},v=H?P:g;for(const m in T)if(Object.prototype.hasOwnProperty.call(T,m)){const L=`${v}${o}${m}`;E&&!p?U[m]=this.translate(L,{...s,defaultValue:cs(y)?y[m]:void 0,joinArrays:!1,ns:l}):U[m]=this.translate(L,{...s,joinArrays:!1,ns:l}),U[m]===L&&(U[m]=T[m])}p=U}}else if(C&&V(F)&&Array.isArray(p))p=p.join(F),p&&(p=this.extendTranslation(p,e,s,r));else{let H=!1,U=!1;!this.isValidLookup(p)&&E&&(H=!0,p=y),this.isValidLookup(p)||(U=!0,p=a);const m=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:p,L=E&&y!==p&&this.options.updateMissing;if(U||H||L){if(this.logger.log(L?"updateKey":"missingKey",h,u,a,L?y:p),o){const G=this.resolve(a,{...s,keySeparator:!1});G&&G.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let M=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let G=0;G{var te;const X=E&&ee!==p?ee:m;this.options.missingKeyHandler?this.options.missingKeyHandler(G,u,re,X,L,s):(te=this.backendConnector)!=null&&te.saveMissing&&this.backendConnector.saveMissing(G,u,re,X,L,s),this.emit("missingKey",G,u,re,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?M.forEach(G=>{const re=this.pluralResolver.getSuffixes(G,s);b&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!re.includes(`${this.options.pluralSeparator}zero`)&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ee=>{N([G],a+ee,s[`defaultValue${ee}`]||y)})}):N(M,a,y))}p=this.extendTranslation(p,e,s,f,r),U&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${u}${c}${a}`),(U||H)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${c}${a}`:a,H?p:void 0,s))}return n?(f.res=p,f.usedParams=this.getUsedParamsDetails(s),f):p}extendTranslation(e,t,r,s,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=V(e)&&(((u=r==null?void 0:r.interpolation)==null?void 0:u.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(c){const f=e.match(this.interpolator.nestingRegexp);h=f&&f.length}let d=r.replace&&!V(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language||s.usedLng,r),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;h(n==null?void 0:n[0])===f[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`),null):this.translate(...f,t),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,a=V(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&r.applyPostProcessor!==!1&&(e=sa.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,s,n,o,a;return V(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?xt(l,{...this.options,...t}):l)),e.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,t),c=u.key;s=c;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const d=t.count!==void 0&&!V(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(V(t.context)||typeof t.context=="number")&&t.context!=="",g=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(P=>{var S,F;this.isValidLookup(r)||(a=P,!this.checkedLoadedFor[`${g[0]}-${P}`]&&((S=this.utils)!=null&&S.hasLoadedNamespace)&&!((F=this.utils)!=null&&F.hasLoadedNamespace(a))&&(this.checkedLoadedFor[`${g[0]}-${P}`]=!0,this.logger.warn(`key "${s}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(C=>{var $;if(this.isValidLookup(r))return;o=C;const R=[c];if(($=this.i18nFormat)!=null&&$.addLookupKeys)this.i18nFormat.addLookupKeys(R,c,C,P,t);else{let x;d&&(x=this.pluralResolver.getSuffix(C,t.count,t));const b=`${this.options.pluralSeparator}zero`,y=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&x.startsWith(y)&&R.push(c+x.replace(y,this.options.pluralSeparator)),R.push(c+x),f&&R.push(c+b)),p){const T=`${c}${this.options.contextSeparator||"_"}${t.context}`;R.push(T),d&&(t.ordinal&&x.startsWith(y)&&R.push(T+x.replace(y,this.options.pluralSeparator)),R.push(T+x),f&&R.push(T+b))}}let E;for(;E=R.pop();)this.isValidLookup(r)||(n=E,r=this.getResource(C,P,E,t))}))})}),{res:r,usedKey:s,exactUsedKey:n,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r,s={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,r,s):this.resourceStore.getResource(e,t,r,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!V(e.replace);let s=r?e.replace:e;if(r&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith(t)&&e[r]!==void 0)return!0;return!1}}class oa{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ce.create("languageUtils")}getScriptPartFromCode(e){if(e=ei(e),!e||!e.includes("-"))return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=ei(e),!e||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(V(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(r=>{if(t)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const s=this.getScriptPartFromCode(r);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(r);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(o=>o===n?!0:!o.includes("-")&&!n.includes("-")?!1:!!(o.includes("-")&&!n.includes("-")&&o.slice(0,o.indexOf("-"))===n||o.startsWith(n)&&n.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],n=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return V(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):V(e)&&n(this.formatLanguageCode(e)),r.forEach(o=>{s.includes(o)||n(this.formatLanguageCode(o))}),s}}const aa={zero:0,one:1,two:2,few:3,many:4,other:5},la={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class kc{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Ce.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=ei(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:r,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),la;if(!e.match(/-|_/))return la;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[n]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((s,n)=>aa[s]-aa[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,r={}){const s=this.getRule(e,r);return s?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const ua=(i,e,t,r=".",s=!0)=>{let n=vc(i,e,t);return!n&&s&&V(t)&&(n=us(i,t,r),n===void 0&&(n=us(e,t,r))),n},hs=i=>i.replace(/\$/g,"$$$$");class ca{constructor(e={}){var t;this.logger=Ce.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:s,prefix:n,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:h,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:g,nestingOptionsSeparator:P,maxReplaces:S,alwaysFormat:F}=e.interpolation;this.escape=t!==void 0?t:mc,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?tt(n):o||"{{",this.suffix=a?tt(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?tt(d):f||tt("$t("),this.nestingSuffix=p?tt(p):g||tt(")"),this.nestingOptionsSeparator=P||",",this.maxReplaces=S||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,r)=>(t==null?void 0:t.source)===r?(t.lastIndex=0,t):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,r,s){var f;let n,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(!p.includes(this.formatSeparator)){const F=ua(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(F,void 0,r,{...s,...t,interpolationkey:p}):F}const g=p.split(this.formatSeparator),P=g.shift().trim(),S=g.join(this.formatSeparator).trim();return this.format(ua(t,l,P,this.options.keySeparator,this.options.ignoreJSONStructure),S,r,{...s,...t,interpolationkey:P})};this.resetRegExp();const c=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((f=s==null?void 0:s.interpolation)==null?void 0:f.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>hs(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?hs(this.escape(p)):hs(p)}].forEach(p=>{for(a=0;n=p.regex.exec(e);){const g=n[1].trim();if(o=u(g),o===void 0)if(typeof c=="function"){const S=c(e,n,s);o=V(S)?S:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))o="";else if(h){o=n[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else!V(o)&&!this.useRawValueToEscape&&(o=Zo(o));const P=p.safeValue(o);if(e=e.replace(n[0],P),h?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=n[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,r={}){let s,n,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(!l.includes(c))return l;const h=l.split(new RegExp(`${tt(c)}[ ]*{`));let d=`{${h[1]}`;l=h[0],d=this.interpolate(d,o);const f=d.match(/'/g),p=d.match(/"/g);(((f==null?void 0:f.length)??0)%2===0&&!p||((p==null?void 0:p.length)??0)%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${d}`}return o.defaultValue&&o.defaultValue.includes(this.prefix)&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&!V(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(c=>c.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),n=t(a.call(this,s[1].trim(),o),o),n&&s[0]===e&&!V(n))return n;V(n)||(n=Zo(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((c,h)=>this.format(c,h,r.lng,{...r,interpolationkey:s[1].trim()}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const Pc=i=>{let e=i.toLowerCase().trim();const t={};if(i.includes("(")){const r=i.split("(");e=r[0].toLowerCase().trim();const s=r[1].slice(0,-1);e==="currency"&&!s.includes(":")?t.currency||(t.currency=s.trim()):e==="relativetime"&&!s.includes(":")?t.range||(t.range=s.trim()):s.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();t[c]||(t[c]=u),u==="false"&&(t[c]=!1),u==="true"&&(t[c]=!0),isNaN(u)||(t[c]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ha=i=>{const e={};return(t,r,s)=>{let n=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(n={...n,[s.interpolationkey]:void 0});const o=r+JSON.stringify(n);let a=e[o];return a||(a=i(ei(r),s),e[o]=a),a(t)}},Oc=i=>(e,t,r)=>i(ei(t),r)(e);class Rc{constructor(e={}){this.logger=Ce.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?ha:Oc;this.formats={number:r((s,n)=>{const o=new Intl.NumberFormat(s,{...n});return a=>o.format(a)}),currency:r((s,n)=>{const o=new Intl.NumberFormat(s,{...n,style:"currency"});return a=>o.format(a)}),datetime:r((s,n)=>{const o=new Intl.DateTimeFormat(s,{...n});return a=>o.format(a)}),relativetime:r((s,n)=>{const o=new Intl.RelativeTimeFormat(s,{...n});return a=>o.format(a,n.range||"day")}),list:r((s,n)=>{const o=new Intl.ListFormat(s,{...n});return a=>o.format(a)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ha(t)}format(e,t,r,s={}){if(!t||e==null)return e;const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&!n[0].includes(")")&&n.find(a=>a.includes(")"))){const a=n.findIndex(l=>l.includes(")"));n[0]=[n[0],...n.splice(1,a)].join(this.formatSeparator)}return n.reduce((a,l)=>{var h;const{formatName:u,formatOptions:c}=Pc(l);if(this.formats[u]){let d=a;try{const f=((h=s==null?void 0:s.formatParams)==null?void 0:h[s.interpolationkey])||{},p=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](a,p,{...c,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},e)}}const Tc=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class Ic extends Ui{constructor(e,t,r,s={}){var n,o;super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Ce.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],(o=(n=this.backend)==null?void 0:n.init)==null||o.call(n,r,s.backend,s)}queueLoad(e,t,r,s){const n={},o={},a={},l={};return e.forEach(u=>{let c=!0;t.forEach(h=>{const d=`${u}|${h}`;!r.reload&&this.store.hasResourceBundle(u,h)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,c=!1,o[d]===void 0&&(o[d]=!0),n[d]===void 0&&(n[d]=!0),l[h]===void 0&&(l[h]=!0)))}),c||(a[u]=!0)}),(Object.keys(n).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){const s=e.split("|"),n=s[0],o=s[1];t&&this.emit("failedLoading",n,o,t),!t&&r&&this.store.addResourceBundle(n,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const a={};this.queue.forEach(l=>{gc(l.loaded,[n],o),Tc(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(h=>{a[u][h]===void 0&&(a[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,r,s=0,n=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:r,tried:s,wait:n,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&c&&s{this.read(e,t,r,s+1,n*2,o)},n);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(e,t,a)}prepareLoading(e,t,r={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(t)&&(t=[t]);const n=this.queueLoad(e,t,r,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),s=r[0],n=r[1];this.read(s,n,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,a),this.loaded(e,o,a)})}saveMissing(e,t,r,s,n,o={},a=()=>{}){var l,u,c,h,d;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((h=(c=this.services)==null?void 0:c.utils)!=null&&h.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((d=this.backend)!=null&&d.create){const f={...o,isUpdate:n},p=this.backend.create.bind(this.backend);if(p.length<6)try{let g;p.length===5?g=p(e,t,r,s,f):g=p(e,t,r,s),g&&typeof g.then=="function"?g.then(P=>a(null,P)).catch(a):a(null,g)}catch(g){a(g)}else p(e,t,r,s,a,f)}!e||!e[0]||this.store.addResource(e[0],t,r,s)}}}const ds=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),V(i[1])&&(e.defaultValue=i[1]),V(i[2])&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(r=>{e[r]=t[r]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),da=i=>(V(i.ns)&&(i.ns=[i.ns]),V(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),V(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&!i.supportedLngs.includes("cimode")&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i),qi=()=>{},Cc=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class ti extends Ui{constructor(e={},t){if(super(),this.options=da(e),this.services={},this.logger=Ce,this.modules={external:[]},Cc(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const r=ds();this.options={...r,...this.options,...da(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Ce.init(s(this.modules.logger),this.options):Ce.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=Rc;const c=new oa(this.options);this.store=new ra(this.options.resources,this.options);const h=this.services;h.logger=Ce,h.resourceStore=this.store,h.languageUtils=c,h.pluralResolver=new kc(c,{prepend:this.options.pluralSeparator}),u&&(h.formatter=s(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new ca(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new Ic(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Vi(this.services,this.options),this.translator.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,t||(t=qi),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...c)=>this.store[u](...c)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...c)=>(this.store[u](...c),this)});const a=Zt(),l=()=>{const u=(c,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(h),t(c,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(e,t=qi){var n,o;let r=t;const s=V(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const a=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&(a.includes(h)||a.push(h))})};s?l(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>l(c)),(o=(n=this.options.preload)==null?void 0:n.forEach)==null||o.call(n,u=>l(u)),this.services.backendConnector.load(a,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(e,t,r){const s=Zt();return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=qi),this.services.backendConnector.reload(e,t,n=>{s.resolve(),r(n)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&sa.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let t=0;t{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},n=(a,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,r.resolve((...u)=>this.t(...u)),t&&t(a,(...u)=>this.t(...u))},o=a=>{var c,h;!e&&!a&&this.services.languageDetector&&(a=[]);const l=V(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(V(a)?[a]:a);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(h=(c=this.services.languageDetector)==null?void 0:c.cacheUserLanguage)==null||h.call(c,u)),this.loadResources(u,d=>{n(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,t,r){const s=(n,o,...a)=>{let l;typeof o!="object"?l=this.options.overloadTranslationOptionHandler([n,o].concat(a)):l={...o},l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||s.keyPrefix);const u={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=xt(l.keyPrefix,u));const c=this.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(n)?h=n.map(d=>(typeof d=="function"&&(d=xt(d,u)),`${l.keyPrefix}${c}${d}`)):(typeof n=="function"&&(n=xt(n,u)),h=l.keyPrefix?`${l.keyPrefix}${c}${n}`:n),this.t(h,l)};return V(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=r,s}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!s||o(n,e)))}loadNamespaces(e,t){const r=Zt();return this.options.ns?(V(e)&&(e=[e]),e.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),t&&t(s)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=Zt();V(e)&&(e=[e]);const s=this.options.preload||[],n=e.filter(o=>!s.includes(o)&&this.services.languageUtils.isSupportedCode(o));return n.length?(this.options.preload=s.concat(n),this.loadResources(o=>{r.resolve(),t&&t(o)}),r):(t&&t(),Promise.resolve())}dir(e){var s,n;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((n=this.services)==null?void 0:n.languageUtils)||new oa(ds());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.includes(r.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const r=new ti(e,t);return r.createInstance=ti.createInstance,r}cloneInstance(e={},t=qi){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},n=new ti(s);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(a=>{n[a]=this[a]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},r){const a=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((c,h)=>(c[h]={...l[u][h]},c),l[u]),l),{});n.store=new ra(a,s),n.services.resourceStore=n.store}if(e.interpolation){const l={...ds().interpolation,...this.options.interpolation,...e.interpolation},u={...s,interpolation:l};n.services.interpolator=new ca(u)}return n.translator=new Vi(n.services,s),n.translator.on("*",(a,...l)=>{n.emit(a,...l)}),n.init(s,t),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const he=ti.createInstance();he.createInstance,he.dir,he.init,he.loadResources,he.reloadResources,he.use,he.changeLanguage,he.getFixedT,he.t,he.exists,he.setDefaultNamespace,he.hasLoadedNamespace,he.loadNamespaces,he.loadLanguages;var Bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $c(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}const Fc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Lc={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ac=i=>Lc[i];let fa={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:i=>i.replace(Fc,Ac),transDefaultProps:void 0};const Mc=(i={})=>{fa={...fa,...i}},jc={type:"3rdParty",init(i){Mc(i.options.react)}};function fs(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ii(i){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ii(i)}function Dc(i,e){if(ii(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(ii(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function pa(i){var e=Dc(i,"string");return ii(e)=="symbol"?e:e+""}function Nc(i,e){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};fs(this,i),this.backends=[],this.type="backend",this.allOptions=r,this.init(e,t)}return ps(i,[{key:"init",value:function(t){var r=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=Vc(s,this.options||{},Bc()),this.allOptions=n,this.options.backends&&this.options.backends.length>1&&(this.allOptions.saveMissing||this.allOptions.updateMissing)&&this.services&&this.services.logger&&this.services.logger.warn("i18next-chained-backend: Using multiple backends in combination with saveMissing/updateMissing is not recommended, as it may trigger based on stale data."),this.options.backends&&this.options.backends.forEach(function(o,a){r.backends[a]=r.backends[a]||qc(o),r.backends[a].init(t,r.options.backendOptions&&r.options.backendOptions[a]||{},n)}),this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"read",value:function(t,r,s){var n=this,o=this.backends.length,a=function(c){if(c>=o)return s(new Error("non of the backend loaded data",!0));var h=c===o-1,d=n.options.handleEmptyResourcesAsFailed&&!h?0:-1,f=n.backends[c];f.read?va(f,t,r,function(p,g,P){if(!p&&g&&Object.keys(g).length>d){if(s(null,g,c),l(c-1,g),f.save&&n.options.cacheHitMode&&["refresh","refreshAndUpdateStore"].indexOf(n.options.cacheHitMode)>-1){if(P&&n.options.refreshExpirationTime&&P+n.options.refreshExpirationTime>Date.now())return;var S=n.backends[c+1];S&&S.read&&va(S,t,r,function(F,C){F||C&&(Object.keys(C).length<=d||(l(c,C),n.options.cacheHitMode==="refreshAndUpdateStore"&&n.services&&n.services.resourceStore&&n.services.resourceStore.addResourceBundle(t,r,C)))})}}else a(c+1)}):a(c+1)},l=function(c,h){if(!(c<0)){var d=n.backends[c];d.save&&d.save(t,r,h),l(c-1,h)}};a(0)}},{key:"create",value:function(t,r,s,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(l){if(l.create){var u=l.create.bind(l);if(u.length<6){try{var c;u.length===5?c=u(t,r,s,n,a):c=u(t,r,s,n),c&&typeof c.then=="function"?c.then(function(h){return o(null,h)}).catch(o):o(null,c)}catch(h){o(h)}return}u(t,r,s,n,o,a)}})}},{key:"reload",value:function(){var t=this,r=this.services,s=r.backendConnector,n=r.languageUtils,o=r.logger,a=s.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(h){var d=n.toResolveHierarchy(h);d.forEach(function(f){l.indexOf(f)<0&&l.push(f)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){t.allOptions.ns.forEach(function(h){s.read(c,h,"read",null,null,function(d,f){d&&o.warn("loading namespace ".concat(h," for language ").concat(c," failed"),d),!d&&f&&o.log("loaded namespace ".concat(h," for language ").concat(c),f),s.loaded("".concat(c,"|").concat(h),d,f)})})})}}}])})();_a.type="backend";function Wc(i,e,t){return(e=pa(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ma(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function gs(i){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};fs(this,i),this.init(e,t),this.type="backend"}return ps(i,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=t,this.options=gs(gs(gs({},Xc()),this.options),r),this.storage=new zc(this.options)}},{key:"read",value:function(t,r,s){var n=Date.now();if(!this.storage.store)return s(null,null);var o=this.storage.getItem("".concat(this.options.prefix).concat(t,"-").concat(r));if(o){o=JSON.parse(o);var a=this.getVersion(t,r);if(o.i18nStamp&&o.i18nStamp+this.options.expirationTime>n&&a===o.i18nVersion){var l=o.i18nStamp;return delete o.i18nVersion,delete o.i18nStamp,s(null,o,l)}}return s(null,null)}},{key:"save",value:function(t,r,s){if(this.storage.store){s.i18nStamp=Date.now();var n=this.getVersion(t,r);n&&(s.i18nVersion=n),this.storage.setItem("".concat(this.options.prefix).concat(t,"-").concat(r),JSON.stringify(s))}}},{key:"getVersion",value:function(t,r){var s,n;return((s=(n=this.options).getVersion)===null||s===void 0?void 0:s.call(n,t,r))||this.options.versions[t]||this.options.defaultVersion}}])})();ya.type="backend";function Gc(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Kc(i))||e){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +`),h=l;c.length>h;h++){var d=c[h];if(1024>=d.length){var f=nn.test(d)?d.replace(nn,"$1"):d;if(!f.match(/\S*Error: /)){for(var p of n){var g=p(f,r);if(g){u.push(g);break}}if(u.length>=50)break}}}return(function(P){if(!P.length)return[];var S=Array.from(P);return S.reverse(),S.slice(0,50).map((F=>{return w({},F,{filename:F.filename||(C=S,C[C.length-1]||{}).filename,function:F.function||ct});var C}))})(u)}})("web:javascript",dl,gl)),this._instance=i,this.no=(e=(t=this._instance.persistence)==null?void 0:t.get_property(fr))!==null&&e!==void 0?e:[]}onRemoteConfig(i){var e,t,r;if("errorTracking"in i){var s=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(r=i.errorTracking)==null?void 0:r.captureExtensionExceptions;this.no=s,this._instance.persistence&&this._instance.persistence.register({[fr]:this.no,[hn]:n})}}get oo(){var i,e=!!this._instance.get_property(hn),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.so.buildFromUnknown(i,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}sendExceptionEvent(i){var e=i.$exception_list;if(this.ao(e)){if(this.lo(e))return void ns.info("Skipping exception capture because a suppression rule matched");if(!this.oo&&this.uo(e))return void ns.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ho(e))return void ns.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}lo(i){if(i.length===0)return!1;var e=i.reduce(((t,r)=>{var{type:s,value:n}=r;return se(s)&&s.length>0&&t.$exception_types.push(s),se(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.no.some((t=>{var r=t.values.map((s=>{var n,o=eo[s.operator],a=z(s.value)?s.value:[s.value],l=(n=e[s.key])!==null&&n!==void 0?n:[];return a.length>0&&o(a,l)}));return t.type==="OR"?r.some(Boolean):r.every(Boolean)}))}uo(i){return i.flatMap((e=>{var t,r;return(t=(r=e.stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ho(i){if(i.length>0){var e,t,r,s,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}ao(i){return!W(i)&&z(i)}}},Au=w({productTours:class{get Xi(){return this._instance.persistence}constructor(i){this.co=null,this.do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this.Xi&&this.Xi.register({[pn]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.co||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(pn)||this.ni((()=>this.vo()))}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(r=>{r?Lo.error("Could not load product tours script",r):i()}))}vo(){var i;!this.co&&(i=A.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.co=A.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!z(this.do)||e){var t=this.Xi;if(t){var r=t.props[ts];if(z(r)&&!e)return this.do=r,void i(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var n=s.statusCode;if(n!==200||!s.json){var o="Product Tours API could not be loaded, status: "+n;return Lo.error(o),void i([],{isLoaded:!1,error:o})}var a=z(s.json.product_tours)?s.json.product_tours:[];this.do=a,t&&t.register({[ts]:a}),i(a,{isLoaded:!0})}})}else i(this.do,{isLoaded:!0})}getActiveProductTours(i){W(this.co)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.co.getActiveProductTours(i)}showProductTour(i){var e;(e=this.co)==null||e.showTourById(i)}previewTour(i){this.co?this.co.previewTour(i):this.ni((()=>{var e;this.vo(),(e=this.co)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.co)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.co)==null||i.nextStep()}previousStep(){var i;(i=this.co)==null||i.previousStep()}clearCache(){var i;this.do=null,(i=this.Xi)==null||i.unregister(ts)}resetTour(i){var e;(e=this.co)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.co)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.co)==null||e.cancelPendingTour(i)}}},Di),Mu={siteApps:class{constructor(i){this._instance=i,this.fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}po(i,e){if(e){var t=this.globalsForEvent(e);this.fo.push(t),this.fo.length>1e3&&(this.fo=this.fo.slice(10))}}get siteAppLoaders(){var i;return(i=A._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.po.bind(this));this.mo=()=>{i(),this.fo=[],this.mo=void 0}}}globalsForEvent(i){var e,t,r,s,n,o,a;if(!i)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(c))l[h]={id:u[h],type:h,properties:d};var{$set_once:f,$set:p}=i;return{event:w({},Cs(i,ku),{properties:w({},i.properties,p?{$set:w({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:w({},(r=(s=i.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.fo.length&&(Ue.info("Processing "+this.fo.length+" events for site app with id "+i.id),this.fo.forEach((a=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this.mo)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,Ue.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),r&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback(o){s(o)}});n&&(e.processEvent=n),r=!0}catch(o){Ue.error(Ao+i.id,o),s(!1)}if(r&&e.loaded)try{t()}catch(o){Ue.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}yo(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}bo(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(r){Ue.error("Error while processing event "+i.event+" for site app "+t.id,r)}}}onRemoteConfig(i){var e,t,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.yo(),void this._instance.on("eventCaptured",(l=>this.bo(l)))):void Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.mo)==null||t.call(this),(r=i.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var u;A["__$$ph_site_app_"+l]=s._instance,(u=A.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(s._instance,a,(c=>{if(c)return Ue.error(Ao+l,c)}))};for(var{id:o,url:a}of i.siteApps)n(o)}else Ue.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ju={tracingHeaders:class{constructor(i){this.wo=void 0,this._o=void 0,this.Gs=()=>{var e,t;I(this.wo)&&((e=A.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),I(this._o)&&((t=A.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=i}initialize(){this.startIfEnabledOrStop()}ni(i){var e,t;(e=A.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&i(),(t=A.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return Su.error("failed to load script",r);i()}))}startIfEnabledOrStop(){var i,e;this._instance.config.__add_tracing_headers?this.ni(this.Gs):((i=this.wo)==null||i.call(this),(e=this._o)==null||e.call(this),this.wo=void 0,this._o=void 0)}}},Du=w({surveys:class{get Rt(){return this._instance.config}constructor(i){this.Io=void 0,this._surveyManager=null,this.Co=!1,this.So=[],this.ko=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Rt.disable_surveys){var e=i.surveys;if(W(e))return K.warn("Flags not loaded yet. Not loading surveys.");var t=z(e);this.Io=t?e.length>0:e,K.info("flags response received, isSurveysEnabled: "+this.Io),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;elocalStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.Co)K.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)K.info(Mo);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())K.info("Not loading surveys in cookieless mode without consent.");else{var i=A==null?void 0:A.__PosthogExtensions__;if(i){if(!I(this.Io)||this.Rt.advanced_enable_surveys){var e=this.Io||this.Rt.advanced_enable_surveys;this.Co=!0;try{var t=i.generateSurveys;if(t)return void this.xo(t,e);var r=i.loadExternalDependency;if(!r)return void this.To(xr);r(this._instance,"surveys",(s=>{s||!i.generateSurveys?this.To("Could not load surveys script",s):this.xo(i.generateSurveys,e)}))}catch(s){throw this.To("Error initializing surveys",s),s}finally{this.Co=!1}}}else K.error("PostHog Extensions not found.")}}xo(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Ru(this._instance),K.info("Surveys loaded successfully"),this.Ao({isLoaded:!0})}To(i,e){K.error(i,e),this.Ao({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.So.push(i),this._surveyManager&&this.Ao({isLoaded:!0}),()=>{this.So=this.So.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Rt.disable_surveys)return K.info(Mo),i([]);var t,r=this._instance.get_property(gr);if(r&&!e)return i(r,{isLoaded:!0});typeof Promise<"u"&&this.ko?this.ko.then((s=>{var{surveys:n,context:o}=s;return i(n,o)})):(typeof Promise<"u"&&(this.ko=new Promise((s=>{t=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:s=>{var n;this.ko=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;K.error(a);var l={isLoaded:!1,error:a};return i([],l),void(t==null||t({surveys:[],context:l}))}var u,c=s.json.surveys||[],h=c.filter((f=>(function(p){return!(!p.start_date||p.end_date)})(f)&&((function(p){var g;return!((g=p.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(f)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(f))));h.length>0&&((u=this._surveyEventReceiver)==null||u.register(h)),(n=this._instance.persistence)==null||n.register({[gr]:c});var d={isLoaded:!0};i(c,d),t==null||t({surveys:c,context:d})}}))}Ao(i){for(var e of this.So)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){K.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!W(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);K.warn("init was not called")}Eo(i){var e=null;return this.getSurveys((t=>{var r;e=(r=t.find((s=>s.id===i)))!==null&&r!==void 0?r:null})),e}Ro(i){if(W(this._surveyManager))return{eligible:!1,reason:is};var e=typeof i=="string"?this.Eo(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(W(this._surveyManager))return K.warn("init was not called"),{visible:!1,disabledReason:is};var e=this.Ro(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return W(this._surveyManager)?(K.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:is})):new Promise((t=>{this.getSurveys((r=>{var s,n=(s=r.find((a=>a.id===i)))!==null&&s!==void 0?s:null;if(n){var o=this.Ro(n);t({visible:o.eligible,disabledReason:o.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var r;if(W(this._surveyManager))K.warn("init was not called");else{var s=typeof i=="string"?this.Eo(i):i;if(s!=null&&s.id)if(au.includes(s.type)){var n=k==null?void 0:k.querySelector(e);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(K.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;K.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,n,t),K.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,t);K.warn("Survey element not found")}else K.warn("Surveys of type "+s.type+" cannot be rendered in the app");else K.warn("Survey not found")}}displaySurvey(i,e){var t;if(W(this._surveyManager))K.warn("init was not called");else{var r=this.Eo(i);if(r){var s=r;if((t=r.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=w({},r,{appearance:w({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==$r.Popover&&e.initialResponses&&K.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(r);if(!n.visible)return void K.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==$r.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else K.warn("Survey not found")}}cancelPendingSurvey(i){W(this._surveyManager)?K.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},Di),Nu={toolbar:class{constructor(i){this.instance=i}No(i){A.ph_toolbar_state=i}Mo(){var i;return(i=A.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),bn(this.instance.config)||!_||!k)return!1;i=i??_.location,t=t??_.history;try{if(!e){try{_.localStorage.setItem("test","test"),_.localStorage.removeItem("test")}catch{return!1}e=_==null?void 0:_.localStorage}var r,s=Tu||Oi(i.hash,"__posthog")||Oi(i.hash,"state"),n=s?yn((()=>JSON.parse(atob(decodeURIComponent(s)))))||yn((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((r=JSON.parse(e.getItem(jo)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Fo(i){var e=A.ph_load_toolbar||A.ph_load_editor;!W(e)&&$e(e)?e(i,this.instance):Do.warn("No toolbar load function found")}loadToolbar(i){var e=!(k==null||!k.getElementById(_n));if(!_||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=w({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(_.localStorage.setItem(jo,JSON.stringify(w({},r,{source:void 0}))),this.Mo()===2)this.Fo(r);else if(this.Mo()===0){var s;this.No(1),(s=A.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Do.error("[Toolbar] Failed to load",n),void this.No(0);this.No(2),this.Fo(r)})),ne(_,"turbolinks:load",(()=>{this.No(0),this.loadToolbar(r)}))}return!0}Oo(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Hu=w({experiments:ce},Di),Uu={conversations:class{constructor(i){this.Po=void 0,this._conversationsManager=null,this.Lo=!1,this.Do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;W(e)||(Oe(e)?this.Po=e:(this.Po=e.enabled,this.Do=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Po=void 0,this.Do=null}loadIfEnabled(){if(!(this._conversationsManager||this.Lo||this._instance.config.disable_conversations||bn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=A==null?void 0:A.__PosthogExtensions__;if(i&&!I(this.Po)&&this.Po)if(this.Do&&this.Do.token){this.Lo=!0;try{var e=i.initConversations;if(e)return this.Bo(e),void(this.Lo=!1);var t=i.loadExternalDependency;if(!t)return void this.jo(xr);t(this._instance,"conversations",(r=>{r||!i.initConversations?this.jo("Could not load conversations script",r):this.Bo(i.initConversations),this.Lo=!1}))}catch(r){this.jo("Error initializing conversations",r),this.Lo=!1}}else we.error("Conversations enabled but missing token in remote config.")}}Bo(i){if(this.Do)try{this._conversationsManager=i(this.Do,this._instance),we.info("Conversations loaded successfully")}catch(e){this.jo("Error completing conversations initialization",e)}else we.error("Cannot complete initialization: remote config is null")}jo(i,e){we.error(i,e),this._conversationsManager=null,this.Lo=!1}show(){this._conversationsManager?this._conversationsManager.show():we.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Po===!0&&!Fe(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var r=this;return xe((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(i,e,t):(we.warn(Qe),null)}))()}getMessages(i,e){var t=this;return xe((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(we.warn(Qe),null)}))()}markAsRead(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(we.warn(Qe),null)}))()}getTickets(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(we.warn(Qe),null)}))()}requestRestoreLink(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(we.warn(Qe),null)}))()}restoreFromToken(i){var e=this;return xe((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(we.warn(Qe),null)}))()}restoreFromUrlToken(){var i=this;return xe((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(we.warn(Qe),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}Kr(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Qr(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Vu={logs:class{constructor(i){var e;this.qo=!1,this.Zo=!1,this.qt=Z("[logs]"),this.$o=[],this.Vo=0,this.Ho=0,this.zo=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.qo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!W(t)&&t&&(this.qo=!0,this.loadIfEnabled())}reset(){this.$o=[],this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Vo=0,this.Ho=0,this.zo=!1}loadIfEnabled(){if(this.qo&&!this.Zo){var i=A==null?void 0:A.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var r;t||(r=i.logs)==null||!r.initializeLogs?this.qt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.Zo=!0)})):this.qt.error(xr)}else this.qt.error("PostHog Extensions not found.")}}captureLog(i){var e,t,r,s,n,o;if(this._instance.is_capturing())if(i&&i.body){var a=(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3,l=(r=(s=this._instance.config.logs)==null?void 0:s.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,u=Date.now();if(a>u-this.Ho||(this.Ho=u,this.Vo=0,this.zo=!1),l>this.Vo){this.Vo++;var c=(function(h,d){var f=h.level||"info",{text:p,number:g}=Bo[f]||Cu,P=String(Date.now())+"000000",S={};d.distinctId&&(S.posthogDistinctId=d.distinctId),d.sessionId&&(S.sessionId=d.sessionId),d.currentUrl&&(S["url.full"]=d.currentUrl),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(S.feature_flags=d.activeFeatureFlags);var F=w({},S,h.attributes||{}),C={timeUnixNano:P,observedTimeUnixNano:P,severityNumber:g,severityText:p,body:{stringValue:h.body},attributes:zo(F)};return h.trace_id&&(C.traceId=h.trace_id),h.span_id&&(C.spanId=h.span_id),I(h.trace_flags)||(C.flags=h.trace_flags),C})(i,this.Uo());this.$o.push({record:c}),((n=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&n!==void 0?n:100)>this.$o.length?this.Yo():this.flushLogs()}else this.zo||(this.qt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.zo=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.Go||(this.Go={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Go}flushLogs(i){if(this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.$o.length!==0){var e=this.$o;this.$o=[];var t=this._instance.config.logs,r=w({"service.name":(t==null?void 0:t.serviceName)||"unknown_service"},(t==null?void 0:t.environment)&&{"deployment.environment":t.environment},(t==null?void 0:t.serviceVersion)&&{"service.version":t.serviceVersion},t==null?void 0:t.resourceAttributes),s=(function(o,a){return{resourceLogs:[{resource:{attributes:zo(a)},scopeLogs:[{scope:{name:de.LIB_NAME},logRecords:o}]}]}})(e.map((o=>o.record)),r),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Pr({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:i})}}Yo(){var i,e;this.Ni||(this.Ni=setTimeout((()=>{this.Ni=void 0,this.flushLogs()}),(i=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3))}Uo(){var i,e={lib:de.LIB_NAME};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t}if(A!=null&&(i=A.location)!=null&&i.href&&(e.currentUrl=A.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},qu=w({},Di,$u,Fu,Lu,Au,Mu,Du,ju,Nu,Hu,Uu,Vu);be.__defaultExtensionClasses=w({},qu);var Xo,qe=(Xo=qt[bt]=new be,(function(){function i(){i.done||(i.done=!0,ao=!1,J(qt,(function(e){e._dom_loaded()})))}k!=null&&k.addEventListener?k.readyState==="complete"?i():ne(k,"DOMContentLoaded",i,{capture:!1}):_&&O.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Xo);function Go(i){return Array.isArray(i)&&i.every(e=>typeof e=="string")}function Bu(i){if(!i||typeof i!="object")return!1;const e=i;return typeof e.wc_version=="string"&&typeof e.php_version=="string"&&typeof e.site_uuid=="string"&&typeof e.user_uuid=="string"&&typeof e.user_role=="string"&&typeof e.wc_currency=="string"&&typeof e.wc_country=="string"&&typeof e.days_since_install=="number"&&typeof e.product_count=="number"&&typeof e.order_count=="number"&&typeof e.pos_user_count=="number"&&Go(e.active_gateways)&&Go(e.active_extensions)}function Wu(i){return!i||typeof i!="object"?!1:typeof i.profile_url=="string"}function zu(i){if(!i||typeof i!="object")return!1;const e=i;return typeof e.schema_version=="number"&&typeof e.locale=="string"&&typeof e.plugin_version=="string"&&typeof e.pro_active=="boolean"}function et(){var r;const i=(r=window.wcpos)==null?void 0:r.landing;if(!zu(i))return;const e={schema_version:i.schema_version,locale:i.locale,plugin_version:i.plugin_version,pro_active:i.pro_active},t=i;return typeof t.anon_id=="string"&&(e.anon_id=t.anon_id),Bu(t.profile)&&(e.profile=t.profile),Wu(t.updates_server)&&(e.updates_server=t.updates_server),e}const Xu=new Date("2011-12-01"),Gu=new Date("2014-05-11"),Ku="$129",Ju="$399",Yu="6,000+",Zu="https://demo.wcpos.com/pos",Qu="https://github.com/orgs/wcpos/projects/4/views/1",ec="https://wordpress.org/support/plugin/woocommerce-pos/reviews/#new-post",tc="https://wcpos.com/pro",os="https://cdn.jsdelivr.net/gh/wcpos/wp-admin-landing@v2/assets",Jt=2,Yt=1;function ic(i,e=new Date){let t=e.getFullYear()-i.getFullYear();const r=new Date(i);return r.setFullYear(i.getFullYear()+t),e{if(s!=null&&s.properties){const n=s.properties;delete n.$current_url,delete n.$host,delete n.$pathname,delete n.$referrer,delete n.$referring_domain;for(const o of Object.keys(n))o.startsWith("$session_entry_")&&delete n[o]}return s}});const r=oc();return qe.register({plugin_version:(i==null?void 0:i.plugin_version)??"unknown",pro_active:(i==null?void 0:i.pro_active)??!1,locale:(i==null?void 0:i.locale)??"en_US",has_profile:!!(i!=null&&i.profile),has_anon_id:!!e,analytics_schema_version:Jt,...r}),t||(qe.capture("$pageview"),hc((i==null?void 0:i.pro_active)??!1)),qe}function cc(){const i=et(),e=i==null?void 0:i.profile;!i||!(e!=null&&e.site_uuid)||qe.identify(e.site_uuid,{locale:i.locale,plugin_version:i.plugin_version,pro_active:i.pro_active,wc_version:e.wc_version,days_since_install:e.days_since_install,product_count:e.product_count,order_count:e.order_count,pos_user_count:e.pos_user_count,wc_currency:e.wc_currency,wc_country:e.wc_country,user_role:e.user_role})}function hc(i){try{i&&!window.localStorage.getItem(Yo)&&(qe.capture("pro_activated_observed"),window.localStorage.setItem(Yo,"1"))}catch{}}function ls(i,e){qe.capture(i,e)}function dc(i,e){const t=et(),r=new URL(i);return r.searchParams.set("ref","wp-admin"),r.searchParams.set("utm_source","wp-admin-landing"),r.searchParams.set("utm_medium","landing"),r.searchParams.set("utm_campaign",`landing-${e}`),r.searchParams.set("utm_content",e),r.searchParams.set("lv",e),r.searchParams.set("aid",qe.get_distinct_id()),r.searchParams.set("pv",(t==null?void 0:t.plugin_version)??"unknown"),r.toString()}const V=i=>typeof i=="string",Zt=()=>{let i,e;const t=new Promise((r,s)=>{i=r,e=s});return t.resolve=i,t.reject=e,t},Zo=i=>i==null?"":String(i),fc=(i,e,t)=>{i.forEach(r=>{e[r]&&(t[r]=e[r])})},pc=/###/g,Qo=i=>i&&i.includes("###")?i.replace(pc,"."):i,ea=i=>!i||V(i),Qt=(i,e,t)=>{const r=V(e)?e.split("."):e;let s=0;for(;s{const{obj:r,k:s}=Qt(i,e,Object);if(r!==void 0||e.length===1){r[s]=t;return}let n=e[e.length-1],o=e.slice(0,e.length-1),a=Qt(i,o,Object);for(;a.obj===void 0&&o.length;)n=`${o[o.length-1]}.${n}`,o=o.slice(0,o.length-1),a=Qt(i,o,Object),a!=null&&a.obj&&typeof a.obj[`${a.k}.${n}`]<"u"&&(a.obj=void 0);a.obj[`${a.k}.${n}`]=t},gc=(i,e,t,r)=>{const{obj:s,k:n}=Qt(i,e,Object);s[n]=s[n]||[],s[n].push(t)},Ni=(i,e)=>{const{obj:t,k:r}=Qt(i,e);if(t&&Object.prototype.hasOwnProperty.call(t,r))return t[r]},vc=(i,e,t)=>{const r=Ni(i,t);return r!==void 0?r:Ni(e,t)},ia=(i,e,t)=>{for(const r in e)r!=="__proto__"&&r!=="constructor"&&(r in i?V(i[r])||i[r]instanceof String||V(e[r])||e[r]instanceof String?t&&(i[r]=e[r]):ia(i[r],e[r],t):i[r]=e[r]);return i},tt=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),_c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},mc=i=>V(i)?i.replace(/[&<>"'\/]/g,e=>_c[e]):i;class yc{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(t!==void 0)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}const bc=[" ",",","?","!",";"],wc=new yc(20),xc=(i,e,t)=>{e=e||"",t=t||"";const r=bc.filter(o=>!e.includes(o)&&!t.includes(o));if(r.length===0)return!0;const s=wc.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let n=!s.test(i);if(!n){const o=i.indexOf(t);o>0&&!s.test(i.substring(0,o))&&(n=!0)}return n},us=(i,e,t=".")=>{if(!i)return;if(i[e])return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;const r=e.split(t);let s=i;for(let n=0;ni==null?void 0:i.replace(/_/g,"-"),Sc={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,e){var t,r;(r=(t=console==null?void 0:console[i])==null?void 0:t.apply)==null||r.call(t,console,e)}};class Hi{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||Sc,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,s){return s&&!this.debug?null:(V(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new Hi(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return e=e||this.options,e.prefix=e.prefix||this.prefix,new Hi(this.logger,e)}}var Ce=new Hi;class Ui{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(t)||0;this.observers[r].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([s,n])=>{for(let o=0;o{for(let o=0;o-1&&this.options.ns.splice(t,1)}getResource(e,t,r,s={}){var u,c;const n=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,o=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.includes(".")?a=e.split("."):(a=[e,t],r&&(Array.isArray(r)?a.push(...r):V(r)&&n?a.push(...r.split(n)):a.push(r)));const l=Ni(this.data,a);return!l&&!t&&!r&&e.includes(".")&&(e=a[0],t=a[1],r=a.slice(2).join(".")),l||!o||!V(r)?l:us((c=(u=this.data)==null?void 0:u[e])==null?void 0:c[t],r,n)}addResource(e,t,r,s,n={silent:!1}){const o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.includes(".")&&(a=e.split("."),s=t,t=a[1]),this.addNamespaces(t),ta(this.data,a,s),n.silent||this.emit("added",e,t,r,s)}addResources(e,t,r,s={silent:!1}){for(const n in r)(V(r[n])||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});s.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,s,n,o={silent:!1,skipCopy:!1}){let a=[e,t];e.includes(".")&&(a=e.split("."),s=r,r=t,t=a[1]),this.addNamespaces(t);let l=Ni(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?ia(l,r,n):l={...l,...r},ta(this.data,a,l),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(s=>t[s]&&Object.keys(t[s]).length>0)}toJSON(){return this.data}}var sa={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,e,t,r,s){return i.forEach(n=>{var o;e=((o=this.processors[n])==null?void 0:o.process(e,t,r,s))??e}),e}};const na=Symbol("i18next/PATH_KEY");function Ec(){const i=[],e=Object.create(null);let t;return e.get=(r,s)=>{var n;return(n=t==null?void 0:t.revoke)==null||n.call(t),s===na?i:(i.push(s),t=Proxy.revocable(r,e),t.proxy)},Proxy.revocable(Object.create(null),e).proxy}function xt(i,e){const{[na]:t}=i(Ec()),r=(e==null?void 0:e.keySeparator)??".",s=(e==null?void 0:e.nsSeparator)??":";if(t.length>1&&s){const n=e==null?void 0:e.ns,o=Array.isArray(n)?n:null;if(o&&o.length>1&&o.slice(1).includes(t[0]))return`${t[0]}${s}${t.slice(1).join(r)}`}return t.join(r)}const cs=i=>!V(i)&&typeof i!="boolean"&&typeof i!="number";class Vi extends Ui{constructor(e,t={}){super(),fc(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Ce.create("translator"),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r={...t};if(e==null)return!1;const s=this.resolve(e,r);if((s==null?void 0:s.res)===void 0)return!1;const n=cs(s.res);return!(r.returnObjects===!1&&n)}extractFromKey(e,t){let r=t.nsSeparator!==void 0?t.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=t.keySeparator!==void 0?t.keySeparator:this.options.keySeparator;let n=t.ns||this.options.defaultNS||[];const o=r&&e.includes(r),a=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!xc(e,r,s);if(o&&!a){const l=e.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:e,namespaces:V(n)?[n]:n};const u=e.split(r);(r!==s||r===s&&this.options.ns.includes(u[0]))&&(n=u.shift()),e=u.join(s)}return{key:e,namespaces:V(n)?[n]:n}}translate(e,t,r){let s=typeof t=="object"?{...t}:t;if(typeof s!="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),typeof s=="object"&&(s={...s}),s||(s={}),e==null)return"";typeof e=="function"&&(e=xt(e,{...this.options,...s})),Array.isArray(e)||(e=[String(e)]),e=e.map(H=>typeof H=="function"?xt(H,{...this.options,...s}):String(H));const n=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(e[e.length-1],s),u=l[l.length-1];let c=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;c===void 0&&(c=":");const h=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((h==null?void 0:h.toLowerCase())==="cimode")return d?n?{res:`${u}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:`${u}${c}${a}`:n?{res:a,usedKey:a,exactUsedKey:a,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(s)}:a;const f=this.resolve(e,s);let p=f==null?void 0:f.res;const g=(f==null?void 0:f.usedKey)||a,P=(f==null?void 0:f.exactUsedKey)||a,S=["[object Number]","[object Function]","[object RegExp]"],F=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,C=!this.i18nFormat||this.i18nFormat.handleAsObject,R=s.count!==void 0&&!V(s.count),E=Vi.hasDefaultValue(s),$=R?this.pluralResolver.getSuffix(h,s.count,s):"",x=s.ordinal&&R?this.pluralResolver.getSuffix(h,s.count,{ordinal:!1}):"",b=R&&!s.ordinal&&s.count===0,y=b&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${$}`]||s[`defaultValue${x}`]||s.defaultValue;let T=p;C&&!p&&E&&(T=y);const D=cs(T),j=Object.prototype.toString.apply(T);if(C&&T&&D&&!S.includes(j)&&!(V(F)&&Array.isArray(T))){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const H=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,T,{...s,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return n?(f.res=H,f.usedParams=this.getUsedParamsDetails(s),f):H}if(o){const H=Array.isArray(T),U=H?[]:{},v=H?P:g;for(const m in T)if(Object.prototype.hasOwnProperty.call(T,m)){const L=`${v}${o}${m}`;E&&!p?U[m]=this.translate(L,{...s,defaultValue:cs(y)?y[m]:void 0,joinArrays:!1,ns:l}):U[m]=this.translate(L,{...s,joinArrays:!1,ns:l}),U[m]===L&&(U[m]=T[m])}p=U}}else if(C&&V(F)&&Array.isArray(p))p=p.join(F),p&&(p=this.extendTranslation(p,e,s,r));else{let H=!1,U=!1;!this.isValidLookup(p)&&E&&(H=!0,p=y),this.isValidLookup(p)||(U=!0,p=a);const m=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:p,L=E&&y!==p&&this.options.updateMissing;if(U||H||L){if(this.logger.log(L?"updateKey":"missingKey",h,u,a,L?y:p),o){const G=this.resolve(a,{...s,keySeparator:!1});G&&G.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let M=[];const q=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&q&&q[0])for(let G=0;G{var te;const X=E&&ee!==p?ee:m;this.options.missingKeyHandler?this.options.missingKeyHandler(G,u,re,X,L,s):(te=this.backendConnector)!=null&&te.saveMissing&&this.backendConnector.saveMissing(G,u,re,X,L,s),this.emit("missingKey",G,u,re,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?M.forEach(G=>{const re=this.pluralResolver.getSuffixes(G,s);b&&s[`defaultValue${this.options.pluralSeparator}zero`]&&!re.includes(`${this.options.pluralSeparator}zero`)&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ee=>{N([G],a+ee,s[`defaultValue${ee}`]||y)})}):N(M,a,y))}p=this.extendTranslation(p,e,s,f,r),U&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${u}${c}${a}`),(U||H)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${c}${a}`:a,H?p:void 0,s))}return n?(f.res=p,f.usedParams=this.getUsedParamsDetails(s),f):p}extendTranslation(e,t,r,s,n){var l,u;if((l=this.i18nFormat)!=null&&l.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const c=V(e)&&(((u=r==null?void 0:r.interpolation)==null?void 0:u.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let h;if(c){const f=e.match(this.interpolator.nestingRegexp);h=f&&f.length}let d=r.replace&&!V(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),e=this.interpolator.interpolate(e,d,r.lng||this.language||s.usedLng,r),c){const f=e.match(this.interpolator.nestingRegexp),p=f&&f.length;h(n==null?void 0:n[0])===f[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`),null):this.translate(...f,t),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,a=V(o)?[o]:o;return e!=null&&(a!=null&&a.length)&&r.applyPostProcessor!==!1&&(e=sa.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,s,n,o,a;return V(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(l=>typeof l=="function"?xt(l,{...this.options,...t}):l)),e.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,t),c=u.key;s=c;let h=u.namespaces;this.options.fallbackNS&&(h=h.concat(this.options.fallbackNS));const d=t.count!==void 0&&!V(t.count),f=d&&!t.ordinal&&t.count===0,p=t.context!==void 0&&(V(t.context)||typeof t.context=="number")&&t.context!=="",g=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);h.forEach(P=>{var S,F;this.isValidLookup(r)||(a=P,!this.checkedLoadedFor[`${g[0]}-${P}`]&&((S=this.utils)!=null&&S.hasLoadedNamespace)&&!((F=this.utils)!=null&&F.hasLoadedNamespace(a))&&(this.checkedLoadedFor[`${g[0]}-${P}`]=!0,this.logger.warn(`key "${s}" for languages "${g.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),g.forEach(C=>{var $;if(this.isValidLookup(r))return;o=C;const R=[c];if(($=this.i18nFormat)!=null&&$.addLookupKeys)this.i18nFormat.addLookupKeys(R,c,C,P,t);else{let x;d&&(x=this.pluralResolver.getSuffix(C,t.count,t));const b=`${this.options.pluralSeparator}zero`,y=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(t.ordinal&&x.startsWith(y)&&R.push(c+x.replace(y,this.options.pluralSeparator)),R.push(c+x),f&&R.push(c+b)),p){const T=`${c}${this.options.contextSeparator||"_"}${t.context}`;R.push(T),d&&(t.ordinal&&x.startsWith(y)&&R.push(T+x.replace(y,this.options.pluralSeparator)),R.push(T+x),f&&R.push(T+b))}}let E;for(;E=R.pop();)this.isValidLookup(r)||(n=E,r=this.getResource(C,P,E,t))}))})}),{res:r,usedKey:s,exactUsedKey:n,usedLng:o,usedNS:a}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e==="")}getResource(e,t,r,s={}){var n;return(n=this.i18nFormat)!=null&&n.getResource?this.i18nFormat.getResource(e,t,r,s):this.resourceStore.getResource(e,t,r,s)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!V(e.replace);let s=r?e.replace:e;if(r&&typeof e.count<"u"&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const n of t)delete s[n]}return s}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith(t)&&e[r]!==void 0)return!0;return!1}}class oa{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ce.create("languageUtils")}getScriptPartFromCode(e){if(e=ei(e),!e||!e.includes("-"))return null;const t=e.split("-");return t.length===2||(t.pop(),t[t.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(e=ei(e),!e||!e.includes("-"))return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(V(e)&&e.includes("-")){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(r=>{if(t)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(r=>{if(t)return;const s=this.getScriptPartFromCode(r);if(this.isSupportedCode(s))return t=s;const n=this.getLanguagePartFromCode(r);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(o=>o===n?!0:!o.includes("-")&&!n.includes("-")?!1:!!(o.includes("-")&&!n.includes("-")&&o.slice(0,o.indexOf("-"))===n||o.startsWith(n)&&n.length>1))}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if(typeof e=="function"&&(e=e(t)),V(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),s=[],n=o=>{o&&(this.isSupportedCode(o)?s.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return V(e)&&(e.includes("-")||e.includes("_"))?(this.options.load!=="languageOnly"&&n(this.formatLanguageCode(e)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&n(this.getScriptPartFromCode(e)),this.options.load!=="currentOnly"&&n(this.getLanguagePartFromCode(e))):V(e)&&n(this.formatLanguageCode(e)),r.forEach(o=>{s.includes(o)||n(this.formatLanguageCode(o))}),s}}const aa={zero:0,one:1,two:2,few:3,many:4,other:5},la={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class kc{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Ce.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=ei(e==="dev"?"en":e),s=t.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:r,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let o;try{o=new Intl.PluralRules(r,{type:s})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),la;if(!e.match(/-|_/))return la;const l=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(l,t)}return this.pluralRulesCache[n]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(s=>`${t}${s}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((s,n)=>aa[s]-aa[n]).map(s=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${s}`):[]}getSuffix(e,t,r={}){const s=this.getRule(e,r);return s?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const ua=(i,e,t,r=".",s=!0)=>{let n=vc(i,e,t);return!n&&s&&V(t)&&(n=us(i,t,r),n===void 0&&(n=us(e,t,r))),n},hs=i=>i.replace(/\$/g,"$$$$");class ca{constructor(e={}){var t;this.logger=Ce.create("interpolator"),this.options=e,this.format=((t=e==null?void 0:e.interpolation)==null?void 0:t.format)||(r=>r),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:s,prefix:n,prefixEscaped:o,suffix:a,suffixEscaped:l,formatSeparator:u,unescapeSuffix:c,unescapePrefix:h,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:g,nestingOptionsSeparator:P,maxReplaces:S,alwaysFormat:F}=e.interpolation;this.escape=t!==void 0?t:mc,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=n?tt(n):o||"{{",this.suffix=a?tt(a):l||"}}",this.formatSeparator=u||",",this.unescapePrefix=c?"":h||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?tt(d):f||tt("$t("),this.nestingSuffix=p?tt(p):g||tt(")"),this.nestingOptionsSeparator=P||",",this.maxReplaces=S||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(t,r)=>(t==null?void 0:t.source)===r?(t.lastIndex=0,t):new RegExp(r,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,r,s){var f;let n,o,a;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=p=>{if(!p.includes(this.formatSeparator)){const F=ua(t,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(F,void 0,r,{...s,...t,interpolationkey:p}):F}const g=p.split(this.formatSeparator),P=g.shift().trim(),S=g.join(this.formatSeparator).trim();return this.format(ua(t,l,P,this.options.keySeparator,this.options.ignoreJSONStructure),S,r,{...s,...t,interpolationkey:P})};this.resetRegExp();const c=(s==null?void 0:s.missingInterpolationHandler)||this.options.missingInterpolationHandler,h=((f=s==null?void 0:s.interpolation)==null?void 0:f.skipOnVariables)!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>hs(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?hs(this.escape(p)):hs(p)}].forEach(p=>{for(a=0;n=p.regex.exec(e);){const g=n[1].trim();if(o=u(g),o===void 0)if(typeof c=="function"){const S=c(e,n,s);o=V(S)?S:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))o="";else if(h){o=n[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`),o="";else!V(o)&&!this.useRawValueToEscape&&(o=Zo(o));const P=p.safeValue(o);if(e=e.replace(n[0],P),h?(p.regex.lastIndex+=o.length,p.regex.lastIndex-=n[0].length):p.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,r={}){let s,n,o;const a=(l,u)=>{const c=this.nestingOptionsSeparator;if(!l.includes(c))return l;const h=l.split(new RegExp(`${tt(c)}[ ]*{`));let d=`{${h[1]}`;l=h[0],d=this.interpolate(d,o);const f=d.match(/'/g),p=d.match(/"/g);(((f==null?void 0:f.length)??0)%2===0&&!p||((p==null?void 0:p.length)??0)%2!==0)&&(d=d.replace(/'/g,'"'));try{o=JSON.parse(d),u&&(o={...u,...o})}catch(g){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,g),`${l}${c}${d}`}return o.defaultValue&&o.defaultValue.includes(this.prefix)&&delete o.defaultValue,l};for(;s=this.nestingRegexp.exec(e);){let l=[];o={...r},o=o.replace&&!V(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const u=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(u!==-1&&(l=s[1].slice(u).split(this.formatSeparator).map(c=>c.trim()).filter(Boolean),s[1]=s[1].slice(0,u)),n=t(a.call(this,s[1].trim(),o),o),n&&s[0]===e&&!V(n))return n;V(n)||(n=Zo(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`),n=""),l.length&&(n=l.reduce((c,h)=>this.format(c,h,r.lng,{...r,interpolationkey:s[1].trim()}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}const Pc=i=>{let e=i.toLowerCase().trim();const t={};if(i.includes("(")){const r=i.split("(");e=r[0].toLowerCase().trim();const s=r[1].slice(0,-1);e==="currency"&&!s.includes(":")?t.currency||(t.currency=s.trim()):e==="relativetime"&&!s.includes(":")?t.range||(t.range=s.trim()):s.split(";").forEach(o=>{if(o){const[a,...l]=o.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,""),c=a.trim();t[c]||(t[c]=u),u==="false"&&(t[c]=!1),u==="true"&&(t[c]=!0),isNaN(u)||(t[c]=parseInt(u,10))}})}return{formatName:e,formatOptions:t}},ha=i=>{const e={};return(t,r,s)=>{let n=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(n={...n,[s.interpolationkey]:void 0});const o=r+JSON.stringify(n);let a=e[o];return a||(a=i(ei(r),s),e[o]=a),a(t)}},Oc=i=>(e,t,r)=>i(ei(t),r)(e);class Rc{constructor(e={}){this.logger=Ce.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?ha:Oc;this.formats={number:r((s,n)=>{const o=new Intl.NumberFormat(s,{...n});return a=>o.format(a)}),currency:r((s,n)=>{const o=new Intl.NumberFormat(s,{...n,style:"currency"});return a=>o.format(a)}),datetime:r((s,n)=>{const o=new Intl.DateTimeFormat(s,{...n});return a=>o.format(a)}),relativetime:r((s,n)=>{const o=new Intl.RelativeTimeFormat(s,{...n});return a=>o.format(a,n.range||"day")}),list:r((s,n)=>{const o=new Intl.ListFormat(s,{...n});return a=>o.format(a)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ha(t)}format(e,t,r,s={}){if(!t||e==null)return e;const n=t.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&!n[0].includes(")")&&n.find(a=>a.includes(")"))){const a=n.findIndex(l=>l.includes(")"));n[0]=[n[0],...n.splice(1,a)].join(this.formatSeparator)}return n.reduce((a,l)=>{var h;const{formatName:u,formatOptions:c}=Pc(l);if(this.formats[u]){let d=a;try{const f=((h=s==null?void 0:s.formatParams)==null?void 0:h[s.interpolationkey])||{},p=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](a,p,{...c,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return a},e)}}const Tc=(i,e)=>{i.pending[e]!==void 0&&(delete i.pending[e],i.pendingCount--)};class Ic extends Ui{constructor(e,t,r,s={}){var n,o;super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=s,this.logger=Ce.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],(o=(n=this.backend)==null?void 0:n.init)==null||o.call(n,r,s.backend,s)}queueLoad(e,t,r,s){const n={},o={},a={},l={};return e.forEach(u=>{let c=!0;t.forEach(h=>{const d=`${u}|${h}`;!r.reload&&this.store.hasResourceBundle(u,h)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?o[d]===void 0&&(o[d]=!0):(this.state[d]=1,c=!1,o[d]===void 0&&(o[d]=!0),n[d]===void 0&&(n[d]=!0),l[h]===void 0&&(l[h]=!0)))}),c||(a[u]=!0)}),(Object.keys(n).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(l)}}loaded(e,t,r){const s=e.split("|"),n=s[0],o=s[1];t&&this.emit("failedLoading",n,o,t),!t&&r&&this.store.addResourceBundle(n,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const a={};this.queue.forEach(l=>{gc(l.loaded,[n],o),Tc(l,e),t&&l.errors.push(t),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{a[u]||(a[u]={});const c=l.loaded[u];c.length&&c.forEach(h=>{a[u][h]===void 0&&(a[u][h]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(l=>!l.done)}read(e,t,r,s=0,n=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:r,tried:s,wait:n,callback:o});return}this.readingCalls++;const a=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const h=this.waitingReads.shift();this.read(h.lng,h.ns,h.fcName,h.tried,h.wait,h.callback)}if(u&&c&&s{this.read(e,t,r,s+1,n*2,o)},n);return}o(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(e,t);u&&typeof u.then=="function"?u.then(c=>a(null,c)).catch(a):a(null,u)}catch(u){a(u)}return}return l(e,t,a)}prepareLoading(e,t,r={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();V(e)&&(e=this.languageUtils.toResolveHierarchy(e)),V(t)&&(t=[t]);const n=this.queueLoad(e,t,r,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach(o=>{this.loadOne(o)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),s=r[0],n=r[1];this.read(s,n,"read",void 0,void 0,(o,a)=>{o&&this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`,o),!o&&a&&this.logger.log(`${t}loaded namespace ${n} for language ${s}`,a),this.loaded(e,o,a)})}saveMissing(e,t,r,s,n,o={},a=()=>{}){var l,u,c,h,d;if((u=(l=this.services)==null?void 0:l.utils)!=null&&u.hasLoadedNamespace&&!((h=(c=this.services)==null?void 0:c.utils)!=null&&h.hasLoadedNamespace(t))){this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((d=this.backend)!=null&&d.create){const f={...o,isUpdate:n},p=this.backend.create.bind(this.backend);if(p.length<6)try{let g;p.length===5?g=p(e,t,r,s,f):g=p(e,t,r,s),g&&typeof g.then=="function"?g.then(P=>a(null,P)).catch(a):a(null,g)}catch(g){a(g)}else p(e,t,r,s,a,f)}!e||!e[0]||this.store.addResource(e[0],t,r,s)}}}const ds=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let e={};if(typeof i[1]=="object"&&(e=i[1]),V(i[1])&&(e.defaultValue=i[1]),V(i[2])&&(e.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const t=i[3]||i[2];Object.keys(t).forEach(r=>{e[r]=t[r]})}return e},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),da=i=>(V(i.ns)&&(i.ns=[i.ns]),V(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),V(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs&&!i.supportedLngs.includes("cimode")&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),i),qi=()=>{},Cc=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(t=>{typeof i[t]=="function"&&(i[t]=i[t].bind(i))})};class ti extends Ui{constructor(e={},t){if(super(),this.options=da(e),this.services={},this.logger=Ce,this.modules={external:[]},Cc(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e=="function"&&(t=e,e={}),e.defaultNS==null&&e.ns&&(V(e.ns)?e.defaultNS=e.ns:e.ns.includes("translation")||(e.defaultNS=e.ns[0]));const r=ds();this.options={...r,...this.options,...da(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Ce.init(s(this.modules.logger),this.options):Ce.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=Rc;const c=new oa(this.options);this.store=new ra(this.options.resources,this.options);const h=this.services;h.logger=Ce,h.resourceStore=this.store,h.languageUtils=c,h.pluralResolver=new kc(c,{prepend:this.options.pluralSeparator}),u&&(h.formatter=s(u),h.formatter.init&&h.formatter.init(h,this.options),this.options.interpolation.format=h.formatter.format.bind(h.formatter)),h.interpolator=new ca(this.options),h.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},h.backendConnector=new Ic(s(this.modules.backend),h.resourceStore,h,this.options),h.backendConnector.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.languageDetector&&(h.languageDetector=s(this.modules.languageDetector),h.languageDetector.init&&h.languageDetector.init(h,this.options.detection,this.options)),this.modules.i18nFormat&&(h.i18nFormat=s(this.modules.i18nFormat),h.i18nFormat.init&&h.i18nFormat.init(this)),this.translator=new Vi(this.services,this.options),this.translator.on("*",(d,...f)=>{this.emit(d,...f)}),this.modules.external.forEach(d=>{d.init&&d.init(this)})}if(this.format=this.options.interpolation.format,t||(t=qi),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...c)=>this.store[u](...c)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...c)=>(this.store[u](...c),this)});const a=Zt(),l=()=>{const u=(c,h)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),a.resolve(h),t(c,h)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),a}loadResources(e,t=qi){var n,o;let r=t;const s=V(e)?e:this.language;if(typeof e=="function"&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if((s==null?void 0:s.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const a=[],l=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(h=>{h!=="cimode"&&(a.includes(h)||a.push(h))})};s?l(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>l(c)),(o=(n=this.options.preload)==null?void 0:n.forEach)==null||o.call(n,u=>l(u)),this.services.backendConnector.load(a,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(e,t,r){const s=Zt();return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=qi),this.services.backendConnector.reload(e,t,n=>{s.resolve(),r(n)}),s}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return e.type==="backend"&&(this.modules.backend=e),(e.type==="logger"||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type==="languageDetector"&&(this.modules.languageDetector=e),e.type==="i18nFormat"&&(this.modules.i18nFormat=e),e.type==="postProcessor"&&sa.addPostProcessor(e),e.type==="formatter"&&(this.modules.formatter=e),e.type==="3rdParty"&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&!["cimode","dev"].includes(e)){for(let t=0;t{this.language=a,this.languages=this.services.languageUtils.toResolveHierarchy(a),this.resolvedLanguage=void 0,this.setResolvedLanguage(a)},n=(a,l)=>{l?this.isLanguageChangingTo===e&&(s(l),this.translator.changeLanguage(l),this.isLanguageChangingTo=void 0,this.emit("languageChanged",l),this.logger.log("languageChanged",l)):this.isLanguageChangingTo=void 0,r.resolve((...u)=>this.t(...u)),t&&t(a,(...u)=>this.t(...u))},o=a=>{var c,h;!e&&!a&&this.services.languageDetector&&(a=[]);const l=V(a)?a:a&&a[0],u=this.store.hasLanguageSomeTranslations(l)?l:this.services.languageUtils.getBestMatchFromCodes(V(a)?[a]:a);u&&(this.language||s(u),this.translator.language||this.translator.changeLanguage(u),(h=(c=this.services.languageDetector)==null?void 0:c.cacheUserLanguage)==null||h.call(c,u)),this.loadResources(u,d=>{n(d,u)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?o(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e),r}getFixedT(e,t,r){const s=(n,o,...a)=>{let l;typeof o!="object"?l=this.options.overloadTranslationOptionHandler([n,o].concat(a)):l={...o},l.lng=l.lng||s.lng,l.lngs=l.lngs||s.lngs,l.ns=l.ns||s.ns,l.keyPrefix!==""&&(l.keyPrefix=l.keyPrefix||r||s.keyPrefix);const u={...this.options,...l};typeof l.keyPrefix=="function"&&(l.keyPrefix=xt(l.keyPrefix,u));const c=this.options.keySeparator||".";let h;return l.keyPrefix&&Array.isArray(n)?h=n.map(d=>(typeof d=="function"&&(d=xt(d,u)),`${l.keyPrefix}${c}${d}`)):(typeof n=="function"&&(n=xt(n,u)),h=l.keyPrefix?`${l.keyPrefix}${c}${n}`:n),this.t(h,l)};return V(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=r,s}t(...e){var t;return(t=this.translator)==null?void 0:t.translate(...e)}exists(...e){var t;return(t=this.translator)==null?void 0:t.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,n=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(a,l)=>{const u=this.services.backendConnector.state[`${a}|${l}`];return u===-1||u===0||u===2};if(t.precheck){const a=t.precheck(this,o);if(a!==void 0)return a}return!!(this.hasResourceBundle(r,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,e)&&(!s||o(n,e)))}loadNamespaces(e,t){const r=Zt();return this.options.ns?(V(e)&&(e=[e]),e.forEach(s=>{this.options.ns.includes(s)||this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),t&&t(s)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=Zt();V(e)&&(e=[e]);const s=this.options.preload||[],n=e.filter(o=>!s.includes(o)&&this.services.languageUtils.isSupportedCode(o));return n.length?(this.options.preload=s.concat(n),this.loadResources(o=>{r.resolve(),t&&t(o)}),r):(t&&t(),Promise.resolve())}dir(e){var s,n;if(e||(e=this.resolvedLanguage||(((s=this.languages)==null?void 0:s.length)>0?this.languages[0]:this.language)),!e)return"rtl";try{const o=new Intl.Locale(e);if(o&&o.getTextInfo){const a=o.getTextInfo();if(a&&a.direction)return a.direction}}catch{}const t=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((n=this.services)==null?void 0:n.languageUtils)||new oa(ds());return e.toLowerCase().indexOf("-latn")>1?"ltr":t.includes(r.getLanguagePartFromCode(e))||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){const r=new ti(e,t);return r.createInstance=ti.createInstance,r}cloneInstance(e={},t=qi){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const s={...this.options,...e,isClone:!0},n=new ti(s);if((e.debug!==void 0||e.prefix!==void 0)&&(n.logger=n.logger.clone(e)),["store","services","language"].forEach(a=>{n[a]=this[a]}),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},r){const a=Object.keys(this.store.data).reduce((l,u)=>(l[u]={...this.store.data[u]},l[u]=Object.keys(l[u]).reduce((c,h)=>(c[h]={...l[u][h]},c),l[u]),l),{});n.store=new ra(a,s),n.services.resourceStore=n.store}if(e.interpolation){const l={...ds().interpolation,...this.options.interpolation,...e.interpolation},u={...s,interpolation:l};n.services.interpolator=new ca(u)}return n.translator=new Vi(n.services,s),n.translator.on("*",(a,...l)=>{n.emit(a,...l)}),n.init(s,t),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const he=ti.createInstance();he.createInstance,he.dir,he.init,he.loadResources,he.reloadResources,he.use,he.changeLanguage,he.getFixedT,he.t,he.exists,he.setDefaultNamespace,he.hasLoadedNamespace,he.loadNamespaces,he.loadLanguages;var Bi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $c(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}const Fc=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Lc={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Ac=i=>Lc[i];let fa={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:i=>i.replace(Fc,Ac),transDefaultProps:void 0};const Mc=(i={})=>{fa={...fa,...i}},jc={type:"3rdParty",init(i){Mc(i.options.react)}};function fs(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ii(i){"@babel/helpers - typeof";return ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ii(i)}function Dc(i,e){if(ii(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(ii(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function pa(i){var e=Dc(i,"string");return ii(e)=="symbol"?e:e+""}function Nc(i,e){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};fs(this,i),this.backends=[],this.type="backend",this.allOptions=r,this.init(e,t)}return ps(i,[{key:"init",value:function(t){var r=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=Vc(s,this.options||{},Bc()),this.allOptions=n,this.options.backends&&this.options.backends.length>1&&(this.allOptions.saveMissing||this.allOptions.updateMissing)&&this.services&&this.services.logger&&this.services.logger.warn("i18next-chained-backend: Using multiple backends in combination with saveMissing/updateMissing is not recommended, as it may trigger based on stale data."),this.options.backends&&this.options.backends.forEach(function(o,a){r.backends[a]=r.backends[a]||qc(o),r.backends[a].init(t,r.options.backendOptions&&r.options.backendOptions[a]||{},n)}),this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"read",value:function(t,r,s){var n=this,o=this.backends.length,a=function(c){if(c>=o)return s(new Error("non of the backend loaded data",!0));var h=c===o-1,d=n.options.handleEmptyResourcesAsFailed&&!h?0:-1,f=n.backends[c];f.read?va(f,t,r,function(p,g,P){if(!p&&g&&Object.keys(g).length>d){if(s(null,g,c),l(c-1,g),f.save&&n.options.cacheHitMode&&["refresh","refreshAndUpdateStore"].indexOf(n.options.cacheHitMode)>-1){if(P&&n.options.refreshExpirationTime&&P+n.options.refreshExpirationTime>Date.now())return;var S=n.backends[c+1];S&&S.read&&va(S,t,r,function(F,C){F||C&&(Object.keys(C).length<=d||(l(c,C),n.options.cacheHitMode==="refreshAndUpdateStore"&&n.services&&n.services.resourceStore&&n.services.resourceStore.addResourceBundle(t,r,C)))})}}else a(c+1)}):a(c+1)},l=function(c,h){if(!(c<0)){var d=n.backends[c];d.save&&d.save(t,r,h),l(c-1,h)}};a(0)}},{key:"create",value:function(t,r,s,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){},a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};this.backends.forEach(function(l){if(l.create){var u=l.create.bind(l);if(u.length<6){try{var c;u.length===5?c=u(t,r,s,n,a):c=u(t,r,s,n),c&&typeof c.then=="function"?c.then(function(h){return o(null,h)}).catch(o):o(null,c)}catch(h){o(h)}return}u(t,r,s,n,o,a)}})}},{key:"reload",value:function(){var t=this,r=this.services,s=r.backendConnector,n=r.languageUtils,o=r.logger,a=s.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(h){var d=n.toResolveHierarchy(h);d.forEach(function(f){l.indexOf(f)<0&&l.push(f)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){t.allOptions.ns.forEach(function(h){s.read(c,h,"read",null,null,function(d,f){d&&o.warn("loading namespace ".concat(h," for language ").concat(c," failed"),d),!d&&f&&o.log("loaded namespace ".concat(h," for language ").concat(c),f),s.loaded("".concat(c,"|").concat(h),d,f)})})})}}}])})();_a.type="backend";function Wc(i,e,t){return(e=pa(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ma(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function gs(i){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};fs(this,i),this.init(e,t),this.type="backend"}return ps(i,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.services=t,this.options=gs(gs(gs({},Xc()),this.options),r),this.storage=new zc(this.options)}},{key:"read",value:function(t,r,s){var n=Date.now();if(!this.storage.store)return s(null,null);var o=this.storage.getItem("".concat(this.options.prefix).concat(t,"-").concat(r));if(o){o=JSON.parse(o);var a=this.getVersion(t,r);if(o.i18nStamp&&o.i18nStamp+this.options.expirationTime>n&&a===o.i18nVersion){var l=o.i18nStamp;return delete o.i18nVersion,delete o.i18nStamp,s(null,o,l)}}return s(null,null)}},{key:"save",value:function(t,r,s){if(this.storage.store){s.i18nStamp=Date.now();var n=this.getVersion(t,r);n&&(s.i18nVersion=n),this.storage.setItem("".concat(this.options.prefix).concat(t,"-").concat(r),JSON.stringify(s))}}},{key:"getVersion",value:function(t,r){var s,n;return((s=(n=this.options).getVersion)===null||s===void 0?void 0:s.call(n,t,r))||this.options.versions[t]||this.options.defaultVersion}}])})();ya.type="backend";function Gc(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Kc(i))||e){t&&(i=t);var r=0,s=function(){};return{s,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var u=t.next();return o=u.done,u},e:function(u){a=!0,n=u},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw n}}}}function Kc(i,e){if(i){if(typeof i=="string")return ba(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ba(i,e):void 0}}function ba(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=Array(e);t128||wa.indexOf(i)>-1||i.indexOf("..")>-1||i.indexOf("/")>-1||i.indexOf("\\")>-1||/[?#%\s@]/.test(i)||/[\x00-\x1F\x7F]/.test(i))}function Wi(i){return typeof i!="string"?i:i.replace(/[\r\n\x00-\x1F\x7F]/g," ")}function Yc(i){if(typeof i!="string"||i.length===0)return i;try{var e=new URL(i);return e.username||e.password?(e.username="",e.password="",e.toString()):i}catch{return i.replace(/(\/\/)[^/@\s]+@/g,"$1")}}function xa(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":vs(XMLHttpRequest))==="object"}function Zc(i){return!!i&&typeof i.then=="function"}function Qc(i){return Zc(i)?i:Promise.resolve(i)}var eh=/\{\{(.+?)\}\}/g;function Sa(i,e){var t=!1,r=i.replace(eh,function(s,n){var o=n.trim();if(wa.indexOf(o)>-1)return s;var a=e[o];if(a==null)return s;var l=String(a).split("+"),u=Gc(l),c;try{for(u.s();!(c=u.n()).done;){var h=c.value;if(!Jc(h))return t=!0,s}}catch(d){u.e(d)}finally{u.f()}return l.join("+")});return t?null:r}const Dh="modulepreload",Nh=function(i){return"/"+i},Hh={},th=function(e,t,r){let s=Promise.resolve();function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return e().catch(n)})};function Ea(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function ka(i){for(var e=1;ePromise.resolve().then(()=>Ch),void 0).then(function(i){Be=i.default}).catch(function(){})}catch{}var Pa=["__proto__","constructor","prototype"],_s=function(e,t){if(t&&it(t)==="object"){for(var r="",s=0,n=Object.keys(t);s-1||(r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(t[o]))}if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},Oa=function(e,t,r,s){var n=function(l){if(!l.ok)return r(l.statusText||"Error",{status:l.status});l.text().then(function(u){r(null,{status:l.status,data:u})}).catch(r)};if(s){var o=s(e,t);if(o instanceof Promise){o.then(n).catch(r);return}}typeof fetch=="function"?fetch(e,t).then(n).catch(r):Be(e,t).then(n).catch(r)},nh=function(e,t,r,s){e.queryStringParams&&(t=_s(t,e.queryStringParams));var n=ka({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(n["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(n["Content-Type"]="application/json");var o=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,a=ka({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:n},e._omitFetchOptions?{}:o),l=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Oa(t,a,s,l)}catch(u){if(!o||Object.keys(o).length===0||!u.message||u.message.indexOf("not implemented")<0)return s(u);try{Object.keys(o).forEach(function(c){delete a[c]}),Oa(t,a,s,l),e._omitFetchOptions=!0}catch(c){s(c)}}},oh=function(e,t,r,s){r&&it(r)==="object"&&(r=_s("",r).slice(1)),e.queryStringParams&&(t=_s(t,e.queryStringParams));try{var n=ri?new ri:new zi("MSXML2.XMLHTTP.3.0");n.open(r?"POST":"GET",t,1),e.crossDomain||n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.withCredentials=!!e.withCredentials,r&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.overrideMimeType&&n.overrideMimeType("application/json");var o=e.customHeaders;if(o=typeof o=="function"?o():o,o)for(var a=0,l=Object.keys(o);a-1||n.setRequestHeader(u,o[u])}n.onreadystatechange=function(){n.readyState>3&&s(n.status>=400?n.statusText:null,{status:n.status,data:n.responseText})},n.send(r)}catch(c){console&&console.log(c)}},ah=function(e,t,r,s){if(typeof r=="function"&&(s=r,r=void 0),s=s||function(){},Be&&t.indexOf("file:")!==0)return nh(e,t,r,s);if(xa()||typeof ActiveXObject=="function")return oh(e,t,r,s);s(new Error("No fetch and no xhr implementation found!"))};function St(i){"@babel/helpers - typeof";return St=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},St(i)}function Ra(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function ms(i){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};lh(this,i),this.services=e,this.options=t,this.allOptions=r,this.type="backend",this.init(e,t,r)}return ch(i,[{key:"init",value:function(t){var r=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=t,this.options=ms(ms(ms({},dh()),this.options||{}),s),this.allOptions=n,this.services&&this.options.reloadInterval){var o=setInterval(function(){return r.reload()},this.options.reloadInterval);St(o)==="object"&&typeof o.unref=="function"&&o.unref()}}},{key:"readMulti",value:function(t,r,s){this._readAny(t,t,r,r,s)}},{key:"read",value:function(t,r,s){this._readAny([t],t,[r],r,s)}},{key:"_readAny",value:function(t,r,s,n,o){var a=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(t,s)),l=Qc(l),l.then(function(u){if(!u)return o(null,{});var c=Sa(u,{lng:t.join("+"),ns:s.join("+")});if(c==null){var h=t.map(Wi).join(", "),d=s.map(Wi).join(", ");return o(new Error("i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=["+h+"] namespaces=["+d+"]"),!1)}a.loadUrl(c,o,r,n)})}},{key:"loadUrl",value:function(t,r,s,n){var o=this,a=typeof s=="string"?[s]:s,l=typeof n=="string"?[n]:n,u=this.options.parseLoadPayload(a,l),c=Wi(Yc(t));this.options.request(this.options,t,u,function(h,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+c+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+c+"; status code: "+d.status,!1);if(!d&&h&&h.message){var f=h.message.toLowerCase(),p=["failed","fetch","network","load"].find(function(S){return f.indexOf(S)>-1});if(p)return r("failed loading "+c+": "+Wi(h.message),!0)}if(h)return r(h,!1);var g,P;try{typeof d.data=="string"?g=o.options.parse(d.data,s,n):g=d.data}catch{P="failed parsing "+c+" to json"}if(P)return r(P,!1);r(null,g)})}},{key:"create",value:function(t,r,s,n,o){var a=this;if(this.options.addPath){typeof t=="string"&&(t=[t]);var l=this.options.parsePayload(r,s,n),u=0,c=[],h=[];t.forEach(function(d){var f=a.options.addPath;typeof a.options.addPath=="function"&&(f=a.options.addPath(d,r));var p=Sa(f,{lng:d,ns:r});if(p==null){u+=1,o&&u===t.length&&o(c,h);return}a.options.request(a.options,p,l,function(g,P){u+=1,c.push(g),h.push(P),u===t.length&&typeof o=="function"&&o(c,h)})})}}},{key:"reload",value:function(){var t=this,r=this.services,s=r.backendConnector,n=r.languageUtils,o=r.logger,a=s.language;if(!(a&&a.toLowerCase()==="cimode")){var l=[],u=function(h){var d=n.toResolveHierarchy(h);d.forEach(function(f){l.indexOf(f)<0&&l.push(f)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){t.allOptions.ns.forEach(function(h){s.read(c,h,"read",null,null,function(d,f){d&&o.warn("loading namespace ".concat(h," for language ").concat(c," failed"),d),!d&&f&&o.log("loaded namespace ".concat(h," for language ").concat(c),f),s.loaded("".concat(c,"|").concat(h),d,f)})})})}}}])})();Ca.type="backend";const ys=["ar","cs_CZ","da_DK","de_DE","el","en","es_ES","es_MX","fi","fr_FR","he_IL","hi_IN","hu_HU","id_ID","it_IT","ja","ko_KR","nb_NO","nl_NL","pl_PL","pt_BR","pt_PT","ro_RO","ru_RU","sv_SE","th","tr_TR","uk","vi","zh_CN","zh_TW"];function fh(i){if(!i)return i;const e=i.replace(/-/g,"_"),t=ys.find(s=>s.toLowerCase()===e.toLowerCase());if(t)return t;const r=e.split("_")[0].toLowerCase();return ys.includes(r)?r:ys.find(s=>s.toLowerCase().split("_")[0]===r)??i}const ph={get_pro:"Get Pro",price_both:"{annual}/yr · {lifetime} lifetime",price_annual_only:"{annual}/year",proof_chip_line:`stores run WooCommerce POS on WordPress.org since May 2014`,reviews_heading:"From the WordPress.org reviews",translated_from_french:"translated from French",read_on_wporg:"Read on WordPress.org →",review_cta_line:"Running your shop on the free register? A review helps other store owners find it.",review_cta_link:"Leave a review on WordPress.org →",roadmap_title:"What I'm building",roadmap_subtitle:"See the live board →",roadmap_done:"DONE",roadmap_next:"NEXT",roadmap_listen:"Pro users shape the priorities. There's no ticket queue — you tell me what your shop needs on Discord, and it shapes this list.",fair_licence:"If you stop paying, Pro keeps working. Updates and support stop.",error_something_wrong:"Something went wrong: <1>{message}",pro_active_thanks:"You're on Pro — thank you for keeping this project going."},bs="wp-admin-landing-shared";function gh(){var e;const i=((e=et())==null?void 0:e.locale)??"en_US";return he.use(_a).use(jc).init({lng:i,fallbackLng:"en_US",load:"currentOnly",ns:[bs],defaultNS:bs,keySeparator:!1,nsSeparator:!1,interpolation:{prefix:"{",suffix:"}"},react:{useSuspense:!1},partialBundledLanguages:!0,resources:{en_US:{[bs]:ph}},backend:{backends:[ya,Ca],backendOptions:[{prefix:"wcpos_i18n_",expirationTime:10080*60*1e3},{loadPath:(t,r)=>`https://cdn.jsdelivr.net/gh/wcpos/wp-admin-landing@v2/src/translations/${fh(t[0])}/${r[0]}.json`}]}}),he}function vh(){var e;const i=et();!(i!=null&&i.profile)||!((e=i==null?void 0:i.updates_server)!=null&&e.profile_url)||fetch(i.updates_server.profile_url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i.profile,locale:i.locale,plugin_version:i.plugin_version,pro_active:i.pro_active})}).catch(()=>{})}function _h(i){const e=window;e.wcpos=e.wcpos??{},e.wcpos.landingRuntime=i}const mh=168*3600*1e3;function $a(i){const{flagValue:e,cached:t,anonId:r,schemaVersion:s,now:n,validVariants:o,killSwitch:a,proActive:l,fallbackVariant:u}=i;return a||l?{variant:u,renderSource:"fallback",cache:!1}:e&&o.includes(e)?{variant:e,renderSource:"flag",cache:!0}:t&&o.includes(t.variant)&&t.anonId===(r??"no-anon")&&t.schemaVersion===s&&n-t.ts<=mh?{variant:t.variant,renderSource:"cache",cache:!1}:{variant:u,renderSource:"fallback",cache:!1}}function ws(i,e,t,r){var a;const s=t[i];if(!e||typeof e!="object")return s;const n=e;if(typeof n.asset_version!="number"||n.asset_version"u")return os;const e=(i=document.currentScript)==null?void 0:i.src,t=Array.from(document.querySelectorAll("script[src]")).map(s=>s.src).find(s=>/\/welcome\.js(\?|$)/.test(s)),r=e&&/\/welcome\.js(\?|$)/.test(e)?e:t;if(r){const s=r.replace(/\/js\/welcome\.js(\?.*)?$/,"");if(s!==r)return s}}catch{}return os}const Xi=yh(),ks={indie:{js:`${Xi}/js/variants/indie.js`,css:`${Xi}/css/variants/indie.css`},"free-plus":{js:`${Xi}/js/variants/free-plus.js`,css:`${Xi}/css/variants/free-plus.css`}};function bh(){try{const i=window.localStorage.getItem(Es);return i?JSON.parse(i):null}catch{return null}}function wh(i,e){try{window.localStorage.setItem(Es,JSON.stringify({variant:i,anonId:e??"no-anon",schemaVersion:Jt,ts:Date.now()}))}catch{}}function Aa(){try{window.localStorage.removeItem(Es)}catch{}}function xh(i){try{i.getFeatureFlag(xs);const e=i.getFeatureFlag(Ss,{send_event:!1});(e===!0||e==="on")&&Aa()}catch{}}function Sh(i){let e,t=!1;e=i.onFeatureFlags(()=>{t=!0;const r=i.getFeatureFlag(Ss,{send_event:!1});(r===!0||r==="on")&&Aa(),e==null||e()}),t&&e()}function Eh(i,e=500){return new Promise(t=>{let r=!1;const s=setTimeout(()=>{r=!0,t({flagValue:void 0,killSwitch:!1,payload:null})},e);let n,o=!1;n=i.onFeatureFlags(()=>{o=!0;const a=i.getFeatureFlag(xs);if(n==null||n(),r)return;clearTimeout(s),r=!0;const l=i.getFeatureFlag(Ss,{send_event:!1});t({flagValue:a,killSwitch:l===!0||l==="on",payload:i.getFeatureFlagPayload(xs)})}),o&&n()})}async function kh(i,e,t){const r=bh(),s=$a({flagValue:void 0,cached:r,anonId:e,schemaVersion:Jt,now:Date.now(),validVariants:La,killSwitch:!1,proActive:t,fallbackVariant:Fa});if(t)return{variant:s.variant,renderSource:"fallback",assets:ws(s.variant,null,ks,Yt)};if(s.renderSource==="cache")return xh(i),Sh(i),{variant:s.variant,renderSource:"cache",assets:ws(s.variant,null,ks,Yt)};const{flagValue:n,killSwitch:o,payload:a}=await Eh(i),l=$a({flagValue:n,cached:r,anonId:e,schemaVersion:Jt,now:Date.now(),validVariants:La,killSwitch:o,proActive:t,fallbackVariant:Fa});l.cache&&wh(l.variant,e);const u=ws(l.variant,a,ks,Yt);return{variant:l.variant,renderSource:l.renderSource,assets:u}}function Ph(i){return new Promise((e,t)=>{const r=document.createElement("link");r.rel="stylesheet",r.href=i.css,document.head.appendChild(r);const s=document.createElement("script");s.src=i.js,s.async=!0;const n=setTimeout(()=>t(new Error(`variant chunk timeout: ${i.js}`)),1e4);s.onload=()=>{clearTimeout(n),e()},s.onerror=()=>{clearTimeout(n),t(new Error(`variant chunk failed: ${i.js}`))},document.head.appendChild(s)})}const We=(i,e="14px",t="")=>`
`;function Oh(i){i.innerHTML=`