1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="0d0ad255-1293-b592-24ef-1fbe06b5e3dd")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,636319,e=>{"use strict";let t="/api/dev/analytics-log";e.s(["logAnalyticsEvent",0,function(e,r,i,n){if(function(){try{return"1"===localStorage.getItem("amp_debug_log")}catch{return!1}}())try{let s=r??{},o={...n,ts:new Date().toISOString(),event_type:e,enriched:i,client_product:s.client_product,tab_session_id:s.tab_session_id,app_visible:s.app_visible,currentView:s.currentView,previousView:s.previousView,tab:s.tab,sub_tab:s.sub_tab,botJID:s.botJID,energyBalance:s.energyBalance,requestId:s.requestId,messageId:s.messageId,reason:s.reason,prop_keys:Object.keys(s).sort()},a=JSON.stringify(o);navigator.sendBeacon?navigator.sendBeacon(t,a):fetch(t,{method:"POST",body:a,keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(()=>void 0)}catch{}}])},255734,e=>{"use strict";e.i(350461);var t,r,i,n="u">typeof window?window:void 0,s="u">typeof globalThis?globalThis:n;"u"<typeof self&&(s.self=s),"u"<typeof File&&(s.File=function(){});var o=null==s?void 0:s.navigator,a=null==s?void 0:s.document,l=null==s?void 0:s.location,u=null==s?void 0:s.fetch,c=null!=s&&s.XMLHttpRequest&&"withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:void 0,d=null==s?void 0:s.AbortController,h=null==s?void 0:s.CompressionStream,p=null==o?void 0:o.userAgent,f=null!=n?n:{};function v(){return!(!n||!1===n.navigator.onLine)}var g="1.399.0",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"web",JS_SDK_VERSION:g};function _(e,t,r,i,n,s,o){try{var a=e[s](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,n)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var s=e.apply(t,r);function o(e){_(s,i,n,o,a,"next",e)}function a(e){_(s,i,n,o,a,"throw",e)}o(void 0)})}}function b(){return(b=Object.assign.bind()).apply(null,arguments)}function w(e,t){if(null==e)return{};var r={};for(var i in e)if(({}).hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}var S=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function E(e){return"string"==typeof e||e}function k(e){return"string"==typeof e?e:void 0}var x,P,T,I,A=((x={}).AnonymousId="anonymous_id",x.DistinctId="distinct_id",x.Props="props",x.EnablePersonProcessing="enable_person_processing",x.PersonMode="person_mode",x.FeatureFlagDetails="feature_flag_details",x.FeatureFlags="feature_flags",x.FeatureFlagPayloads="feature_flag_payloads",x.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",x.BootstrapFeatureFlags="bootstrap_feature_flags",x.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",x.OverrideFeatureFlags="override_feature_flags",x.Queue="queue",x.LogsQueue="logs_queue",x.OptedOut="opted_out",x.SessionId="session_id",x.SessionStartTimestamp="session_start_timestamp",x.SessionLastTimestamp="session_timestamp",x.PersonProperties="person_properties",x.GroupProperties="group_properties",x.InstalledAppBuild="installed_app_build",x.InstalledAppVersion="installed_app_version",x.SessionReplay="session_replay",x.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",x.SurveyLastSeenDate="survey_last_seen_date",x.SurveysSeen="surveys_seen",x.Surveys="surveys",x.RemoteConfig="remote_config",x.FlagsEndpointWasHit="flags_endpoint_was_hit",x.DeviceId="device_id",x),O=((P={}).GZipJS="gzip-js",P.Base64="base64",P),C=["$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"],R=["token"],F="NativeGzipValidationError",L=e=>e.length>=2&&31===e[0]&&139===e[1],M=(e,t)=>e===O.GZipJS||t===O.GZipJS||"gzip"===t,D=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),N=e=>
2{var t=Error("Native gzip produced invalid output: "+e);throw t.name=F,t},$=(T=y(function*(e,t){18>e.size&&N("too-short");var r=new Uint8Array((yield e.slice(0,10).arrayBuffer()));L(r)&&8===r[2]||N("invalid-header");var i=new DataView((yield e.slice(e.size-8).arrayBuffer()));i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(I)return I;I=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?0xedb88320^t>>>1:t>>>1;I[e]=t>>>0}return I})(),r=0xffffffff,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(0xffffffff^r)>>>0})(t)&&N("invalid-crc");var n=t.length>>>0;i.getUint32(4,!0)!==n&&N("invalid-size")}),function(e,t){return T.apply(this,arguments)});function j(){return(j=y(function*(e,t,r){void 0===t&&(t=!0);try{var i,n=(new TextEncoder).encode(e),s=new CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((i=y(function*(e){try{yield o.abort(e)}catch(e){}throw e}),function(e){return i.apply(this,arguments)})),l=new Response(s.readable).blob(),[u]=yield Promise.all([l,a]);return yield $(u,n),u}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var U=["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"],q=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return U.concat(t).some(e=>{var t=e.toLowerCase();return -1!==r.indexOf(t)})};function B(e,t){return -1!==e.indexOf(t)}var V=function(e){return e.trim()},z=function(e){return e.replace(/^\$/,"")},H=Object.prototype,W=H.hasOwnProperty,G=H.toString,J=Array.isArray||function(e){return"[object Array]"===G.call(e)},K=e=>"function"==typeof e,Y=e=>e===Object(e)&&!J(e),Q=e=>{if(Y(e)){for(var t in e)if(W.call(e,t))return!1;return!0}return!1},X=e=>void 0===e,Z=e=>"[object String]"==G.call(e),ee=e=>Z(e)&&0===e.trim().length,et=e=>null===e,er=e=>X(e)||et(e),ei=e=>"[object Number]"==G.call(e)&&e==e,en=e=>ei(e)&&e>0,es=e=>"[object Boolean]"===G.call(e),eo=e=>B(C,e),ea=e=>B(R,e);function el(e){return null===e||"object"!=typeof e}function eu(e,t){return({}).toString.call(e)==="[object "+t+"]"}function ec(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ed=[!0,"true",1,"1","yes"],eh=[!1,"false",0,"0","no"];function ep(e,t,r,i,n){return t>r&&(i.warn("min cannot be greater than max."),t=r),ei(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+n),ep(n||r,t,r,i))}class ef{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=ep(e.bucketSize,0,100,e.Ae),this.De=ep(e.refillRate,0,this.Fe,e.Ae),this.$e=ep(e.refillInterval,0,864e5,e.Ae)}Ne(e,t){var r=Math.floor((t-e.lastAccess)/this.$e);r>0&&(e.tokens=Math.min(e.tokens+r*this.De,this.Fe),e.lastAccess=e.lastAccess+r*this.$e)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),n=this.Ee[i];return n?this.Ne(n,r):this.Ee[i]=n={tokens:this.Fe,lastAccess:r},0===n.tokens||(n.tokens--,0===n.tokens&&(null==(t=this.Pe)||t.call(this,e)),0===n.tokens)}stop(){this.Ee={}}}var ev="Mobile",eg="Android",em="Tablet",e_=eg+" "+em,ey="iPad",eb="Apple",ew=eb+" Watch",eS="Safari",eE="BlackBerry",ek="Samsung",ex=ek+"Browser",eP=ek+" Internet",eT="Chrome",eI=eT+" OS",eA=eT+" iOS",eO="Internet Explorer",eC=eO+" "+ev,eR="Opera",eF=eR+" Mini",eL="Edge",eM="Microsoft "+eL,eD="Firefox",eN=eD+" iOS",e$="Nintendo",ej="PlayStation",eU="Xbox",eq=eg+" "+ev,eB=ev+" "+eS,eV="Windows",ez=eV+" Phone",eH="Nokia",eW="Ouya",eG="Generic",eJ=eG+" "+ev.toLowerCase(),eK=eG+" "+em.toLowerCase(),eY="Konqueror",eQ="Oculus Browser",eX="Vivaldi",eZ="Yandex",e0="Whale",e1="DuckDuckGo",e2="Pale Moon",e3="Waterfox",e4="Brave",e5="Google Search App",e6="(\\d+(\\.\\d+)?)",e8=RegExp("Version/"+e6),e7=RegExp(eU,"i"),e9=RegExp(ej+" \\w+","i"),te=RegExp(e$+" \\w+","i"),tt=RegExp(eE+"|PlayBook|BB10","i"),tr={"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"},ti=function(e,t,r,i){var n;return t=t||"",(null!=r&&r.brave?e4:null)||(null!=i&&i.detectGoogleSearchApp&&B(e,"GSA/")?e5:B(e," OPR/")&&B(e,"Mini")?eF:B(e," OPR/")?eR:tt.test(e)?eE:B(e,"IE"+ev)||B(e,"WPDesktop")?eC:B(e,"OculusBrowser")?eQ:B(e,ex)?eP:B(e,eL)||B(e,"Edg/")?eM:B(e,eX+"/")?eX:B(e,"YaBrowser/")?eZ:B(e,e0+"/")?e0:B(e,e1+"/")||B(e,"Ddg/")?e1:B(e,"FBIOS")?"Facebook "+ev:B(e,"UCWEB")||B(e,"UCBrowser")?"UC Browser":B(e,"CriOS")?eA:B(e,"CrMo")||B(e,eT)?eT:B(e,eg)&&B(e,eS)?eq:B(e,"FxiOS")?eN:B(e.toLowerCase(),eY.toLowerCase())?eY:B(e,e4+"/")?e4:(n=t)&&B(n,eb)||B(e,eS)&&!B(e,eT)&&!B(e,eg)?B(e,ev)?eB:eS:B(e,"PaleMoon/")?e2:B(e,e3+"/")?e3:B(e,eD)?eD:B(e,"MSIE")||B(e,"Trident/")?eO:B(e,"Gecko")?eD:"")},tn={[eC]:[RegExp("rv:"+e6)],[eM]:[RegExp(eL+"?\\/"+e6)],[eT]:[RegExp("("+eT+"|CrMo)\\/"+e6)],[eA]:[RegExp("CriOS\\/"+e6)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+e6)],[eS]:[e8],[eB]:[e8],[eR]:[RegExp("(Opera|OPR)\\/"+e6)],[eD]:[RegExp(eD+"\\/"+e6)],[eN]:[RegExp("FxiOS\\/"+e6)],[eY]:[RegExp("Konqueror[:/]?"+e6,"i")],[eE]:[RegExp(eE+" "+e6),e8],[eq]:[RegExp("android\\s"+e6,"i")],[eP]:[RegExp(ex+"\\/"+e6)],[eQ]:[RegExp("OculusBrowser\\/"+e6)],[eX]:[RegExp(eX+"\\/"+e6)],[eZ]:[RegExp("YaBrowser\\/"+e6)],[e0]:[RegExp(e0+"\\/"+e6)],[e4]:[RegExp(e4+"\\/"+e6)],[e1]:[RegExp("(DuckDuckGo|Ddg)\\/"+e6)],[e2]:[RegExp("PaleMoon\\/"+e6)],[e3]:[RegExp(e3+"\\/"+e6)],[e5]:[RegExp("GSA\\/"+e6)],[eO]:[RegExp("(rv:|MSIE )"+e6)],Mozilla:[RegExp("rv:"+e6)]},ts=function(e,t,r,i){var n=tn[ti(e,t,r,i)];if(X(n))return null;for(var s=0;n.length>s;s++){var o=e.match(n[s]);if(o)return parseFloat(o[o.length-2])}return null},to=[[RegExp(eU+"; "+eU+" (.*?)[);]","i"),e=>[eU,e&&e[1]||""]],[RegExp(e$,"i"),[e$,""]],[RegExp(ej,"i"),[ej,""]],[tt,[eE,""]],[RegExp(eV,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ez,""];if(new RegExp(ev).test(t)&&!/IEMobile\b/.test(t))return[eV+" "+ev,""];
2var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=tr[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[eV,i]}return[eV,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=X(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+eg+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+eg+")","i"),e=>e&&e[2]?[eg,[e[2],e[3],e[4]||"0"].join(".")]:[eg,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[eI,""]],[/Linux|debian/i,["Linux",""]]],ta=function(e){return te.test(e)?e$:e9.test(e)?ej:e7.test(e)?eU:RegExp(eW,"i").test(e)?eW:RegExp("("+ez+"|WPDesktop)","i").test(e)?ez:/iPad/.test(e)?ey:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ew:tt.test(e)?eE:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eH,"i").test(e)?eH:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ev).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?eg:e_:RegExp("(pda|"+ev+")","i").test(e)?eJ:RegExp(em,"i").test(e)&&!RegExp(em+" pc","i").test(e)?eK:""},tl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tu(e,t){return"string"==typeof e&&tl.test(e)?e:t()}function tc(e){return e?e.split("#")[0]:e}function td(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}var th=e=>e instanceof Error,tp={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}},tf=tp.info;function tv(e){var t=[];for(var r in e){var i=e[r];et(i)||X(i)||t.push({key:r,value:function e(t){if(es(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(J(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(i)})}return t}function tg(e,t,r){return b({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}function tm(e,t,r,i){return{resourceLogs:[{resource:{attributes:tv(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}let t_=class{constructor(e,t,r,i,n,s,o){var a;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this.Se=t,this.Ae=r,this.qe=i,this.Be=n,this.je=s,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=t.maxBufferSize,this.Je=Math.max(null!=(a=t.maxQueueSize)?a:t.maxBufferSize,t.maxBufferSize),this.Ke=t.flushIntervalMs,this.Ye=t.maxBatchRecordsPerPost,this.Xe=t.rateCapWindowMs,this.et=t.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ye=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this.it(e);if(null!==t)if(t.body){if(this.nt()){var r={record:function(e,t){var{text:r,number:i}=tp[e.level||"info"]||tf,n=String(Date.now())+"000000",s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s["window.id"]=t.windowId),er(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),er(t.lastActivityTimestamp)||(s.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(s["url.full"]=t.currentUrl),t.screenName&&(s["screen.name"]=t.screenName),t.appState&&(s["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(s.feature_flags=t.activeFeatureFlags);var o=b({},s,e.attributes||{}),a={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:i,severityText:r,body:{stringValue:e.body},attributes:tv(o)};return e.trace_id&&(a.traceId=e.trace_id),e.span_id&&(a.spanId=e.span_id),X(e.trace_flags)||(a.flags=e.trace_flags),a}(t,this.qe())};this.Be(()=>this.st(r))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(e){var t=this.Se.beforeSend;if(!t)return e;var r=J(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this.Ae.info("Log was rejected in beforeSend function"),null;i=s}catch(e){return this.Ae.error("Error in beforeSend function for log:",e),null}return i}nt(){if(void 0===this.et)return!0;var e=Date.now(),t=e-this.We;return this.Xe>t&&t>=0||(this.We=e,this.Ge=0,this.Ze=!1),this.et>
2this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var e=this;return y(function*(){if(!e._instance.isDisabled)return e.Ue||(e.Ue=e.ot().finally(()=>{e.Ue=null})),e.Ue})()}ot(){var e=this;return y(function*(){e.tt();var t=null!=(n=e._instance.getPersistedProperty(A.LogsQueue))?n:[];if(0!==t.length)for(var r=t.length,i=0;t.length>0&&r>i;){e.ze=0;var n,s,o,a=Math.min(t.length,e.Ye),l=t.slice(0,a),u=tm(l.map(e=>e.record),e.ut(),null!=(s=e.He)?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.ht(u);if("too-large"===c.kind&&l.length>1)e.Ye=Math.max(1,Math.floor(l.length/2)),e.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.Ye);else if("retry-later"===c.kind||("too-large"===c.kind?e.Ae.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e.Se.maxBatchRecordsPerPost>e.Ye&&(e.Ye=Math.min(e.Se.maxBatchRecordsPerPost,e.Ye+1)),yield e.dt(l.length),t=null!=(o=e._instance.getPersistedProperty(A.LogsQueue))?o:[],i+=l.length,"fatal"===c.kind))throw c.error}})()}dt(e){var t=this;return y(function*(){var r,i=Math.max(0,e-t.ze),n=null!=(r=t._instance.getPersistedProperty(A.LogsQueue))?r:[];t._instance.setPersistedProperty(A.LogsQueue,n.slice(i)),yield t.je()})()}ut(){return tg(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(e){var t;if(!this._instance.optedOut){var r=null!=(t=this._instance.getPersistedProperty(A.LogsQueue))?t:[];this.Je>r.length||(r.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(A.LogsQueue,r),this.Qe>r.length?this.ct():this.rt()}}ct(e){void 0===e&&(e=this.Ke),this.vt||(this.vt=td(()=>{this.vt=void 0,this.rt()},e))}ft(){var e=Math.min(Math.max(0,this.Ve-1),6);return this.Ke*Math.pow(2,e)}yt(){var e=this._instance.getPersistedProperty(A.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return y(function*(){t.tt();var r=t.flush().catch(()=>{});void 0!==e?yield Promise.race([r,new Promise(t=>td(t,e))]):yield r})()}flushWithTimeout(e){var t=this;return y(function*(){var r=!1,i=t.flush(),n=new Promise(t=>td(()=>{r=!0,t()},e));try{yield Promise.race([i,n])}finally{r&&i.catch(()=>{})}})()}rt(){this.flush().then(()=>{this.Ve=0},e=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())})}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var ty=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function tb(e){return String(e)+"000000"}function tw(e,t,r,i){var n="";return i&&(n=Object.keys(i).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(i[e])).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+n}let tS=class{constructor(e,t,r){this._instance=e,this.Se=t,this.Ae=r,this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}count(e,t,r){void 0===t&&(t=1),this.kt({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this.kt({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this.kt({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e,t=this,r=this.Ue,i=(e=y(function*(){r&&(yield r.catch(()=>{})),yield t.St()}),function(){return e.apply(this,arguments)})().finally(()=>{this.Ue===i&&(this.Ue=null)});return this.Ue=i,i}drainWindow(){if(0===this.bt.size)return null;var e=this.bt;return this.bt=new Map,this._t=!1,this.wt=new Map,this.xt=new Set,this.Ct(e)}reset(){this.tt(),this.bt=new Map,this.Ue=null,this._t=!1,this.wt=new Map,this.xt=new Set}kt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.it(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this.Ae.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var r=this.wt.get(t.name);void 0===r?this.wt.set(t.name,t.type):r===t.type||this.xt.has(t.name)||(this.xt.add(t.name),this.Ae.warn("Metric name '"+t.name+"' is already used as a "+r+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name."));var i=tw(t.type,t.name,t.unit,t.attributes),n=this.bt.get(i);
2if(!n){if(this.bt.size>=this.Se.maxSeriesPerFlush)return void(this._t||(this._t=!0,this.Ae.warn("Metric series cap reached ("+this.Se.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")));n={name:t.name,type:t.type,unit:t.unit,attributes:t.attributes?b({},t.attributes):void 0,windowStartMs:Date.now()},this.bt.set(i,n)}this.It(n,t.value),this.ct()}else this.Ae.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.Ae.warn("Dropping metric with empty name")}}It(e,t){var r;switch(e.type){case"count":e.total=(null!=(r=e.total)?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(ty.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,ty)]+=1}}it(e){var t=this.Se.beforeSend;if(!t)return e;var r=J(t)?t:[t],i=e;for(var n of r)try{var s=n(i);if(!s)return this.Ae.info("Metric was rejected in beforeSend function"),null;i=s}catch(e){return this.Ae.error("Error in beforeSend function for metric:",e),null}return i}ct(){this.vt||(this.vt=td(()=>{this.vt=void 0,this.flush().catch(()=>{})},this.Se.flushIntervalMs))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}St(){var e=this;return y(function*(){if(0!==e.bt.size){var t=e.bt;e.bt=new Map,e._t=!1,e.wt=new Map,e.xt=new Set;var r=yield e._instance.Tt(e.Ct(t));switch(r.kind){case"ok":return;case"retry-later":return e.Mt(t),void e.ct();case"too-large":return void e.Ae.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.Ae.error("Failed to send metrics batch:",r.error)}}})()}Ct(e){var t,r,i,n,s,o,a;return n=this.Et(e),t=this.Se,r=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),s=b({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":r,"telemetry.sdk.version":i}),o=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tv(s)},scopeMetrics:[{scope:{name:o,version:a},metrics:n}]}]}}Et(e){var t=tb(Date.now()),r=new Map;for(var i of e.values()){var n,s=tw(i.type,i.name,i.unit,void 0),o=r.get(s);o||(o=b({name:i.name},i.unit&&{unit:i.unit}),"count"===i.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===i.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},r.set(s,o));var a=tv(null!=(n=i.attributes)?n:{}),l=tb(i.windowStartMs);if("count"===i.type){var u,c={attributes:a,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!=(u=i.total)?u:0};o.sum.dataPoints.push(c)}else if("gauge"===i.type){var d,h={attributes:a,timeUnixNano:t,asDouble:null!=(d=i.last)?d:0};o.gauge.dataPoints.push(h)}else i.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:ty})}return Array.from(r.values())}Mt(e){var t,r;for(var[i,n]of e){var s=this.bt.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,n.windowStartMs),s.type){case"count":s.total=(null!=(t=s.total)?t:0)+(null!=(r=n.total)?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(s.hist){s.hist.count+=n.hist.count,s.hist.sum+=n.hist.sum,s.hist.min=Math.min(s.hist.min,n.hist.min),s.hist.max=Math.max(s.hist.max,n.hist.max);for(var o=0;s.hist.bucketCounts.length>o;o++)s.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else s.hist=n.hist}else this.bt.set(i,n)}}};class tE{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),s=this.parseStacktrace(i,n);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var t=this;return y(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&J(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
2pFirstLines:0),t.chunkIdMap)),b({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return y(function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,t){var r,i,n,s={type:e.type,value:e.value,mechanism:{type:null!=(r=t.type)?r:"generic",handled:null==(i=t.handled)||i,synthetic:null!=(n=e.synthetic)&&n}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,b({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return ia&&r.length===io||(io=r.length,ia=r.reduce((r,i)=>{is||(is={});var n=is[i];if(n)r[n[0]]=n[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,is[i]=[l,u];break}}return r},{})),ia}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var n=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,n)}};return b({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}}function tk(e,t,r,i,n){var s={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return X(i)||(s.lineno=i),X(n)||(s.colno=n),s}var tx=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tP=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tT=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tI=/\((\S*)(?::(\d+))(?::(\d+))\)/,tA=(e,t)=>{var r=tP.exec(e);if(r){var[,i,n,s]=r;return tk(t,i,"?",+n,+s)}var o=tT.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=tI.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=tx(o[1]||"?",o[2]);return tk(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},tO=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tR=(e,t)=>{var r=tO.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=tC.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var n=r[3],s=r[1]||"?";return[s,n]=tx(s,n),tk(t,n,s,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},tF=/\(error: (.*)\)/;class tL{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Z(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 eu(e,"DOMException")}isDOMError(e){return eu(e,"DOMError")}}class tM{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class tD{match(e){return eu(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}var tN=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class t${match(e){return"string"==typeof e}coerce(e,t){var r,[i,n]=this.getInfos(e);return{type:null!=i?i:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(tN);return i&&(t=i[1],r=i[2]),[t,r]}}var tj=["fatal","error","warning","log","info","debug"];function tU(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var n=r.slice(0,i).join(", ");
2if(t>=n.length)return i===r.length?n:n.length>t?n.slice(0,t)+"...":n}return""}class tq{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:null==(r=t.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ec(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+tU(e)}isSeverityLevel(e){return Z(e)&&!ee(e)&&tj.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var r=e[t];if(th(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tB{match(e){return ec(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+tU(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class tV{match(e){return el(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class tz{match(e){return eu(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ec(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return el(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tH="$message",tW="$timestamp",tG=new Set([tH,tW]),tJ={enabled:!0,max_bytes:32768};function tK(e){var t;return e?{enabled:null!=(t=e.enabled)?t:tJ.enabled,max_bytes:function(e,t){if(!ei(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}(e.max_bytes,tJ.max_bytes)}:b({},tJ)}class tY{constructor(e){this.Pt=[],this.Rt=0,this.Se=tK(e)}setConfig(e){this.Se=tK(e),this.Ot()}add(e){var t=function(e){var t,r,i;try{i=[],t=null!=(r=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))?r:"null"}catch(e){return}try{var n=JSON.parse(t);if(!Y(n))return;var s=n[tH],o=n[tW];if(!Z(s)||0===s.trim().length||!Z(o)&&!ei(o))return;return{step:n,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this.Se.max_bytes||(this.Pt.push({step:t.step,bytes:r}),this.Rt+=r,this.Ot())}}getAttachable(){return this.Pt.map(e=>e.step)}clear(){this.Pt=[],this.Rt=0}size(){return this.Pt.length}Ot(){for(;this.Rt>this.Se.max_bytes&&this.Pt.length>0;){var e=this.Pt.shift();e&&(this.Rt-=e.bytes)}}}var tQ=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,i={k(t){if(n&&(m.DEBUG||f.POSTHOG_DEBUG||r)&&!X(n.console)&&n.console){for(var i=("__rrweb_original__"in n.console[t])?n.console[t].__rrweb_original__:n.console[t],s=arguments.length,o=Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];i(e,...o)}},debug(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];i.k("debug",...t)},info(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];i.k("log",...t)},warn(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];i.k("warn",...t)},error(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];i.k("error",...t)},critical(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>tQ(e+" "+t,r)};return i},tX=tQ("[PostHog.js]"),tZ=tX.createLogger,t0=tZ("[ExternalScriptsLoader]"),t1=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return t0.warn(t+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var i=null==a?void 0:a.querySelectorAll("script");
2if(i){for(var n,s=0;i.length>s;s++)if(n=function(){if(i[s].src===t){var e=i[s];return e.__posthog_loading_callback_fired?{v:r()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,r(void 0,t)}),e.onerror=e=>r(e),{v:void 0})}}())return n.v}var o=()=>{if(!a)return r("document not found");var i=a.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=e=>{i.__posthog_loading_callback_fired=!0,r(void 0,e)},i.onerror=e=>r(e),e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return r("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)a.head.appendChild(i);else{var n,s=a.querySelectorAll("body > script");s.length>0?null==(n=s[0].parentNode)||n.insertBefore(i,s[0]):a.body.appendChild(i)}};null!=a&&a.body?o():null==a||a.addEventListener("DOMContentLoaded",o)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if("remote-config"!==t){var i;if(e.config.strict_script_versioning)i=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var n="/static/"+t+".js?v="+e.version;"toolbar"===t&&(n=n+"&t="+3e5*Math.floor(Date.now()/3e5)),i=e.requestRouter.endpointFor("assets",n)}t1(e,i,r)}else{var s=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");t1(e,s,r)}},f.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{var i=e.requestRouter.endpointFor("api",t);t1(e,i,r)};var t2="$people_distinct_id",t3="$device_id",t4="$device_model",t5="__alias",t6="__timers",t8="$autocapture_disabled_server_side",t7="$heatmaps_enabled_server_side",t9="$exception_capture_enabled_server_side",re="$error_tracking_suppression_rules",rt="$error_tracking_capture_extension_exceptions",rr="$web_vitals_enabled_server_side",ri="$dead_clicks_enabled_server_side",rn="$product_tours_enabled_server_side",rs="$web_vitals_allowed_metrics",ro="$session_recording_remote_config",ra="$replay_sample_rate",rl="$replay_override_sampling",ru="$replay_override_linked_flag",rc="$replay_override_url_trigger",rd="$replay_override_event_trigger",rh="$sesid",rp="$session_is_sampled",rf="$enabled_feature_flags",rv="$active_feature_flags",rg="$early_access_features",rm="$feature_flag_details",r_="$feature_flag_payloads",ry="$feature_flag_request_id",rb="$override_feature_flags",rw="$override_feature_flag_payloads",rS="$stored_person_properties",rE="$stored_group_properties",rk="$surveys",rx="$surveys_loaded_at",rP="$surveys_activated",rT="ph_product_tours",rI="$flag_call_reported",rA="$flag_call_reported_session_id",rO="$feature_flag_errors",rC="$feature_flag_evaluated_at",rR="$user_state",rF="$client_session_props",rL="$capture_rate_limit",rM="$initial_campaign_params",rD="$initial_referrer_info",rN="$initial_person_info",r$="$epp",rj="__POSTHOG_TOOLBAR__",rU="$posthog_cookieless",rq="$sdk_debug_extensions_init_method",rB="$sdk_debug_extensions_init_time_ms",rV="$sdk_debug_recording_script_not_loaded",rz="PostHog loadExternalDependency extension not found.",rH="on_reject",rW="always",rG="anonymous",rJ="identified",rK="identified_only",rY="visibilitychange",rQ="beforeunload",rX="$pageview",rZ="$pageleave",r0="$identify",r1="$groupidentify";function r2(e,t){J(e)&&e.forEach(t)}function r3(e,t){if(!er(e))if(J(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,r)=>t(e,r));else for(var r in e)W.call(e,r)&&t(e[r],r)}var r4=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var n of r)for(var s in n)void 0!==n[s]&&(e[s]=n[s]);return e};function r5(e){for(var t=Object.keys(e),r=t.length,i=Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var r6=function(e){try{return e()}catch(e){return}},r8=function(e){return function(){try{for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){tX.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tX.critical(e)}}},r7=function(e){var t={};return r3(e,function(e,r){(Z(e)&&e.length>0||ei(e))&&(t[r]=e)}),t},r9=["herokuapp.com","vercel.app","netlify.app"];
2function ie(e,t,r,i){var{capture:n=!1,passive:s=!0}=null!=i?i:{};null==e||e.addEventListener(t,r,{capture:n,passive:s})}function it(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ei(e)&&isFinite(e)&&Math.floor(e)===e});class ir{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>t||0>r||0>i||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/0x10000000000,n[1]=e/0x100000000,n[2]=e/0x1000000,n[3]=e/65536,n[4]=e/256,n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=i>>>24,n[13]=i>>>16,n[14]=i>>>8,n[15]=i,new ir(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new ir(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class ii{constructor(){this.S=0,this.C=0,this.I=new ic}generate(){var e=this.generateOrAbort();if(X(e)){this.S=0;var t=this.generateOrAbort();if(X(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>0x3ffffffffff&&(this.S++,this.M())}return ir.fromFieldsV7(this.S,Math.trunc(this.C/0x40000000),0x3fffffff&this.C,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var is,io,ia,il,iu=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};n&&!X(n.crypto)&&crypto.getRandomValues&&(iu=e=>crypto.getRandomValues(e));class ic{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(iu(this.R),this.O=0),this.R[this.O++]}}var id=()=>ih().toString(),ih=()=>(il||(il=new ii)).generate(),ip="",iv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ig={N:()=>!!a,D(e){tX.error("cookieStore error: "+e)},A(e){if(a){try{for(var t=e+"=",r=a.cookie.split(";").filter(e=>e.length),i=0;r.length>i;i++){for(var n=r[i];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(t))return decodeURIComponent(n.substring(t.length,n.length))}}catch(e){}return null}},F(e){var t;try{t=JSON.parse(ig.A(e))||{}}catch(e){}return t},q(e,t,r,i,n){if(!a)return!1;try{var s="",o="",l=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=a),ip)return ip;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),n="dmn_chk_"+id();!ip&&i--;){var s=r.slice(i).join("."),o=n+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(n)&&(t.cookie=o+";max-age=0",ip=s)}return ip}(e);if(!r){var i,n=(i=e.match(iv))?i[0]:"";n!==r&&tX.info("Warning: cookie subdomain discovery mismatch",n,r),r=n}return r?"; domain=."+r:""}return""}(a.location.hostname,i);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}n&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+l+o;return c.length>3686.4&&tX.warn("cookieStore warning: large cookie, len="+c.length),a.cookie=c,!0}catch(e){return!1}},P(e,t){if(null!=a&&a.cookie)try{ig.q(e,"",-1,t)}catch(e){return}}},im=null,i_={N(){if(!et(im))return im;var e=!0;if(X(n))e=!1;else try{var t="__mplssupport__";i_.q(t,"xyz"),'"xyz"'!==i_.A(t)&&(e=!1),i_.P(t)}catch(t){e=!1}return e||tX.error("localStorage unsupported; falling back to cookie store"),im=e,e},D(e){tX.error("localStorage error: "+e)},A(e){try{return null==n?void 0:n.localStorage.getItem(e)}catch(e){i_.D(e)}return null},F(e){try{return JSON.parse(i_.A(e))||{}}catch(e){}return null},q(e,t){try{return null==n||n.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){i_.D(e)}return!1},P(e){try{null==n||n.localStorage.removeItem(e)}catch(e){i_.D(e)}}},iy=[t3,"distinct_id",rh,rp,r$,rN,rR],ib={},iw={N:()=>!0,D(e){tX.error("memoryStorage error: "+e)},A:e=>ib[e]||null,F:e=>ib[e]||null,q:(e,t)=>
2(ib[e]=t,!0),P(e){delete ib[e]}},iS=null,iE={N(){if(!et(iS))return iS;if(iS=!0,X(n))iS=!1;else try{var e="__support__";iE.q(e,"xyz"),'"xyz"'!==iE.A(e)&&(iS=!1),iE.P(e)}catch(e){iS=!1}return iS},D(e){tX.error("sessionStorage error: ",e)},A(e){try{return null==n?void 0:n.sessionStorage.getItem(e)}catch(e){iE.D(e)}return null},F(e){try{return JSON.parse(iE.A(e))||null}catch(e){}return null},q(e,t){try{return null==n||n.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){iE.D(e)}return!1},P(e){try{null==n||n.sessionStorage.removeItem(e)}catch(e){iE.D(e)}}};class ik{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.Ft()?0:this.At}isOptedOut(){return this.Se.cookieless_mode===rW||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===rH}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Dt.q(this.$t,+!!e,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Dt.P(this.$t,this.Se.cross_subdomain_cookie)}get $t(){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 At(){var e=this.Dt.A(this.$t);return B(ed,e)?1:B(eh,e)?0:-1}get Dt(){var e=this.Se.opt_out_capturing_persistence_type,t="localStorage"===e?i_:ig;if(!this.Nt||this.Nt!==t){this.Nt=t;var r="localStorage"===e?ig:i_;r.A(this.$t)&&(this.Nt.A(this.$t)||this.optInOut(B(ed,r.A(this.$t))),r.P(this.$t,this.Se.cross_subdomain_cookie))}return this.Nt}Ft(){return!!this.Se.respect_dnt&&[null==o?void 0:o.doNotTrack,null==o?void 0:o.msDoNotTrack,f.doNotTrack].some(e=>B(ed,e))}}function ix(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!K(i))return t;try{var n=i(t);return Z(n)&&n?n:t}catch(e){return tX.error("Error in get_current_url, falling back to window.location.href",e),t}}function iP(e){return e instanceof Element&&(e.id===rj||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function iT(e){return!!e&&1===e.nodeType}function iI(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function iA(e){return!!e&&3===e.nodeType}function iO(e){return!!e&&11===e.nodeType&&iT(e.host)}function iC(e){return e?V(e).split(/\s+/):[]}function iR(e,t){var r,i,s=X(i=null==n||null==(r=n.location)?void 0:r.href)?void 0:ix(t,i);return!!(s&&e&&e.some(e=>s.match(e)))}function iF(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return iC(t)}function iL(e){return er(e)?null:V(e).split(/(\s+)/).filter(e=>i3(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function iM(e){var t="";return iK(e)&&!iY(e)&&e.childNodes&&e.childNodes.length&&r3(e.childNodes,function(e){var r;iA(e)&&e.textContent&&(t+=null!=(r=iL(e.textContent))?r:"")}),V(t)}function iD(e){var t;return X(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var iN=["a","button","form","input","select","textarea","label"];function i$(e,t){if(X(t))return!0;var r,i=function(e){if(t.some(t=>(function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}})(e,t)))return{v:!0}};for(var n of e)if(r=i(n))return r.v;return!1}function ij(e){var t=e.parentNode;return!(!t||!iT(t))&&t}var iU=[".ph-no-autocapture","[data-ph-no-autocapture]"],iq=["next","previous","prev",">","<"],iB=[...iq,"+","-","â","â"],iV=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,iz=[".ph-no-rageclick",".ph-no-capture"],iH=["","text","search","email","password","url","tel","number"];function iW(e,t){if(!n||iG(e)||(es(t)?(i=!!t&&iz,s=void 0,o=!1):(i=null!=(a=null==t?void 0:t.css_selector_ignorelist)?a:iz,s=null==t?void 0:t.content_ignorelist,o=null!=(l=null==t?void 0:t.ignore_text_selection)&&l),!1===i)||o&&!(!(r=e)||!iT(r))&&(iI(r,"textarea")||(iI(r,"input")?B(iH,(r.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(r))))return!1;var r,i,s,o,a,l,{targetElementList:u}=iJ(e,!1);return!function(e,t){var r;if(!1===e||X(e))return!1;if(!0===e)r=iq;else{if(!J(e))return!1;if(e.length>10)return tX.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:i}=e;return r.some(e=>iV(t,e)||iV(i,e))})}(s,u.map(e=>{var t;return{safeText:iM(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!i$(u,i)}var iG=e=>!e||iI(e,"html")||!iT(e),iJ=(e,t)=>{if(!n||iG(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],s=e;s.parentNode&&!iI(s,"body");)if(iO(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var o=ij(s);if(!o)break;if(t||iN.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=n.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(e){}i.push(o),s=o}return{parentIsUsefulElement:r,targetElementList:i}};function iK(e){for(var t=e;t.parentNode&&!iI(t,"body");t=t.parentNode){var r=iF(t);if(B(r,"ph-sensitive")||B(r,"ph-no-capture"))return!1}if(B(iF(e),"ph-include"))return!0;var i=e.type||"";if(Z(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}
2var n=e.name||e.id||"";return!Z(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function iY(e){return!!(iI(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||iI(e,"select")||iI(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var iQ="(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})",iX=RegExp("^(?:"+iQ+")$"),iZ=new RegExp(iQ),i0="\\d{3}-?\\d{2}-?\\d{4}",i1=RegExp("^("+i0+")$"),i2=RegExp("("+i0+")");function i3(e,t){return void 0===t&&(t=!0),!(er(e)||Z(e)&&(e=V(e),(t?iX:iZ).test((e||"").replace(/[- ]/g,""))||(t?i1:i2).test(e)))&&!0}function i4(e){var t=iM(e);return i3(t=(t+" "+function e(t){var r="";return t&&t.childNodes&&t.childNodes.length&&r3(t.childNodes,function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var n=iM(t);r=(r+" "+n).trim(),t.childNodes&&t.childNodes.length&&(r=(r+" "+e(t)).trim())}catch(e){tX.error("[AutoCapture]",e)}}),r}(e)).trim())?t:""}function i5(e){return e.replace(/"|\\"/g,'\\"')}var i6=tZ("[Dead Clicks]"),i8=()=>!0,i7=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(ri)),i=e.instance.config.capture_dead_clicks;return es(i)?i:!!Y(i)||r};class i9{get lazyLoadedDeadClicksAutocapture(){return this.qt}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({[ri]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Bt(()=>{this.jt()}):this.stop()}Bt(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?i6.error("failed to load script",t):e()})}jt(){var e;if(a){if(!this.qt&&null!=(e=f.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Y(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.qt=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.qt.start(a),i6.info("starting...")}}else i6.error("`document` not found. Cannot start.")}stop(){this.qt&&(this.qt.stop(),this.qt=void 0,i6.info("stopping..."))}}var ne=tZ("[SegmentIntegration]"),nt="posthog-js";function nr(e,t){var{organization:r,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{if("*"!==s&&!s.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var a=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=a,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,d,h,p,f=(null==(l=t.exception)?void 0:l.values)||[],v=f.map(e=>b({},e,{stacktrace:e.stacktrace?b({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>b({},e,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(u=f[0])?void 0:u.value)||t.message,$exception_type:null==(c=f[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=f[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(h=f[0])?void 0:h.type,$sentry_tags:t.tags};return r&&i&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+i+"&query="+t.event_id),o&&(null==(p=e.exceptions)||p.sendExceptionEvent(g)),t}}class ni{constructor(e,t,r,i,n,s){this.name=nt,this.setupOnce=function(o){o(nr(e,{organization:t,projectId:r,prefix:i,severityAllowList:n,sendExceptionsToPostHog:null==s||s}))}}}class nn{constructor(e){this.Ht=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(tX.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this.Ut=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zt()}zt(){var e;this.Vt=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Ht)}destroy(){var e;null==(e=this.Vt)||e.call(this),this.Vt=void 0}doPageView(e,t){var r,i=this.Wt(e,t);return this.Ut={pathname:null!=(r=null==n?void 0:n.location.pathname)?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Wt(e,null==(t=this.Ut)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Ut)?void 0:e.pageViewId}}Wt(e,t){var r=this.Ut;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=n;if(!(X(s)||X(o)||X(a)||X(l)||X(u)||X(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=s>1?ep(o/s,0,1,tX):1,h=s>1?ep(a/s,0,1,tX):1,p=l>1?ep(u/l,0,1,tX):1,f=l>1?ep(c/l,0,1,tX):1;i=r4(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var ns=["flags","surveys"],no={[t2]:{exposure:"hidden"},[t5]:{exposure:"hidden"},__cmpns:{exposure:"hidden"}
2,[t6]:{exposure:"hidden"},[t8]:{exposure:"event"},[t7]:{exposure:"hidden"},[t9]:{exposure:"event"},[re]:{exposure:"hidden"},[rt]:{exposure:"event"},[rr]:{exposure:"event"},[ri]:{exposure:"event"},[rn]:{exposure:"hidden"},[rs]:{exposure:"event"},[ro]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[rh]:{exposure:"hidden"},[rp]:{exposure:"event"},[ra]:{exposure:"event",shouldSkipFromEventProperties:e=>et(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[rf]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Y(e))return{};for(var t={},r=Object.keys(e),i=0;r.length>i;i++)t["$feature/"+r[i]]=e[r[i]];return t}},[rv]:{exposure:"event",storageGroup:"flags"},[rg]:{exposure:"hidden"},[rm]:{exposure:"hidden",storageGroup:"flags"},[r_]:{exposure:"event",storageGroup:"flags"},[ry]:{exposure:"event",storageGroup:"flags",volatile:!0},[rb]:{exposure:"event"},[rw]:{exposure:"hidden"},[rS]:{exposure:"hidden"},[rE]:{exposure:"hidden"},[rk]:{exposure:"hidden",storageGroup:"surveys"},[rx]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[rP]:{exposure:"event"},[rT]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[rI]:{exposure:"hidden"},[rA]:{exposure:"hidden"},[rO]:{exposure:"hidden"},[rC]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[rR]:{exposure:"hidden"},[rF]:{exposure:"hidden"},[rL]:{exposure:"hidden"},[rM]:{exposure:"hidden"},[rD]:{exposure:"hidden"},[rN]:{exposure:"hidden"},[r$]:{exposure:"hidden"},[rl]:{exposure:"event"},[ru]:{exposure:"event"},[rc]:{exposure:"event"},[rd]:{exposure:"event"},[rq]:{exposure:"event"},[rB]:{exposure:"event"},[rV]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},na=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],nl=e=>{var t=no[e];if(t)return t;for(var[r,i]of na)if(0===e.indexOf(r))return i},nu=e=>{var t=null==a?void 0:a.createElement("a");return X(t)?null:(t.href=e,t)},nc=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;i.length>n;n++){var s=i[n].split("=");if(s[0]===t){r=s;break}}if(!J(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){tX.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},nd=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),n=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");J(d)&&(t.includes(d[0])?u.push(d[0]+"="+r):u.push(l[c]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},nh=function(e,t){var r=e.match(RegExp(t+"=([^&]*)"));return r?r[1]:null},np=(e,t)=>e>=t&&v(),nf=(e,t,r,i)=>{if(0===e){if(v()){var n=t+1;return n===r&&i(),n}return t}return 0},nv="https?://(.*)",ng=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],nm=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ng],n_="<masked>",ny=["li_fat_id"];function nb(e,t,r){if(!a)return{};var i,n=t?[...ng,...r||[]]:[],s=nw(nd(a.URL,n,n_),e);return r4((i={},r3(ny,function(e){var t=ig.A(e);i[e]=t||null}),i),s)}function nw(e,t){var r=nm.concat(t||[]),i={};return r3(r,function(t){var r=nc(e,t);i[t]=r||null}),i}function nS(e){var t=e?0===e.search(nv+"google.([^/?]*)")?"google":0===e.search(nv+"bing.com")?"bing":0===e.search(nv+"yahoo.com")?"yahoo":0===e.search(nv+"duckduckgo.com")?"duckduckgo":null:null,r={};if(!et(t)){r.$search_engine=t;var i=a?nc(a.referrer,"yahoo"!=t?"q":"p"):"";i.length&&(r.ph_keyword=i)}return r}function nE(){return navigator.language||navigator.userLanguage}var nk="$direct";function nx(){return(null==a?void 0:a.referrer)||nk}function nP(e,t,r){void 0===r&&(r=!1);var i=e?[...ng,...t||[]]:[],n=r?tc(null==l?void 0:l.href):null==l?void 0:l.href,s=null==n?void 0:n.substring(0,1e3);return{r:nx().substring(0,1e3),u:s?nd(s,i,n_):void 0}}function nT(e,t){void 0===t&&(t=!1);
2var r,{r:i,u:n}=e,s=t?tc(n):n,o={$referrer:i,$referring_domain:null==i?void 0:i==nk?nk:null==(r=nu(i))?void 0:r.host};if(s){o.$current_url=s;var a=nu(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,r4(o,nw(s))}return i&&r4(o,nS(i)),o}function nI(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var nA={flags:rC,surveys:rx},nO=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],nC="main";class nR{constructor(e,t,r){if(void 0===r&&(r=!0),this.Gt={},this.Zt=!1,this.Qt=!1,this.Se=e,this.Jt=r,this.props={},this.Kt=!1,this.Yt=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Dt=this.Xt(e),this.Qt=this.er(e),this.load(),e.debug&&tX.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),n){var i=()=>this.flush();ie(n,"beforeunload",i,{capture:!1}),ie(n,"pagehide",i,{capture:!1})}}tr(){var e,t=null==(e=this.Se)?void 0:e.persistence_save_debounce_ms;return ei(t)&&t>0?t:0}isDisabled(){return!!this.rr}Xt(e){-1===nO.indexOf(e.persistence.toLowerCase())&&(tX.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,r,i,s,o=(t=e.cookie_persisted_properties||[],r=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===r&&(r=!1),i=[...iy,...t],b({},i_,{F(e){try{var t={};try{t=ig.F(e)||{}}catch(e){}var i,n=JSON.parse(i_.A(e)||"{}");if(r){var s={};for(var o in t){var a=t[o];et(a)||""===a||(s[o]=a)}i=r4(n,s)}else i=r4(t,n);return i_.q(e,i),i}catch(e){}return null},q(e,t,r,n,s,o){var a=i_.q(e,t,void 0,void 0,o);try{var l={};i.forEach(e=>{t[e]&&(l[e]=t[e])}),Object.keys(l).length&&ig.q(e,l,r,n,s,o)}catch(e){i_.D(e)}return a},P(e,t){try{null==n||n.localStorage.removeItem(e),ig.P(e,t)}catch(e){i_.D(e)}}})),a=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&i_.N()?(s=i_,a=!0):"localstorage+cookie"===l&&o.N()?(s=o,a=!0):"sessionstorage"===l&&iE.N()?s=iE:"memory"===l?s=iw:"cookie"===l?s=ig:o.N()?(s=o,a=!0):s=ig,this.Zt=a,s}ir(e){return this.Yt+"__"+e}er(e){return this.Zt&&!!e.split_storage}nr(e){var t=null!=e?e:this.Se.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[rC];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return r3(this.props,(t,r)=>{var i=nl(r);if("derived"===(null==i?void 0:i.exposure)){if(null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,r===rf?()=>this.nr():()=>!1))return;i.transformToEventProperties&&r4(e,i.transformToEventProperties(t))}else if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t,()=>!1))return;e[r]=t}}),e}load(){if(!this.rr){var e=this.Dt.F(this.Yt);e&&(this.props=r4({},e)),this.Qt&&this.sr()}}sr(){for(var e of ns){var t=i_.F(this.ir(e));if(t&&!Q(t)){var r=this.ar(e);r.persisted=!0,this.lr(e)||(r.fingerprint=this.ur(t,e)),this.hr(e,t)||r4(this.props,t)}}}lr(e){return Object.keys(this.props).some(t=>{var r;return(null==(r=nl(t))?void 0:r.storageGroup)===e})}hr(e,t){var r=nA[e];if(!r)return!1;var i=t[r],n=this.props[r];return ei(i)&&ei(n)&&n>i}refreshKey(e){var t;if(!this.rr){var r=this.Qt?null==(t=nl(e))?void 0:t.storageGroup:void 0,i=r?i_.F(this.ir(r)):this.Dt.F(this.Yt);if(i&&e in i)this.dr(e,i[e]);else{if(r){var n=this.Dt.F(this.Yt);if(n&&e in n)return void this.dr(e,n[e])}this.cr(e)}}}save(){if(!this.rr){var e=this.tr();e>0?X(this.vr)&&(this.vr=setTimeout(()=>{this.vr=void 0,this.pr()},e)):this.pr()}}flush(){X(this.vr)||(clearTimeout(this.vr),this.vr=void 0,this.pr())}pr(){this.rr||(this.Qt?this.gr():this.mr(this.Dt,this.Yt,this.props,nC))}gr(){var{main:e,groups:t}=this.yr();for(var r of(this.mr(this.Dt,this.Yt,e,nC),ns)){var i,n=t[r];(!Q(n)||null!=(i=this.Gt[r])&&i.persisted)&&this.mr(i_,this.ir(r),n,r)}}yr(){var e={},t={};for(var r of ns)t[r]={};return r3(this.props,(r,i)=>{var n,s=null==(n=nl(i))?void 0:n.storageGroup;s?t[s][i]=r:e[i]=r}),{main:e,groups:t}}ur(e,t){if(t===nC)return JSON.stringify(e)+"|"+this.br+"|"+this._r+"|"+this.wr;var r={};return r3(e,(e,t)=>{var i;r[t]=null!=(i=nl(t))&&i.volatile?"__volatile__":e}),JSON.stringify(r)}
2mr(e,t,r,i){var n,s=this.ar(i);if(i===nC||s.dirty||X(s.fingerprint)){try{if((n=this.ur(r,i))===s.fingerprint)return void(s.dirty=!1)}catch(e){n=void 0}e.q(t,r,this.br,this._r,this.wr,this.Se.debug)?(s.dirty=!1,i!==nC&&(s.persisted=!0),X(n)||(s.fingerprint=n)):this.Se.debug&&tX.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(X(this.vr)||(clearTimeout(this.vr),this.vr=void 0),this.Dt.P(this.Yt,!1),this.Dt.P(this.Yt,!0),!t&&this.Jt)for(var r of ns)i_.P(this.ir(r));t?delete this.Gt[nC]:this.Gt={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Y(e)){X(t)&&(t="None"),this.br=X(r)?this.kr:r;var i=!1;if(r3(e,(e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.dr(r,e),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.br=X(t)?this.kr:t;var r=!1;if(r3(e,(t,i)=>{e.hasOwnProperty(i)&&this.props[i]!==t&&(this.dr(i,t),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.cr(e),this.save())}update_campaign_params(){if(!this.Kt){var e=nb(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);Q(r7(e))||this.register(e),this.Kt=!0}}update_search_keyword(){var e;this.register((e=null==a?void 0:a.referrer)?nS(e):{})}update_referrer_info(){var e;this.register_once({$referrer:nx(),$referring_domain:null!=a&&a.referrer&&(null==(e=nu(a.referrer))?void 0:e.host)||nk},void 0)}set_initial_person_info(){this.props[rM]||this.props[rD]||this.register_once({[rN]:nP(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e,t,r,i={};r3([rD,rM],e=>{var t=this.props[e];t&&r3(t,function(e,t){i["$initial_"+z(t)]=e})});var n=this.props[rN];return n&&r4(i,(void 0===(e=this.Se.disable_capture_url_hashes)&&(e=!1),t=nT(n,e),r={},r3(t,function(e,t){r["$initial_"+z(t)]=e}),r)),i}safe_merge(e){return r3(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){this.kr=this.br=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var i=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every((e,t)=>e===i[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i?this.Xt(e):this.Dt,s=this.er(e);if(i||s!==this.Qt){var o=this.props;this.clear(),this.Dt=n,this.Qt=s,this.props=o,this.save()}}set_disabled(e){this.rr=e,this.rr?this.remove():this.save()}set_cross_subdomain(e){e!==this._r&&(this._r=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.wr&&(this.wr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[t6]||{};r[e]=t,this.dr(t6,r),this.save()}remove_event_timer(e){var t=this.props[t6]||{},r=t[e];return X(r)||(delete t[e],this.dr(t6,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this.dr(e,t),this.save()}dr(e,t){var r;this.props[e]=t,null!=(r=nl(e))&&r.volatile||this.Sr(e)}cr(e){delete this.props[e],this.Sr(e)}Sr(e){var t,r=null==(t=nl(e))?void 0:t.storageGroup;r&&(this.ar(r).dirty=!0)}ar(e){return this.Gt[e]||(this.Gt[e]={})}}var nF="events",nL="cancelEvents",nM="survey shown",nD="survey dismissed",nN="survey sent",n$="popover",nj=tZ("[RateLimiter]");class nU{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{nj.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nj.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,r,i,{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,o=(new Date).getTime(),a=null!=(t=null==(r=this.instance.persistence)?void 0:r.get_property(rL))?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>n&&(a.tokens=n);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(rL,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var nq=tZ("[RemoteConfig]");class nB{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=f._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Cr(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Ir(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 nq.info("Using preloaded remote config",this.remoteConfig),this.Tr(this.remoteConfig),void this.Mr();if(this._instance.Er())return void nq.warn("Remote config is disabled. Falling back to local config.");this.Cr(e=>{e?(this.Tr(e),this.Mr()):(nq.info("No config found after loading remote JS config. Falling back to JSON."),this.Ir(e=>{this.Tr(e),this.Mr()}))})}catch(e){nq.error("Error loading remote config",e)}}stop(){this.Pr&&(clearInterval(this.Pr),this.Pr=void 0)}
vendor: 5,237 bytes, line 2
2refresh(){!this._instance.Er()&&a&&"hidden"!==a.visibilityState&&this._instance.reloadFeatureFlags()}Mr(){var e;if(!this.Pr){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.Pr=setInterval(()=>{this.refresh()},t))}}Tr(e){var t;e||nq.error("Failed to fetch remote config from PostHog."),this._instance.Tr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var nV="gzip-js",nz="base64",nH=Uint8Array,nW=Uint16Array,nG=Uint32Array,nJ=new nH([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]),nK=new nH([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]),nY=new nH([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nQ=function(e,t){for(var r=new nW(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var n=new nG(r[30]);for(i=1;30>i;++i)for(var s=r[i];r[i+1]>s;++s)n[s]=s-r[i]<<5|i;return[r,n]},nX=nQ(nJ,2),nZ=nX[1];nX[0][28]=258,nZ[258]=28;for(var n0=nQ(nK,0)[1],n1=new nW(32768),n2=0;32768>n2;++n2){var n3=(43690&n2)>>>1|(21845&n2)<<1;n1[n2]=((65280&(n3=(61680&(n3=(52428&n3)>>>2|(13107&n3)<<2))>>>4|(3855&n3)<<4))>>>8|(255&n3)<<8)>>>1}var n4=function(e,t,r){for(var i=e.length,n=0,s=new nW(t);i>n;++n)++s[e[n]-1];var o,a=new nW(t);for(n=0;t>n;++n)a[n]=a[n-1]+s[n-1]<<1;if(r){o=new nW(1<<t);var l=15-t;for(n=0;i>n;++n)if(e[n])for(var u=n<<4|e[n],c=t-e[n],d=a[e[n]-1]++<<c,h=d|(1<<c)-1;h>=d;++d)o[n1[d]>>>l]=u}else for(o=new nW(i),n=0;i>n;++n)o[n]=n1[a[e[n]-1]++]>>>15-e[n];return o},n5=new nH(288);for(n2=0;144>n2;++n2)n5[n2]=8;for(n2=144;256>n2;++n2)n5[n2]=9;for(n2=256;280>n2;++n2)n5[n2]=7;for(n2=280;288>n2;++n2)n5[n2]=8;var n6=new nH(32);for(n2=0;32>n2;++n2)n6[n2]=5;var n8=n4(n5,9,0),n7=n4(n6,5,0),n9=function(e){return(e/8|0)+(7&e&&1)},se=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof nW?nW:e instanceof nG?nG:nH)(r-t);return i.set(e.subarray(t,r)),i},st=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},sr=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},si=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,s=r.slice();if(!n)return[new nH(0),0];if(1==n){var o=new nH(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,c=1,d=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=n-1;)a=r[r[d].f>r[u].f?u++:d++],l=r[u!=c&&r[d].f>r[u].f?u++:d++],r[c++]={s:-1,f:a.f+l.f,l:a,r:l};var h=s[0].s;for(i=1;n>i;++i)s[i].s>h&&(h=s[i].s);var p=new nW(h+1),f=sn(r[c-1],p,0);if(f>t){i=0;var v=0,g=f-t,m=1<<g;for(s.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>i;++i){var _=s[i].s;if(t>=p[_])break;v+=m-(1<<f-p[_]),p[_]=t}for(v>>>=g;v>0;){var y=s[i].s;t>p[y]?v-=1<<t-p[y]++-1:++i}for(;i>=0&&v;--i){var b=s[i].s;p[b]==t&&(--p[b],++v)}f=t}return[new nH(p),f]},sn=function(e,t,r){return -1==e.s?Math.max(sn(e.l,t,r+1),sn(e.r,t,r+1)):t[e.s]=r},ss=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new nW(++t),i=0,n=e[0],s=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=e[a]}return[r.subarray(0,i),t]},so=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},sa=function(e,t,r){var i=r.length,n=n9(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;i>s;++s)e[n+s+4]=r[s];return 8*(n+4+i)},sl=function(e,t,r,i,n,s,o,a,l,u,c){st(t,c++,r),++n[256];for(var d=si(n,15),h=d[0],p=d[1],f=si(s,15),v=f[0],g=f[1],m=ss(h),_=m[0],y=m[1],b=ss(v),w=b[0],S=b[1],E=new nW(19),k=0;_.length>k;++k)E[31&_[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var x=si(E,7),P=x[0],T=x[1],I=19;I>4&&!P[nY[I-1]];--I);var A,O,C,R,F=u+5<<3,L=so(n,n5)+so(s,n6)+o,M=so(n,h)+so(s,v)+o+14+3*I+so(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(L>=F&&M>=F)return sa(t,c,e.subarray(l,l+u));if(st(t,c,1+(L>M)),c+=2,L>M){A=n4(h,p,0),O=h,C=n4(v,g,0),R=v;var D=n4(P,T,0);for(st(t,c,y-257),st(t,c+5,S-1),st(t,c+10,I-4),c+=14,k=0;I>k;++k)st(t,c+3*k,P[nY[k]]);c+=3*I;for(var N=[_,w],$=0;2>$;++$){var j=N[$];for(k=0;j.length>k;++k)st(t,c,D[U=31&j[k]]),c+=P[U],U>15&&(st(t,c,j[k]>>>5&127),c+=j[k]>>>12)}}else A=n8,O=n5,C=n7,R=n6;for(k=0;a>k;++k)if(i[k]>255){sr(t,c,A[257+(U=i[k]>>>18&31)]),c+=O[U+257],U>7&&(st(t,c,i[k]>>>23&31),c+=nJ[U]);var U,q=31&i[k];sr(t,c,C[q]),c+=R[q],q>3&&(sr(t,c,i[k]>>>5&8191),c+=nK[q])}else sr(t,c,A[i[k]]),c+=O[i[k]];return sr(t,c,A[256]),c+O[256]},su=new nG([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sc=function(){for(var e=new nG(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&0xedb88320)^r>>>1;e[t]=r}return e}(),sd=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},sh=!!c||!!u,sp="text/plain",sf=!1,sv=(e,t)=>{var[r,i]=e.split("#"),[n,s]=r.split("?");if(!s)return e;var o=s.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(o?"?"+o:"")+(i?"#"+i:"")},sg=function(e,t,r){void 0===r&&(r=!0);var i,n,s,o,a,[l,u]=e.split("?"),c=b({},t),d=null!=(a=null==u?void 0:u.split("&").map(e=>{var t,[i,n]=e.split("="),s=r&&null!=(t=c[i])?t:n;return delete c[i],i+"="+s}
2))?a:[],h=(void 0===i&&(i="&"),o=[],r3(c,function(e,t){X(e)||X(t)||"undefined"===t||(n=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),o[o.length]=s+"="+n)}),o.join(i));return h&&d.push(h),l+"?"+d.join("&")},sm=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),s_=e=>{if(e.Lt)return e.Lt;var{data:t,compression:r}=e;if(t){if(r===nV){var i,n,s,o,a,l,u,c,d=(i=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new nH(e.length+(e.length>>>1)),i=0,n=function(e){r[i++]=e},s=0;t>s;++s){if(i+5>r.length){var o=new nH(i+8+(t-s<<1));o.set(r),r=o}var a=e.charCodeAt(s);128>a?n(a):(2048>a?n(192|a>>>6):(a>55295&&57344>a?(n(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),n(128|a>>>12&63)):n(224|a>>>12),n(128|a>>>6&63)),n(128|63&a))}return se(r,0,i)}(sm(t)),n={mtime:0},s=0xffffffff,o={p(e){for(var t=s,r=0;e.length>r;++r)t=sc[255&t^e[r]]^t>>>8;s=t},d:()=>0xffffffff^s},a=i.length,o.p(i),c=(l=10+(n.filename&&n.filename.length+1||0),u=function(e,t,r,i){var n=e.length,s=new nH(i+n+5*(1+Math.floor(n/7e3))+8),o=s.subarray(i,s.length-8),a=0;if(!t||8>n)for(var l=0;n>=l;l+=65535){var u=l+65535;n>u?a=sa(o,a,e.subarray(l,u)):(o[l]=!0,a=sa(o,a,e.subarray(l,n)))}else{for(var c=su[t-1],d=c>>>13,h=8191&c,p=(1<<r)-1,f=new nW(32768),v=new nW(p+1),g=Math.ceil(r/3),m=2*g,_=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<m)&p},y=new nG(25e3),b=new nW(288),w=new nW(32),S=0,E=0,k=(l=0,0),x=0,P=0;n>l;++l){var T=_(l),I=32767&l,A=v[T];if(f[I]=A,v[T]=I,l>=x){var O=n-l;if((S>7e3||k>24576)&&O>423){a=sl(e,o,0,y,b,w,E,k,P,l-P,a),k=S=E=0,P=l;for(var C=0;286>C;++C)b[C]=0;for(C=0;30>C;++C)w[C]=0}var R=2,F=0,L=h,M=I-A&32767;if(O>2&&T==_(l-M))for(var D=Math.min(d,O)-1,N=Math.min(32767,l),$=Math.min(258,O);N>=M&&--L&&I!=A;){if(e[l+R]==e[l+R-M]){for(var j=0;$>j&&e[l+j]==e[l+j-M];++j);if(j>R){if(R=j,F=M,j>D)break;var U=Math.min(M,j-2),q=0;for(C=0;U>C;++C){var B=l-M+C+32768&32767,V=B-f[B]+32768&32767;V>q&&(q=V,A=B)}}}M+=(I=A)-(A=f[I])+32768&32767}if(F){y[k++]=0x10000000|nZ[R]<<18|n0[F];var z=31&nZ[R],H=31&n0[F];E+=nJ[z]+nK[H],++b[257+z],++w[H],x=l+R,++S}else y[k++]=e[l],++b[e[l]]}}a=sl(e,o,!0,y,b,w,E,k,P,l-P,a)}return se(s,0,i+n9(a)+8)}(i,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+n.mem,l)).length,function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&sd(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}}(u,n),sd(u,c-8,o.d()),sd(u,c-4,a),u);return{contentType:sp,body:d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength),estimatedSize:d.byteLength}}if(r===nz){let e;var h,p="data="+encodeURIComponent("string"==typeof(e=(h=sm(t))?btoa(encodeURIComponent(h).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):h)?e:sm(e));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var f=sm(t);return{contentType:"application/json",body:f,estimatedSize:new Blob([f]).size}}},sy=e=>{var t,r,i=()=>({url:sv(e.url,"compression"),encodedBody:s_(b({},e,{compression:void 0,Lt:void 0}))});try{t=s_(e)}catch(t){if(M(e.compression,nc(e.url,"compression")))return tX.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return!(t&&M(e.compression,nc(e.url,"compression")))||((r=t.body)instanceof ArrayBuffer?L(new Uint8Array(r)):ArrayBuffer.isView(r)&&L(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?{url:e.url,encodedBody:t}:(sf=!0,i())},sb=e=>{try{return sy(e)}catch(t){return tX.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},sw=(t=y(function*(e){var t=sm(e.data),r=yield function(e,t,r){return j.apply(this,arguments)}(t,m.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return b({},e,{Lt:{contentType:sp,body:i,estimatedSize:i.byteLength}})}),function(e){return t.apply(this,arguments)}),sS=["/e/","/s/"],sE=(e,t)=>{var r,i,n,s=(n=(i=(null==(r=nu(e))?void 0:r.pathname)||e.split(/[?#]/)[0])?"/"===i[0]?i:"/"+i:"/",sS.some(e=>n.slice(n.length-e.length)===e)),o=s?sv(e,"ver"):e;return sg(t===nV?sv(o,"compression"):o,b({_:(new Date).getTime().toString()},s?{}:{ver:m.JS_SDK_VERSION},t===nV?{}:{compression:t}))},sk=[];u&&sk.push({transport:"fetch",method(e){var t,r=sb(e);if(r){var{url:i,encodedBody:n}=r,{contentType:s,body:o,estimatedSize:a}=null!=n?n:{},l=new Headers;r3(e.headers,function(e,t){l.append(t,e)}),s&&l.append("Content-Type",s);var c=null,h=!1;if(d){var p=new d;c={signal:p.signal,timeout:setTimeout(()=>{var t,r;h=!0,p.abort(((r=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",r))},e.timeout)}}u(i,b({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(a||0),body:o,signal:null==(t=c)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(r=>{var i={statusCode:t.status,text:r};
2if(200===t.status)try{i.json=JSON.parse(r)}catch(e){tX.error(e)}null==e.callback||e.callback(i)})).catch(t=>{h&&"AbortError"===(null==t?void 0:t.name)?tX.warn(t):tX.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>c?clearTimeout(c.timeout):null)}}}),c&&sk.push({transport:"XHR",method(e){var t=sb(e);if(t){var r=new c,{url:i,encodedBody:n}=t;r.open(e.method||"GET",i,!0);var{contentType:s,body:o}=null!=n?n:{};r3(e.headers,function(e,t){r.setRequestHeader(t,e)}),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(o)}}}),null!=o&&o.sendBeacon&&sk.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:r}=sy(e),{contentType:i,body:n}=null!=r?r:{};if(!n)return;var s=n instanceof Blob?n:new Blob([n],{type:i});o.sendBeacon(t,s)}catch(e){}}});class sx{constructor(e,t){this.Rr=!0,this.Or=[],this.Lr=ep((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tX.createLogger("flush interval"),3e3),this.Fr=e}enqueue(e){this.Or.push(e),this.Ar||this.Dr()}unload(){this.$r();var e=Object.values(this.Or.length>0?this.Nr():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.qr(b({},e,{transport:"sendBeacon"}))})}enable(){this.Rr=!1,this.Dr()}Dr(){var e=this;this.Rr||(this.Ar=setTimeout(()=>{if(this.$r(),this.Or.length>0){var t=this.Nr();for(var r in t)!function(){var i=t[r],n=(new Date).getTime();i.data&&J(i.data)&&r3(i.data,e=>{e.offset=Math.abs(e.timestamp-n),delete e.timestamp}),e.qr(i)}()}},this.Lr))}qr(e){try{this.Fr(e)}catch(e){tX.error(e)}}$r(){clearTimeout(this.Ar),this.Ar=void 0}Nr(){var e={};return r3(this.Or,t=>{var r,i=(t?t.batchKey:null)||t.url;X(e[i])&&(e[i]=b({},t,{data:[]})),null==(r=e[i].data)||r.push(t.data)}),this.Or=[],e}}var sP=["retriesPerformedSoFar"];class sT{constructor(e){this.Br=!1,this.jr=3e3,this.Or=[],this._instance=e,this.Or=[],this.Hr=!0,!X(n)&&"onLine"in n.navigator&&(this.Hr=n.navigator.onLine,this.Ur=()=>{this.Hr=!0,this.zr()},this.Vr=()=>{this.Hr=!1},ie(n,"online",this.Ur),ie(n,"offline",this.Vr))}get length(){return this.Or.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=w(e,sP);en(t)&&(r.url=sg(r.url,{retry_count:t})),this._instance._send_request(b({},r,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.st(b({retriesPerformedSoFar:t},r));0===e.statusCode&&tX.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==r.callback||r.callback(e)}}))}st(e){var t,r,i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;var n=Math.ceil((r=Math.min(18e5,t=3e3*Math.pow(2,i)))+(Math.random()-.5)*(r-t/2)),s=Date.now()+n;this.Or.push({retryAt:s,requestOptions:e});var o="Enqueued failed request for retry in "+n;navigator.onLine||(o+=" (Browser is offline)"),tX.warn(o),this.Br||(this.Br=!0,this.Wr())}Wr(){(this.Gr&&clearTimeout(this.Gr),0===this.Or.length)?(this.Br=!1,this.Gr=void 0):this.Gr=setTimeout(()=>{this.Hr&&this.Or.length>0&&this.zr(),this.Wr()},this.jr)}zr(){var e=Date.now(),t=[],r=this.Or.filter(r=>e>r.retryAt||(t.push(r),!1));if(this.Or=t,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Gr&&(clearTimeout(this.Gr),this.Gr=void 0),this.Br=!1,X(n)||(this.Ur&&(n.removeEventListener("online",this.Ur),this.Ur=void 0),this.Vr&&(n.removeEventListener("offline",this.Vr),this.Vr=void 0)),this.Or))try{this._instance._send_request(b({},e,{transport:"sendBeacon"}))}catch(e){tX.error(e)}this.Or=[]}}class sI{constructor(e){this.Zr=()=>{this.Qr||(this.Qr={});var e,t,r,i,n=this.scrollElement(),s=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=s+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(s),this.Qr.maxScrollY=Math.max(s,null!=(e=this.Qr.maxScrollY)?e:0),this.Qr.maxScrollHeight=Math.max(o,null!=(t=this.Qr.maxScrollHeight)?t:0),this.Qr.lastContentY=a,this.Qr.maxContentY=Math.max(a,null!=(r=this.Qr.maxContentY)?r:0),this.Qr.maxContentHeight=Math.max(l,null!=(i=this.Qr.maxContentHeight)?i:0)},this._instance=e}get Jr(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var e=this.Qr;return setTimeout(this.Zr,0),e}startMeasuringScrollPosition(){ie(n,"scroll",this.Zr,{capture:!0}),ie(n,"scrollend",this.Zr,{capture:!0}),ie(n,"resize",this.Zr)}scrollElement(){if(!this.Jr)return null==n?void 0:n.document.documentElement;for(var e of J(this.Jr)?this.Jr:[this.Jr]){var t=null==n?void 0:n.document.querySelector(e);
2if(t)return t}}Kr(e){if(this.Jr){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return n?"y"===e?n.scrollY||n.pageYOffset||n.document.documentElement.scrollTop||0:n.scrollX||n.pageXOffset||n.document.documentElement.scrollLeft||0:0}scrollY(){return this.Kr("y")}scrollX(){return this.Kr("x")}}var sA=e=>nP(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class sO{constructor(e,t,r,i){this.Yr=e=>{var t=this.Xr();if(!t||t.sessionId!==e){var r={sessionId:e,props:this.ei(this._instance)};this.ti.register({[rF]:r})}},this._instance=e,this.ri=t,this.ti=r,this.ei=i||sA,this.ri.onSessionId(this.Yr)}Xr(){return this.ti.props[rF]}getSetOnceProps(){var e,t=null==(e=this.Xr())?void 0:e.props;return t?"r"in t?nT(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return r3(r7(this.getSetOnceProps()),(t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+z(r)]=t}),e}}class sC{constructor(){this.ii={}}on(e,t){return this.ii[e]||(this.ii[e]=[]),this.ii[e].push(t),()=>{this.ii[e]=this.ii[e].filter(e=>e!==t)}}emit(e,t){for(var r of this.ii[e]||[])r(t);for(var i of this.ii["*"]||[])i(e,t)}}var sR=tZ("[SessionId]");class sF{on(e,t){return this.ni.on(e,t)}constructor(e,t,r){if(this.si=null,this.oi=[],this.ai=void 0,this.li=!1,this.ni=new sC,this.ui=(e,t)=>!(!en(e)||!en(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===rW)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.ti=e.persistence,this.hi=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ci=t||id,this.vi=r||id;var i,n=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*ep(this.Se.session_idle_timeout_seconds||1800,60,36e3,sR.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+n+"_window_id",this.gi="ph_"+n+"_primary_window_exists",this.mi()){var s=iE.F(this.pi),o=iE.F(this.gi);s&&!o?this.hi=s:iE.P(this.pi),iE.q(this.gi,!0)}if(null!=(i=this.Se.bootstrap)&&i.sessionID)try{var a=(e=>{var t=this.Se.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.yi(this.Se.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){sR.error("Invalid sessionID in bootstrap",e)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return X(this.oi)&&(this.oi=[]),this.oi.push(e),this.di&&e(this.di,this.hi),()=>{this.oi=this.oi.filter(t=>t!==e)}}mi(){return"memory"!==this.Se.persistence&&!this.ti.rr&&iE.N()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&iE.q(this.pi,e))}xi(){return this.hi?this.hi:this.mi()?iE.F(this.pi):null}ki(e){var t=this.si;return!et(t)&&!et(e)&&5e3>Math.abs(e-t)}yi(e,t,r){var i=t!==this._sessionActivityTimestamp,n=e===this.di&&r===this._sessionStartTimestamp;this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.di=e,n&&!i||n&&this.ki(t)||(this.si=t,this.ti.register({[rh]:[t,e,r]}))}Si(){var e,t=null==(e=this.Se)?void 0:e.persistence_save_debounce_ms;return en(t)&&t>0}Ci(){this.Si()?this.ti.refreshKey(rh):(this.ti.flush(),this.ti.load())}Ii(){var e;if(!et(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.si){this.Ci();var[,t,r]=this.Ti();t===this.di&&r===this._sessionStartTimestamp&&(this.si=this._sessionActivityTimestamp,this.ti.register({[rh]:[this._sessionActivityTimestamp,null!=(e=this.di)?e:null,this._sessionStartTimestamp]}),this.ti.flush())}}Mi(){var[e]=this.Ti();return Math.max(en(e)?e:0,en(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}Ei(e){return this.Ci(),this.ui(e,this.Mi())}Ti(){var e=this.ti.props[rh];return J(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.si=null,clearTimeout(this.Pi),this.Pi=void 0,this.yi(null,null,null)}destroy(){this.li=!0,this.Ii(),clearTimeout(this.Pi),this.Pi=void 0,this.ai&&n&&(n.removeEventListener(rQ,this.ai,{capture:!1}),this.ai=void 0),this.oi=[]}bi(){this.ai=()=>{this.Ii(),this.mi()&&iE.P(this.gi)},ie(n,rQ,this.ai,{capture:!1})}
2checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Se.cookieless_mode===rW)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),[,i,n]=this.Ti(),s=this.Mi(),o=this.xi(),a=en(n)&&Math.abs(r-n)>864e5,l=!1,u=!1,c=!i,d=i,h=!c&&!e&&this.ui(r,s);h&&((h=this.Ei(r))||sR.info("cross-tab refresh kept the session alive",{sessionId:i}),[,i,n]=this.Ti()),c||h||a?(i=this.ci(),o=this.vi(),sR.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a}}),n=r,l=!0):(o||(o=this.vi(),l=!0),(u=i!==d)&&(sR.info("adopted cross-tab session id",{sessionId:i,windowId:o}),l=!0));var p=en(s)&&e&&!a?s:r,f=en(n)?n:(new Date).getTime();this.wi(o),this.yi(i,p,f),e||this.fi();var v={noSessionId:c,activityTimeout:h,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.oi.forEach(e=>e(i,o,v)),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:l?v:void 0,lastActivityTimestamp:s}}fi(){this.li||(clearTimeout(this.Pi),this.Pi=setTimeout(()=>{if(!this.li)if(this.Ei((new Date).getTime())){var e=this.di;this.resetSessionId(),this.ni.emit("forcedIdleReset",{idleSessionId:e})}else this.fi()},1.1*this.sessionTimeoutMs))}}var sL=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&q(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(e=>q(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function sM(){return(sM=y(function*(){var e=null==o?void 0:o.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),r=null==t?void 0:t.model;return Z(r)&&r.length>0?r:void 0}catch(e){return void tX.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}var sD=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function sN(e,t,r){return sm({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var s$={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>sD(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!sD(t,e))),icontains:(e,t)=>t.map(sj).some(t=>e.map(sj).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(sj).every(t=>e.map(sj).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})},sj=e=>e.toLowerCase();function sU(e,t){return!e||Object.entries(e).every(e=>{var[r,i]=e,n=null==t?void 0:t[r];if(X(n)||et(n))return!1;var s=[String(n)],o=s$[i.operator];return!!o&&o(i.values,s)})}var sq="custom",sB="i.posthog.com",sV=/^\/static\//;class sz{constructor(e){this.Ri={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+sB,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ri[this.apiHost]||(this.Ri[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":sq),this.Ri[this.apiHost]}Oi(e){if(sV.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var r=this.Oi(t);if(r)return""+r+t}if(this.region===sq)return this.apiHost+t;var i=sB+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var sH=tZ("[Surveys]"),sW="seenSurvey_",sG=e=>{try{var t,r=(t=""+sW+e.id,e.current_iteration&&e.current_iteration>0&&(t=""+sW+e.id+"_"+e.current_iteration),t);
2if(localStorage.getItem(r))return;localStorage.setItem(r,"true")}catch(e){sH.error("Failed to persist survey seen state",e)}},sJ=["popover","widget","api"],sK={ignoreConditions:!1,ignoreDelay:!1,displayType:n$},sY=tZ("[PostHog ExternalIntegrations]"),sQ={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class sX{constructor(e){this._instance=e}Bt(e,t){var r;null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,e=>{if(e)return sY.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,r=function(e){var r,i,s;!n||null!=(r=f.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[e]||t.Bt(sQ[e],()=>{var r;null==(r=f.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[e])||r.start(t._instance)}),!n&&null!=(i=f.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]&&(null==(s=f.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[e])||s.stop())};for(var[i,n]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))r(i)}}var sZ={},s0=0,s1=()=>{},s2='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',s3="Surveys module not available",s4="sanitize_properties is deprecated. Use before_send instead",s5="Invalid value for property_denylist config: ",s6="posthog",s8=!sh&&-1===(null==p?void 0:p.indexOf("MSIE"))&&-1===(null==p?void 0:p.indexOf("Mozilla")),s7=e=>{var t;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!Z(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of r9)if(r===i)return!1;return!0}(null==a?void 0:a.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:s1,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&Z(null==l?void 0:l.search)&&-1!==l.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==n||null==(t=n.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){tX.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:rK,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:s1},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:iB,ignore_text_selection:!0}
2:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)})},s9=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],oe=e=>{var t={};for(var[r,i]of s9)X(e[r])||(t[i]=e[r]);var n=r4({},t,e),s=e.__preview_external_dependency_versioned_paths;return X(s)||(X(e.strict_script_versioning)&&(n.strict_script_versioning=!!s),Z(s)&&X(e.asset_host)&&(n.asset_host=s)),J(e.property_blacklist)&&(X(e.property_denylist)?n.property_denylist=e.property_blacklist:J(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:tX.error(s5+e.property_denylist)),n};class ot{constructor(){this.__forceAllowLocalhost=!1}get Li(){return this.__forceAllowLocalhost}set Li(e){tX.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class or{Fi(e,t){if(e){var r=this.Ai.indexOf(e);-1!==r&&this.Ai.splice(r,1)}return this.Ai.push(t),null==t.initialize||t.initialize(),t}Di(){return this.config.cookieless_mode===rW||this.config.cookieless_mode===rH&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new ot,this.$i=!1,this.version=m.LIB_VERSION,this.Ni=new sC,this.Ai=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=s7(),this.SentryIntegration=ni,this.sentryIntegration=e=>{var t;return t=nr(this,e),{name:nt,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.qi=!1,this.Bi=null,this.ji=null,this.Hi=null,this.scrollManager=new sI(this),this.pageViewManager=new nn(this),this.rateLimiter=new nU(this),this.requestRouter=new sz(this),this.consent=new ik(this),this.externalIntegrations=new sX(this);var e,t=null!=(e=or.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var i=Z(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Z(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",e=>tX.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,r){if(r&&r!==s6){var i,n=null!=(i=sZ[r])?i:new or;return n._init(e,t,r),sZ[r]=n,sZ[s6][r]=n,n}return this._init(e,t,r)}_init(e,t,r){void 0===t&&(t={});var i,s,o=Z(e)?e.trim():"";if(!o)return tX.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.Ui(t.debug),this.zi=t,this.Vi=[],t.person_profiles?this.ji=t.person_profiles:t.process_person&&(this.ji=t.process_person);var a=s7(t.defaults),l=oe(t),u=r4({},a,l,{name:r,token:o});Y(a.rageclick)&&Y(l.rageclick)&&(u.rageclick=r4({},a.rageclick,l.rageclick)),Y(a.session_recording)&&Y(l.session_recording)&&(u.session_recording=r4({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&tX.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:nV;var c=this.Wi();this.persistence=new nR(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nR(b({},this.config,{persistence:"sessionStorage"}),c,!1);var d=b({},this.persistence.props),h=b({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Gi=new sx(e=>this.Zi(e),this.config.request_queue_config),this.Qi=new sT(this),this.__request_queue=[];var p=this.Di();if(p||(this.sessionManager=new sF(this),this.sessionPropsManager=new sO(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(tX.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Ji(p)},0)):(tX.info("Initializing extensions synchronously"),this.Ji(p)),m.DEBUG=m.DEBUG||this.config.debug,m.DEBUG&&tX.info("Starting in debug mode",{this:this,config:t,thisC:b({},this.config),p:d,s:h}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=b({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
2)),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var f=t.bootstrap.distinctID,v=this.get_distinct_id(),g=this.persistence.get_property(rR);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==f&&g===rG)this.identify(f);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==f&&g===rJ)tX.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 _=this.config.get_device_id(id()),y=t.bootstrap.isIdentifiedID?_:f;this.persistence.set_property(rR,t.bootstrap.isIdentifiedID?rJ:rG),this.register({distinct_id:f,$device_id:y})}}if(p)this.register_once({distinct_id:rU,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(id());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(rR,rG)}return ie(n,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var i=r=>{var i=()=>r.anonymousId()||id();e.config.get_device_id=i,r.id()&&(e.register({distinct_id:r.id(),$device_id:i()}),e.persistence.set_property(rR,rJ)),t()},n=r.user();"then"in n&&K(n.then)?n.then(i):i(n)}(e,()=>{var i;r.register(("u">typeof Promise&&Promise.resolve||ne.warn("This browser does not have Promise support, and can not use the segment integration"),i=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ne.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ne.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var i=e.calculateEventProperties(r,t.event.properties);return t.event.properties=Object.assign({},i,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>i(e,e.event.event),page:e=>i(e,rX),identify:e=>i(e,r0),screen:e=>i(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Ki()):this.Ki(),K(this.config._onCapture)&&this.config._onCapture!==s1&&(tX.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tX.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return sM.apply(this,arguments)})().then(e=>{e&&this.register({[t4]:e})}).catch(s1),this}Ji(e){var t,r,i,n,s,o,a,l,u=performance.now(),c=b({},or.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this.Ai.push(this.featureFlags=null!=(t=this.featureFlags)?t:new c.featureFlags(this)),c.exceptions&&this.Ai.push(this.exceptions=null!=(r=this.exceptions)?r:new c.exceptions(this)),c.historyAutocapture&&this.Ai.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ai.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this.Ai.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ai.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ai.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ai.push(this.surveys=null!=(i=this.surveys)?i:new c.surveys(this)),c.logs&&this.Ai.push(this.logs=null!=(n=this.logs)?n:new c.logs(this)),c.metrics&&this.Ai.push(this.metrics=null!=(s=this.metrics)?s:new c.metrics(this)),c.conversations&&this.Ai.push(this.conversations=null!=(o=this.conversations)?o:new c.conversations(this)),c.productTours&&this.Ai.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ai.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ai.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ai.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ai.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,i7)),c.toolbar&&this.Ai.push(this.toolbar=null!=(a=this.toolbar)?a:new c.toolbar(this)),c.experiments&&this.Ai.push(this.experiments=null!=(l=this.experiments)?l:new c.experiments(this)),this.Ai.forEac
2h(e=>{e.initialize&&d.push(()=>{null==e.initialize||e.initialize()})}),d.push(()=>{if(this.Yi){var e=this.Yi;this.Yi=void 0,this.Tr(e)}}),this.Xi(d,u)}Xi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Xi(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){tX.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[rq]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rB]:i}),this.config.__preview_deferred_init_extensions&&tX.info("PostHog extensions initialized ("+i+"ms)")}Tr(e){var t;a&&a.body?(this.config.__preview_deferred_init_extensions&&(this.Yi=e),this.en=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=B(e.supportedCompression,nV)?nV:B(e.supportedCompression,nz)?nz:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ji?this.ji:rK}),this.Ai.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))):(tX.info("document not ready yet, trying again in 500 milliseconds..."),setTimeout(()=>{this.Tr(e)},500))}Ki(){try{this.config.loaded(this)}catch(e){tX.critical("`loaded` function failed",e)}if(this.tn(),this.config.internal_or_test_user_hostname&&null!=l&&l.hostname){var e=l.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Di())&&this.rn()},1),this.nn=new nB(this),this.nn.load()}tn(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Gi)||e.enable())}_dom_loaded(){this.is_capturing()&&r2(this.__request_queue,e=>this.Zi(e)),this.__request_queue=[],this.tn()}_handle_unload(){var e,t,r,i,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this.sn()&&this.capture(rZ),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this.Gi)||i.unload(),null==(n=this.Qi)||n.unload()):this.sn()&&this.capture(rZ,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?s8?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=b({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(X(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,i,n=b({},e);n.timeout=n.timeout||6e4,n.url=sE(n.url,n.compression);var s=null!=(t=n.transport)?t:"fetch",o=sk.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=null!=(r=null==(i=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===s)return e[t]}(o))?void 0:i.method)?r:o[0].method;if(!a)throw Error("No available transport method");"sendBeacon"!==s&&n.data&&n.compression===nV&&h&&"u">typeof Promise&&!sf?sw(n).then(e=>{a(e)}).catch(t=>{D(t)?(sf=!0,a(b({},n,{compression:void 0,url:sE(e.url,void 0)}))):((e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return D(e)||t===F})(t)&&(sf=!0),a(n))}):a(n)})(b({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}Zi(e){this.Qi?this.Qi.retriableRequest(e):this._send_request(e)}_execute_array(e){s0++;try{var t,r=[],i=[],n=[];r2(e,e=>
2{if(e)if(J(t=e[0]))n.push(e);else if(K(e))try{e.call(this)}catch(t){tX.error("Error executing queued PostHog call",e,t)}else J(e)&&"alias"===t?r.push(e):J(e)&&-1!==t.indexOf("capture")&&K(this[t])?n.push(e):i.push(e)});var s=function(e,t){r2(e,function(e){try{if(J(e[0])){var r=t;r3(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){tX.error("Error executing queued PostHog call",e,t)}})};s(r,this),s(i,this),s(n,this)}finally{s0--}}push(e){if(s0>0&&J(e)&&Z(e[0])){var t=or.prototype[e[0]];K(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var i,n,s,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Gi){if(this.is_capturing())if(!X(e)&&Z(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!Z(null==t?void 0:t.$current_url)&&(tX.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=r&&r.an||tX.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,d=(null==r?void 0:r.timestamp)||c,h=tu(null==r?void 0:r.uuid,id),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},d,h)};e===rX&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var f=null==r?void 0:r.$unset;f&&(p.$unset=f);var v,g,m,_=this.ln(null==r?void 0:r.$set_once,e!==r1,e===r0);if(_&&(p.$set_once=_),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,s=p,o=e=>Z(e)?e.slice(0,n):e,a=new Set,p=function e(t,r){var i;return t!==Object(t)?o?o(t):t:a.has(t)?void 0:(a.add(t),J(t)?(i=[],r2(t,t=>{i.push(e(t))})):(i={},r3(t,(t,r)=>{a.has(t)||(i[r]=e(t,r))})),i)}(s)),p.timestamp=d,X(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===nD||e===nN){var y=null==t?void 0:t.$survey_id,w=null==t?void 0:t.$survey_iteration;sG({id:y,current_iteration:w}),p.$set=b({},p.$set,{[(v={id:y,current_iteration:w},m="$survey_"+(g=e===nN?"responded":"dismissed")+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(m="$survey_"+g+"/"+v.id+"/"+v.current_iteration),m)]:!0})}else e===nM&&(p.$set=b({},p.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var S=null==t?void 0:t.$product_tour_type;S&&(p.$set=b({},p.$set,{["$product_tour_last_seen_date/"+S]:(new Date).toISOString()}))}var E=b({},p.properties.$set,p.$set);if(Q(E)||this.setPersonPropertiesForFlags(E),!er(this.config.before_send)){var k=this.it(p);if(!k)return;(p=k).uuid=tu(p.uuid,id)}this.Ni.emit("eventCaptured",p);var x={method:"POST",url:null!=(i=null==r?void 0:r._url)?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Zi(x):this.Gi.enqueue(x),p}tX.critical("This capture call is ignored due to client rate limiting.")}}else tX.error("No event name provided to posthog.capture")}else tX.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o,u=s?void 0:this.persistence.remove_event_timer(e),c=b({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.Di()&&(c.$cookieless_mode=!0),"$snapshot"===e){var d=b({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=d.distinct_id,(!Z(c.distinct_id)&&!ei(c.distinct_id)||ee(c.distinct_id))&&tX.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var h,f=function(e,t,r,i){if(void 0===i&&(i=!1),!p)return{};var s,o,a,u,c,d,h,f,v,g,_,y,b=e?[...ng,...t||[]]:[],[w,S]=function(e){for(var t=0;to.length>t;t++){var[r,i]=to[t],n=r.exec(e),s=n&&(K(i)?i(n,e):i);if(s)return s}return["",""]}(p),E=null!=(c="u">typeof navigator?navigator:void 0)&&c.brave?{brave:!0}:{},k={detectGoogleSearchApp:r},x=r4(r7({$os:w,$os_version:S,$browser:ti(p,navigator.vendor,E,k),$device:ta(p),$device_type:(h={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(o=navigator)?void 0:o.maxTouchPoints,screenWidth:null==n||null==(a=n.screen)?void 0:a.width,screenHeight:null==n||null==(u=n.screen)?void 0:u.height,devicePixelRatio:null==n?void 0:n.devicePixelRatio}
2,(y=ta(p))===ey||y===e_||"Kobo"===y||"Kindle Fire"===y||y===eK?em:y===e$||y===eU||y===ej||y===eW?"Console":y===ew?"Wearable":y?ev:"Android"===(null==h?void 0:h.userAgentDataPlatform)&&(null!=(f=null==h?void 0:h.maxTouchPoints)?f:0)>0?600>Math.min(null!=(v=null==h?void 0:h.screenWidth)?v:0,null!=(g=null==h?void 0:h.screenHeight)?g:0)/(null!=(_=null==h?void 0:h.devicePixelRatio)?_:1)?ev:em:"Desktop"),$timezone:nI(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:nd(i?tc(null==l?void 0:l.href):null==l?void 0:l.href,b,n_),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:p.length>1e3?p.substring(0,997)+"...":p,$browser_version:ts(p,navigator.vendor,E,k),$browser_language:nE(),$browser_language_prefix:"string"==typeof(d=nE())?d.split("-")[0]:void 0,$screen_height:null==n?void 0:n.screen.height,$screen_width:null==n?void 0:n.screen.width,$viewport_height:null==n?void 0:n.innerHeight,$viewport_width:null==n?void 0:n.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=m.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:v,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());c.$session_id=v,c.$window_id=g}this.sessionPropsManager&&r4(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&r4(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(o=this.Qi)?void 0:o.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===sq&&(c.$lib_custom_api_host=this.config.api_host),h=e!==rX||s?e!==rZ||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),c=r4(c,h),e===rX&&a&&(c.title=a.title),!X(u)){var _=r.getTime()-u;c.$duration=parseFloat((_/1e3).toFixed(3))}p&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=r4({},f,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),J(this.config.property_denylist)?r3(this.config.property_denylist,function(e){delete c[e]}):tX.error(s5+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(tX.error(s4),c=y(c,e));var w=this.un();return c.$process_person_profile=w,w&&!s&&this.hn("_calculate_event_properties"),c}ln(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this.un()||this.$i&&!r)return e;var i,n=r4({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),s=this.config.sanitize_properties;return s&&(tX.error(s4),n=s(n,"$set_once")),t&&(this.$i=!0),Q(n)?void 0:n}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}dn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}isFeatureEnabled(e,t){var r;return null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.Ni.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:s3}),()=>{})}onSessionId(e){var t,r;return null!=(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:s3})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:s3})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=sK),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!=(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))?t:{visible:!1,disabledReason:s3}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!=(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))?r:Promise.resolve({visible:!1,disabledReason:s3})}cn(e){return!e||ee(e)?(tX.critical("Unique user id has not been set in posthog.identify"),!1):e===rU?(tX.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())||(tX.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
2ot a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return tX.uninitializedWarning("posthog.identify");if(ei(e)&&(e=e.toString(),tX.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.cn(e)&&this.hn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(t3)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(t5)&&(this.unregister(t5),this.register({distinct_id:e}));var n,s=(this.persistence.get_property(rR)||rG)===rG;e!==i&&s?(this.persistence.set_property(rR,rJ),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(r0,{distinct_id:e,$anon_distinct_id:i},{$set:t||{},$set_once:r||{}}),this.Hi=sN(e,t,r),null==(n=this.featureFlags)||n.setAnonymousDistinctId(i)):(t||r)&&this.setPersonProperties(t,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(rI))}}setPersonProperties(e,t){if((e||t)&&this.hn("posthog.setPersonProperties")){var r=sN(this.get_distinct_id(),e,t);this.Hi!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Hi=r):tX.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(J(e)?e:[e]).filter(e=>Z(e)&&e.length>0);0!==r.length&&this.hn("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Hi=null)}group(e,t,r){if(e&&t){var i=this.getGroups(),n=i[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b({},i,{[e]:t})}),n||r){var s={$group_type:e,$group_key:t};r&&(s.$group_set=r),this.capture(r1,s)}r&&this.setGroupPropertiesForFlags({[e]:r}),n&&!r&&this.reloadFeatureFlags()}else tX.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this.hn("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(tX.info("reset"),!this.__loaded)return tX.uninitializedWarning("posthog.reset");var t,r,i,n,s,o,a,l,u,c,d,h=this.get_property(t3),p=this.get_property(t4),f=this.get_property(ro);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),X(f)||null==(d=this.persistence)||d.register({[ro]:f}),null==(i=this.surveys)||i.reset(),null==(n=this.nn)||n.stop(),null==(s=this.featureFlags)||s.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(rR,rG),null==(c=this.sessionManager)||c.resetSessionId(),this.Hi=null,this.config.cookieless_mode===rW)this.register_once({distinct_id:rU,$device_id:null},"");else{var v=this.config.get_device_id(id());this.register_once({distinct_id:v,$device_id:e?v:h},""),e||X(p)||this.register({[t4]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return y(function*(){var e,r,i,n,s;t.__loaded?(null==(e=t.logs)||e.flushLogs("sendBeacon"),null==(r=t.metrics)||r.flush("sendBeacon"),null==(i=t.Gi)||i.unload(),null==(n=t.Qi)||n.unload(),null==(s=t.featureFlags)||s.destroy()):tX.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r.vn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.fn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&r){var n,s=null!=(n=e.timestampLookBack)?n:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return i}alias(e,t){return e===this.get_property(t2)?(tX.critical("Attempting to create alias for existing People user - aborting."),-2):this.hn("posthog.alias")?(X(t)&&(t=this.get_distinct_id()),e!==t?(this.dn(t5,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tX.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(Y(e)){r4(this.config,oe(e));var r,i,n,s,o,a,l,u,c,d,h,p=this.Wi();null==(r=this.persistence)||r.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nR(b({},this.config,{persistence:"sessionStorage"}),p,!1);var f=this.Ui(this.config.debug);es(f)&&(this.config.debug=f),es(this.config.debug)&&(this.config.debug?(m.DEBUG=!0,i_.N()&&i_.q("ph_debug",!0),tX.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(m.DEBUG=!1,i_.N()&&i_.P("ph_debug"))),null==(i=this.exceptionObserver)||i.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||
2c.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.pn(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){m.LIB_NAME=e,m.LIB_VERSION=t}startSessionRecording(e){var t,r,i,n,s,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(b({},i,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:or.gn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!=(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:s6;return t!==s6&&(t=s6+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(rR))===rJ||(null==(t=this.sessionPersistence)?void 0:t.get_property(rR))===rJ}un(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===rK&&!this._isIdentified()&&Q(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[t5])&&(null==(t=this.persistence)||null==(t=t.props)||!t[r$]))}sn(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.un()||this.hn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.hn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}hn(e){return"never"===this.config.person_profiles?(tX.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.dn(r$,!0),!0)}Wi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==rH)}pn(){var e,t,r,i,n=this.Wi();return(null==(e=this.persistence)?void 0:e.rr)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t.rr)!==n&&(null==(i=this.sessionPersistence)||i.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==rW){if(this.Di()){this.reset(!0),null==(n=this.sessionManager)||n.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new sF(this),this.pageViewManager=new nn(this),this.persistence&&(this.sessionPropsManager=new sO(this,this.sessionManager,this.persistence));var r,i,n,s,o,a,l,u,c=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=or.__defaultExtensionClasses)?void 0:l.sessionRecording;c&&(this.sessionRecording=this.Fi(this.sessionRecording,new c(this)),this.en&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.en)))}this.consent.optInOut(!0),this.pn(),this.tn(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==rH&&(null==(r=this.surveys)||r.loadIfEnabled()),(X(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(i=null==e?void 0:e.captureEventName)?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.rn()}else tX.warn(s2)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==rW?(this.config.cookieless_mode===rH&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.pn(),this.config.cookieless_mode===rH&&(this.register({distinct_id:rU,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewM
2anager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.rn(),this.tn())):tX.warn(s2)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===rW||(this.config.cookieless_mode===rH?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.pn()}_is_bot(){return o?sL(o,this.config.custom_blocked_useragents):void 0}rn(){a&&("visible"===a.visibilityState?this.qi||(this.qi=!0,this.capture(rX,{title:a.title},{send_instantly:!0}),this.Bi&&(a.removeEventListener(rY,this.Bi),this.Bi=null)):this.Bi||(this.Bi=this.rn.bind(this),ie(a,rY,this.Bi)))}debug(e){!1===e?(null==n||n.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==n||n.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}))}Er(){var e,t,r,i,n=this.zi||{};return"advanced_disable_flags"in n?!!n.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tX.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(t="advanced_disable_decide",r=(e="advanced_disable_flags")in n&&!er(n[e]),i=t in n&&!er(n[t]),r?n[e]:!!i&&(tX&&tX.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),n[t]))}it(e){if(er(this.config.before_send))return e;var t,r=Object.keys(null!=(t=e.properties)?t:{}).filter(ea),i=J(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var s of i){if(er(n=s(n))){var o="Event '"+e.event+"' was rejected in beforeSend function";return eo(e.event)?tX.warn(o+". This can cause unexpected behavior."):tX.info(o),null}n.properties&&!Q(n.properties)||tX.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of r)if(n.properties&&er(n.properties[a]))return tX.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return n}getPageViewId(){var e;return null==(e=this.pageViewManager.Ut)?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)})}Ui(e){var t=es(e)&&!e,r=i_.N()&&"true"===i_.A("ph_debug");return!t&&(!!r||e)}}or.__defaultExtensionClasses={},or.gn={trace:r=()=>{},debug:r,info:r,warn:r,error:r,fatal:r},function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=r8(e.prototype[t[r]])}(or,["identify"]);class oi{constructor(e){this.disabled=!1===e;var t=Y(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var on="$copy_autocapture",os=tZ("[AutoCapture]");function oo(e,t){return t.length>e?t.slice(0,e)+"...":t}var oa=tZ("[ExceptionAutocapture]"),ol=()=>{},ou=tZ("[TracingHeaders]"),oc=tZ("[Web Vitals]"),od="disabled",oh="lazy_loading",op="awaiting_config",of="missing_config";tZ("[SessionRecording]"),tZ("[SessionRecording]");var ov="[SessionRecording]",og=tZ(ov),om=tZ("[Heatmaps]");function o_(e){return Y(e)&&"clientX"in e&&"clientY"in e&&ei(e.clientX)&&ei(e.clientY)}var oy=tZ("[Product Tours]"),ob=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(rn))},ow=["$set_once","$set"],oS=tZ("[SiteApps]"),oE="Error while initializing PostHog app with config id ";function ok(e,t,r){if(er(e))return!1;switch(r){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class ox{constructor(e){this.mn=new sC,this.yn=(e,t)=>this.bn(e,t)&&this._n(e,t)&&this.wn(e,t)&&this.xn(e,t),this.bn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.kn=new Set,this.Sn=new Set}init(){var e,t;X(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,r;if(!X(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
2=>{var t,r;null==(t=this.Sn)||t.add(e),null==(r=e.steps)||r.forEach(e=>{var t;null==(t=this.kn)||t.add((null==e?void 0:e.event)||"")})}),null!=(r=this._instance)&&r.autocapture)){var i,n=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&n.add(null==e?void 0:e.selector)})}),null==(i=this._instance)||i.autocapture.setElementSelectors(n)}}on(e,t){var r;null!=t&&0!=e.length&&(this.kn.has(e)||this.kn.has(null==t?void 0:t.event))&&this.Sn&&(null==(r=this.Sn)?void 0:r.size)>0&&this.Sn.forEach(e=>{this.Cn(t,e)&&this.mn.emit("actionCaptured",e.name)})}In(e){this.onAction("actionCaptured",t=>e(t))}Cn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this.yn(e,r))return!0;return!1}onAction(e,t){return this.mn.on(e,t)}_n(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i||!ok(i,t.url,t.url_matching||"contains"))return!1}return!0}wn(e,t){return!!this.Tn(e,t)&&!!this.Mn(e,t)&&!!this.En(e,t)}Tn(e,t){if(null==t||!t.href)return!0;var r=this.Pn(e);if(r.length>0)return r.some(e=>ok(e.href,t.href,t.href_matching||"exact"));var i,n,s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!s&&ok((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Mn(e,t){if(null==t||!t.text)return!0;var r=this.Pn(e);if(r.length>0)return r.some(e=>ok(e.text,t.text,t.text_matching||"exact")||ok(e.$el_text,t.text,t.text_matching||"exact"));var i,n,s,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(n=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!er(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),s=t.text,o=t.text_matching||"exact",n.some(e=>ok(e,s,o)))}En(e,t){if(null==t||!t.selector)return!0;var r,i,n=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=n&&n.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){}return!1}Pn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}xn(e,t){return null==t||!t.properties||0===t.properties.length||sU(t.properties.reduce((e,t)=>{var r=J(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class oP{constructor(e){this.Rn=[],this._instance=e,this.On=new Map,this.Ln=new Map,this.Fn=new Map}An(e,t){return!!e&&sU(e.propertyFilters,null==t?void 0:t.properties)}Dn(e,t){var r=new Map;return e.forEach(e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}})}),r}$n(e,t,r){var i=(r===nF?this.On:this.Ln).get(e),n=[];return this.Nn(e=>{n=e.filter(e=>null==i?void 0:i.includes(e.id))}),n.filter(i=>{var n,s=null==(n=i.conditions)||null==(n=n[r])||null==(n=n.values)?void 0:n.find(t=>t.name===e);return this.An(s,t)})}register(e){var t;X(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.qn(e),this.Bn(e))}Bn(e){var t=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0});0!==t.length&&(null==this.jn&&(this.jn=new ox(this._instance),this.jn.init(),this.jn.In(e=>{this.onAction(e)})),t.forEach(e=>{var t,r,i,n,s;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(r=e.conditions)&&null!=(r=r.actions)&&r.values&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0&&(null==(n=this.jn)||n.register(e.conditions.actions.values),null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||s.forEach(t=>{if(t&&t.name){var r=this.Fn.get(t.name);r&&r.push(e.id),this.Fn.set(t.name,r||[e.id])}}))}))}qn(e){var t,r=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0}),i=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0});0===r.length&&0===i.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.On=this.Dn(e,nF),this.Ln=this.Dn(e,nL))}onEvent(e,t){var r,i,n=this.Hn(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var o=this.Un(e,s);if("consume"===o)return n.info("event consumed activated item, remov
2ing it",{event:e,itemId:s}),void this.zn([s]);if("persist"===o)return n.info("shown item promoted to persisted activation",{event:e,itemId:s}),void this.Vn(s)}if(this.Ln.has(e)){var a=this.$n(e,t,nL);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(e=>e.id)}),this.zn(a.map(e=>e.id)),a.forEach(e=>this.Wn(e.id)))}if(this.On.has(e)){n.info("event name matched",{event:e,eventPayload:t,items:this.On.get(e)});var l=this.$n(e,t,nF);this.Gn(l.map(e=>e.id))}}onAction(e){this.Fn.has(e)&&this.Gn(this.Fn.get(e)||[])}Gn(e){0!==e.length&&(this.Rn=[...new Set([...this.Rn,...e])],this.Hn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Vn(e){this.Rn=this.Rn.filter(t=>t!==e);var t=this.Zn();t.includes(e)||this.Qn([...t,e])}zn(e){var t=new Set(e);this.Rn=this.Rn.filter(e=>!t.has(e));var r=this.Zn(),i=r.filter(e=>!t.has(e));i.length!==r.length&&this.Qn(i)}Zn(){var e,t=this.Jn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getActivatedIds(){return[...new Set([...this.Zn(),...this.Rn])].filter(e=>!this.Kn(e))}reset(){this.Rn=[],this.Zn().length>0&&this.Qn([])}getEventToItemsMap(){return this.On}Yn(){return this.jn}}class oT extends oP{constructor(e){super(e)}Jn(){return rP}Xn(){return nM}Nn(e){var t;null==(t=this._instance)||t.getSurveys(e)}Wn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Hn(){return sH}Qn(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[rP]:e})}Kn(){return!1}Un(e,t){var r,i,n,s,o,a;return this.Nn(e=>{a=e.find(e=>e.id===t)}),!a||(o=(null!=(i=null==(n=(r=a).conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)?i:0)>0,"always"===r.schedule||null!=(s=r.conditions)&&null!=(s=s.events)&&s.repeatedActivation&&o)?e===nM?"consume":"ignore":e===nM?"persist":e===nD||e===nN?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var oI="SDK is not enabled or survey functionality is not yet loaded",oA="Disabled. Not loading surveys.",oO=null!=n&&n.location?nh(n.location.hash,"__posthog")||nh(location.hash,"state"):null,oC="_postHogToolbarParams",oR=tZ("[Toolbar]"),oF=tZ("[FeatureFlags]"),oL=tZ("[FeatureFlags]",{debugEnabled:!0}),oM="\" failed. Feature flags didn't load in time.",oD=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},oN=e=>{var t={};for(var[r,i]of r5(e||{}))i&&(t[r]=i);return t},o$=tZ("[Error tracking]"),oj="Refusing to render web experiment since the viewer is a likely bot",oU={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>sD(t,e),not_regex:(e,t)=>!sD(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class oq{get Se(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{oq.es("retrieved web experiments from the server"),t.ts=new Map,e.forEach(e=>{if(e.feature_flag_key){t.ts&&(oq.es("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t.ts)||r.set(e.feature_flag_key,e));var r,i=t._instance.getFeatureFlag(e.feature_flag_key);Z(i)&&e.variants[i]&&t.rs(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var n in e.variants){var s=e.variants[n];oq.ns(s,t._instance)&&t.rs(e.name,n,s.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())oq.es(oj);else if(!this.Se.disable_web_experiments){if(er(this.ts))return this.ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();oq.es("applying feature flags",e),e.forEach(e=>{var t;if(this.ts&&null!=(t=this.ts)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),n=null==(r=this.ts)?void 0:r.get(e);i&&null!=n&&n.variants[i]&&this.rs(n.name,i,n.variants[i].transforms)}})}}previewWebExperiment(){var e=oq.getWindowLocation();if(null!=e&&e.search){var t=nc(null==e?void 0:e.search,"__experiment_id"),r=nc(null==e?void 0:e.search,"__experiment_variant");t&&r&&(oq.es("previewing web experiments "+t+" && "+r),this.getWebExperiments(e=>{this.ss(parseInt(t),r,e)},!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.Se.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}ss(e,t,r){var i=r.filter(t=>t.id===e);i&&i.length>0&&(oq.es("Previewing web experiment ["+i[0].name+"] with variant ["+t+"]"),this.rs(i[0].name,t,i[0].variants[t].transforms))}static ns(e,t){return!er(e.conditions)&&oq.os(e,t)&&oq.ls(e)}static os(e,t){if(er(e.conditions)||er(null==(i=e.conditions)?void 0:i.url))return!0;var r=oq.getWindowLocation();if(r){var i,n,s,o,a=ix(t,r.href);return null==(n=e.conditions)||!n.url||oU[null!=(s=null==(o=e.conditions)?void 0:o.urlMatchType)?s:"icontains"](e.conditions.url,a)}return!1}
2static getWindowLocation(){return null==n?void 0:n.location}static ls(e){if(er(e.conditions)||er(null==(r=e.conditions)?void 0:r.utm))return!0;var t=nb();if(t.utm_source){var r,i,n,s,o,a,l,u,c,d=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_campaign)==t.utm_campaign,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,f=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return d&&p&&f&&h}return!1}static es(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];tX.info("[WebExperiments] "+e,r)}rs(e,t,r){this._is_bot()?oq.es(oj):"control"!==t?r.forEach(r=>{if(r.selector){oq.es("applying transform of variant "+t+" for experiment "+e+" ",r);var i,n=null==(i=document)?void 0:i.querySelectorAll(r.selector);null==n||n.forEach(e=>{r.html&&(e.innerHTML=r.html),r.css&&e.setAttribute("style",r.css)})}}):oq.es("Control variants leave the page unmodified.")}_is_bot(){return o&&this._instance?sL(o,this.Se.custom_blocked_useragents):void 0}}var oB=tZ("[Conversations]"),oV="Conversations not available yet.",oz="console",oH={featureFlags:class{constructor(e){this.us=!1,this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.ps=!1,this.gs=!1,this.ys=0,this.bs=()=>{var e=this._s();this.ys=0,e&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],n&&ie(n,"online",this.bs)}destroy(){null==n||n.removeEventListener("online",this.bs)}get Se(){return this._instance.config}get ti(){return this._instance.persistence}ws(e){return this._instance.get_property(e)}xs(){var e,t;return null!=(e=null==(t=this.ti)?void 0:t.nr(this.Se.feature_flag_cache_ttl_ms))&&e}ks(){return!!this.xs()&&(this.gs||this.ds||(this.gs=!0,oF.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ss(){var e,t=null!=(e=this.Se.evaluation_contexts)?e:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ps||(oF.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ps=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||oF.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Cs(){return this.Ss().length>0}Is(){var e=this.Se.flag_keys;if(!X(e)){if(J(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||oF.error("Invalid flag key found:",e,"Expected non-empty string"),t});oF.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:r}=this._instance,i=null!=(e=null==(t=r.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(i).length){var n,s,o=null!=(n=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)?n:{},a=Object.keys(i).filter(e=>!!i[e]).reduce((e,t)=>(e[t]=i[t]||!1,e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(o[t]&&(e[t]=o[t]),e),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,r){var i,n,s=null!=r&&r.merge&&null!=(i=this.ws(rf))?i:{},o=null!=r&&r.merge&&null!=(n=this.ws(r_))?n:{},a=b({},s,e),l=b({},o,t),u={};for(var[c,d]of Object.entries(a))u[c]={key:c,enabled:E(d),variant:k(d),reason:void 0,metadata:X(null==l?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.hs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ws(rm),t=this.ws(rb),r=this.ws(rw);if(!r&&!t)return e||{};var i=r4({},e||{});for(var n of[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])]){var s,o,a=i[n],l=null==t?void 0:t[n],u=X(l)?null!=(s=null==a?void 0:a.enabled)&&s:!!l,c=X(l)?a.variant:"string"==typeof l?l:void 0,d=null==r?void 0:r[n],h=b({},a,{enabled:u,variant:u?null!=c?c:null==a?void 0:a.variant:void 0});u!==(null==a?void 0:a.enabled)&&(h.original_enabled=null==a?void 0:a.enabled),c!==(null==a?void 0:a.variant)&&(h.original_variant=null==a?void 0:a.variant),d&&(h.metadata=b({},null==a?void 0:a.metadata,{payload:d,original_payload:null==a||null==(o=a.metadata)?void 0:o.payload})),i[n]=h}return this.us||(oF.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}
2),this.us=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(r=>{var i=e[r];return{key:r,enabled:E(i),variant:k(i),payload:S(t[r])}})}getFlagVariants(){var e=this.ws(rf),t=this.ws(rb);if(!t)return e||{};for(var r=r4({},e),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this.us||(oF.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.us=!0),r}getFlagPayloads(){var e=this.ws(r_),t=this.ws(rw);if(!t)return e||{};for(var r=r4({},e||{}),i=Object.keys(t),n=0;i.length>n;n++)r[i[n]]=t[i[n]];return this.us||(oF.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.us=!0),r}reloadFeatureFlags(){this.cs||this.Se.advanced_disable_feature_flags||this._s()||this.Ts||(this._instance.Ni.emit("featureFlagsReloading",!0),this.Ts=setTimeout(()=>{this.Ms()},5))}Es(){clearTimeout(this.Ts),this.Ts=void 0}ensureFlagsLoaded(){this.hs||this.ds||this.Ts||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.cs=e}Ms(e){var t;if(this.Es(),!this._instance.Er()&&!this._s())if(this.ds)this.vs=!0;else{var r=this.Se.token,i=this.ws(t3),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:b({},(null==(t=this.ti)?void 0:t.get_initial_props())||{},this.ws(rS)||{}),group_properties:this.ws(rE),timezone:nI()};et(i)||X(i)||(n.$device_id=i),(null!=e&&e.disableFlags||this.Se.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.Cs()&&(n.evaluation_contexts=this.Ss());var s=this.Is();X(s)||(n.flag_keys=s);var o=!!this.Se.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ds=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this.Se.disable_compression?void 0:nz,timeout:this.Se.feature_flag_request_timeout_ms,callback:e=>{var t,r,i,s=!0;if(this.Ps(e.statusCode),200===e.statusCode&&(this.vs||(this.$anon_distinct_id=void 0),s=!1),this.ds=!1,!n.disable_flags||this.vs){this.fs=!s;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(r=e.json)||null==(r=r.quotaLimited)||!r.includes("feature_flags"));(u&&a.push("quota_limited"),null==(i=this.ti)||i.register({[rO]:a}),u)?oF.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."):(n.disable_flags||this.receivedFeatureFlags(null!=(l=e.json)?l:{},s,{partialResponse:o}),this.vs&&(this.vs=!1,this.Ms()))}}})}}_s(){return np(this.ys,3)}Ps(e){this.ys=nf(e,this.ys,3,()=>oF.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var i=this.getFeatureFlagResult(e,t);return null!=(r=null==i?void 0:i.variant)?r:null==i?void 0:i.enabled}}else oF.warn('getFeatureFlag for key "'+e+oM)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.fs)if(this.hs||this.getFlags()&&this.getFlags().length>0){if(!this.ks()){var r=this.getFlagVariants(),i=e in r,n=r[e],s=this.getFlagPayloads()[e],o=String(n),a=this.ws(ry)||void 0,l=this.ws(rC)||void 0,u=this.ws(rI)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this.ws(rA);d&&d!==h&&(u={},null==(c=this.ti)||c.register({[rI]:u,[rA]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){J(u[e])?u[e].push(o):u[e]=[o],null==(g=this.ti)||g.register({[rI]:u});var p=this.getFeatureFlagDetails(e),f=[...null!=(m=this.ws(rO))?m:[]];X(n)&&f.push("flag_missing");var v={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(_=this.Se.bootstrap)||null==(_=_.featureFlags)?void 0:_[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.Se.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.fs};X(null==p||null==(b=p.metadata)?void 0:b.version)||(v.$feature_flag_version=p.metadata.version);var g,m,_,y,b,w,E,k,x,P,T,I=null!=(w=null==p||null==(E=p.reason)?void 0:E.description)?w:null==p||null==(k=p.reason)?void 0:k.code;I&&(v.$feature_flag_reason=I),null!=p&&null!=(x=p.metadata)&&x.id&&(v.$feature_flag_id=p.metadata.id),X(null==p?void 0:p.original_variant)&&X(null==p?void 0:p.original_enabled)||(v.$feature_flag_original_response=X(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(P=p.metadata)&&P.original_payload&&(v.$feature_flag_original_payload=null==p||null==(T=p.metadata)?void 0:T.original_payload),f.length&&(v.$feature_flag_error=f.join(",")),this._instance.capture("$feature_flag_called",v)}if(i)return{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:S(s)}}}else oF.warn('getFeatureFlagResult for key "'+e+oM)}getRemoteConfigPayload(e,t){var r=this.Se.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Cs()&&(i.evaluation_contexts=this.Ss());var n=this.Is();X(n)||(i.flag_keys=n),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Se.disable_compression?void 0:nz,timeout:this.Se.feature_flag_request_timeout_ms,callback(r){var i,n=null==(i=r.json)?void 0:i.featureFlagPayloads;t((null==n?void 0:n[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.fs){if(this.hs||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return X(r)?void 0:!!r}oF.warn('isFeatureEnabled for key "'+e+oM)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){if(this.ti){this.hs=!0;var i=this.getFlagVariants(),n=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,r,i,n,s){void 0===r&&(r={}),void 0===i&&(i={}),void 0===n&&(n={});var o,a=((o=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(o).map(e=>{var t;return[e,null!=(t=o[e].variant)?t:o[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(o).filter(e=>o[e].enabled).filter(e=>{var t;return null==(t=o[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=o[e].metadata)?void 0:t.payload]}))):e.featureFlags&&oF.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=a.flags,u=a.featureFlags,c=a.featureFlagPayloads;if(u){var d=e.requestId,h=e.evaluatedAt;if(J(u)){oF.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var f=0;u.length>f;f++)p[u[f]]=!0;t&&t.register({[rv]:u,[rf]:p})}else{var v=u,g=c,m=l;if(null!=s&&s.partialResponse)v=b({},r,v),g=b({},i,g),m=b({},n,m);else if(e.errorsWhileComputingFlags)if(l){var _=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));v=b({},r,Object.fromEntries(Object.entries(v).filter(e=>{var[t]=e;return _.has(t)}))),g=b({},i,Object.fromEntries(Object.entries(g||{}).filter(e=>{var[t]=e;return _.has(t)}))),m=b({},n,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return _.has(t)})))}else v=b({},r,v),g=b({},i,g),m=b({},n,m);t&&t.register(b({[rv]:Object.keys(oN(v)),[rf]:v||{},[r_]:g||{},[rm]:m||{}},d?{[ry]:d}:{},h?{[rC]:h}:{}))}}}(e,this.ti,i,n,s,r),t||(this.gs=!1),this.Rs(t)}}override(e,t){void 0===t&&(t=!1),oF.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ti)return oF.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.ti.unregister(rb),this.ti.unregister(rw),this.Rs(),oL.info("All overrides cleared");if(J(e)){var t,r=oD(e);return this.ti.register({[rb]:r}),this.Rs(),oL.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.us=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.ti.unregister(rb),oL.info("Flag overrides cleared");else if(e.flags){if(J(e.flags)){var i=oD(e.flags);this.ti.register({[rb]:i})}else this.ti.register({[rb]:e.flags});oL.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.ti.unregister(rw),oL.info("Payload overrides cleared")):e.payloads&&(this.ti.register({[rw]:e.payloads}),oL.info("Payload overrides set",{payloads:e.payloads}))),void this.Rs()}if(e&&"object"==typeof e)return this.ti.register({[rb]:e}),this.Rs(),oL.info("Flag overrides set",{flags:e});oF.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.hs){var{flags:t,flagVariants:r}=this.Os();try{e(t,r)}catch(e){oF.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,n=(this.ws(rg)||[]).find(t=>t.flagKey===e),s={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:s};n&&(o.$early_access_feature_name=n.name),r&&(o.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=b({},this.getFlagVariants(),{[e]:t});null==(i=this.ti)||i.register({[rv]:Object.keys(oN(a)),[rf]:a}),this.Rs()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this.ws(rg),n=r?"&"+r.map(e=>"stage="+e).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+n),method:"GET",callback:t=>{var r,i;if(t.json){var n=t.json.earlyAccessFeatures;return null==(r=this.ti)||r.unregister(rg),null==(i=this.ti)||i.register({[rg]:n}),e(n)}}})}Os(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,r)=>(e[r]=t[r],e),{})}}Rs(e){var{flags:t,flagVariants:r}=this.Os();
2this.featureFlagEventHandlers.forEach(i=>{try{i(t,r,{errorsLoading:e})}catch(e){oF.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.ws(rS)||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,s={};if(n)for(var o in n)({}).hasOwnProperty.call(n,o)&&(o in r||(s[o]=n[o]));this._instance.register({[rS]:b({},r,s,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=b({},this.ws(rS)||{});e.forEach(e=>{delete r[e]}),this._instance.register({[rS]:r}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(rS),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.ws(rE)||{};0!==Object.keys(r).length&&Object.keys(r).forEach(t=>{r[t]=b({},r[t],e[t]),delete e[t]}),this._instance.register({[rE]:b({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ws(rE)||{};this._instance.register({[rE]:b({},t,{[e]:{}})})}else this._instance.unregister(rE)}reset(){this.hs=!1,this.ds=!1,this.cs=!1,this.vs=!1,this.fs=!1,this.$anon_distinct_id=void 0,this.Es(),this.us=!1,this.ys=0}}},oW=b({productTours:class{get ti(){return this._instance.persistence}constructor(e){this.zo=null,this.Vo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,r;if(this.ti&&this.ti.register({[rn]:!!e.productTours}),!ob(this._instance))return!this.zo&&er(null==(t=this.ti)?void 0:t.props[rT])||oy.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.zo)||r.stop(),this.zo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.zo&&ob(this._instance)&&this.Bt(()=>this.Wo())}Bt(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",t=>{t?oy.error("Could not load product tours script",t):e()})}Wo(){var e;!this.zo&&null!=(e=f.__PosthogExtensions__)&&e.generateProductTours&&(this.zo=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!J(this.Vo)||t){var r=this.ti;if(r){var i=r.props[rT];if(J(i)&&!t)return this.Vo=i,void e(i,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{if(ob(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var n="Product Tours API could not be loaded, status: "+i;return oy.error(n),void e([],{isLoaded:!1,error:n})}var s=J(t.json.product_tours)?t.json.product_tours:[];this.Vo=s,r&&r.register({[rT]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Vo,{isLoaded:!0})}getActiveProductTours(e){er(this.zo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.zo.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.zo)||t.showTourById(e)}previewTour(e){this.zo?this.zo.previewTour(e):this.Bt(()=>{var t;this.Wo(),null==(t=this.zo)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.zo)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.zo)||e.nextStep()}previousStep(){var e;null==(e=this.zo)||e.previousStep()}clearCache(){var e;this.Vo=null,null==(e=this.ti)||e.unregister(rT)}resetTour(e){var t;null==(t=this.zo)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.zo)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.zo)||t.cancelPendingTour(e)}}},oH),oG=b({surveys:class{get Se(){return this._instance.config}constructor(e){this.ua=void 0,this._surveyManager=null,this.ha=!1,this.da=[],this.ca=null,this.va=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Se.disable_surveys){var t=e.surveys;if(er(t))return sH.warn("Flags not loaded yet. Not loading surveys.");var r=J(t);this.ua=r?t.length>0:t,sH.info("flags response received, isSurveysEnabled: "+this.ua),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith(sW)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}
2t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this.ha)sH.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)sH.info(oA);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())sH.info("Not loading surveys in cookieless mode without consent.");else{var e=null==f?void 0:f.__PosthogExtensions__;if(e){if(!X(this.ua)||this.Se.advanced_enable_surveys){var t=this.ua||this.Se.advanced_enable_surveys;this.ha=!0;try{var r=e.generateSurveys;if(r)return void this.fa(r,t);var i=e.loadExternalDependency;if(!i)return void this.pa(rz);i(this._instance,"surveys",r=>{r||!e.generateSurveys?this.pa("Could not load surveys script",r):this.fa(e.generateSurveys,t)})}catch(e){throw this.pa("Error initializing surveys",e),e}finally{this.ha=!1}}}else sH.error("PostHog Extensions not found.")}}fa(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new oT(this._instance),sH.info("Surveys loaded successfully"),this.ga({isLoaded:!0})}pa(e,t){sH.error(e,t),this.ga({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.da.push(e),this._surveyManager&&this.ga({isLoaded:!0}),()=>{this.da=this.da.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Se.disable_surveys)return sH.info(oA),e([]);var r,i=this._instance.get_property(rk);i&&!t?(e(i,{isLoaded:!0}),this.ma()&&this.getSurveys(()=>{},!0)):"u">typeof Promise&&this.ca?this.ca.then(t=>{var{surveys:r,context:i}=t;return e(r,i)}):("u">typeof Promise&&(this.ca=new Promise(e=>{r=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:t=>{this.ca=null;var i=t.statusCode;if(200!==i||!t.json){var n="Surveys API could not be loaded, status: "+i;sH.error(n),this.va=Date.now();var s={isLoaded:!1,error:n};return e([],s),void(null==r||r({surveys:[],context:s}))}this.va=null;var o,a,l=t.json.surveys||[],u=l.filter(e=>{var t,r;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)||!r.length))});u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(o=this._instance.persistence)||o.register({[rk]:l,[rx]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}ma(){return this.ya()&&!this.ca&&!this.ba()}ya(){var e=this._instance.get_property(rx);return ei(e)&&Date.now()-e>3e5}ba(){return ei(this.va)&&3e5>Date.now()-this.va}markSurveyAsSeen(e,t){var r;sG({id:e,current_iteration:null!=(r=null==t?void 0:t.iteration)?r:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}ga(e){for(var t of this.da)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){sH.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!er(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);sH.warn("init was not called")}_a(e){var t=null;return this.getSurveys(r=>{var i;t=null!=(i=r.find(t=>t.id===e))?i:null}),t}wa(e){if(er(this._surveyManager))return{eligible:!1,reason:oI};var t="string"==typeof e?this._a(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(er(this._surveyManager))return sH.warn("init was not called"),{visible:!1,disabledReason:oI};var t=this.wa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return er(this._surveyManager)?(sH.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:oI})):new Promise(r=>{this.getSurveys(t=>{var i,n=null!=(i=t.find(t=>t.id===e))?i:null;if(n){var s=this.wa(n);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var i;if(er(this._surveyManager))sH.warn("init was not called");else{var n="string"==typeof e?this._a(e):e;if(null!=n&&n.id)if(sJ.includes(n.type)){var s=null==a?void 0:a.querySelector(t);if(s)return null!=(i=n.appearance)&&i.surveyPopupDelaySeconds?(sH.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;sH.info("Rendering survey "+n.id+" with delay of "+(null==(e=n.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(n,s,r),sH.info("Survey "+n.id+" rendered")},1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,s,r);sH.warn("Survey element not found")}else sH.warn("Surveys of type "+n.type+" cannot be rendered in the app");else sH.warn("Survey not found")}}displaySurvey(e,t){var r;if(er(this._surveyManager))sH.warn("init was not called");else{var i=this._a(e);if(i){var n=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=b({},i,{appearance:b({},i.appearance,{surveyPopupDelaySeconds:0})}
2)),t.displayType!==n$&&t.initialResponses&&sH.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.canRenderSurvey(i);if(!s.visible)return void sH.warn("Survey is not eligible to be displayed: ",s.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else sH.warn("Survey not found")}}cancelPendingSurvey(e){er(this._surveyManager)?sH.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},oH),oJ=b({experiments:oq},oH),oK=b({},oH,{sessionRecording:class{get Se(){return this._instance.config}get ti(){return this._instance.persistence}get started(){var e;return!(null==(e=this.Ls)||!e.isStarted)}get status(){var e,t;return this.Fs===op||this.Fs===of?this.Fs:null!=(e=null==(t=this.Ls)?void 0:t.status)?e:this.Fs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fs=od,this.As=void 0,this._instance=e,!this._instance.sessionManager)throw og.error("started without valid sessionManager"),Error(ov+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===rW)throw Error(ov+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Ds(){var e,t=!(null==(e=this._instance.get_property(ro))||!e.enabled),r=!this.Se.disable_session_recording,i=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return n&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.Ds||null==(t=this.Ls)||!t.isStarted){var r=!X(Object.assign)&&!X(Array.from);this.Ds&&r?(this.$s(e),og.info("starting")):(this.Fs=od,this.stopRecording())}}$s(e){var t,r,i;this.Ds&&(this.Fs!==op&&this.Fs!==of&&(this.Fs=oh),null!=f&&null!=(t=f.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=f.__PosthogExtensions__)&&r.initSessionRecording?this.Ns(e):null==(i=f.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.qs,t=>{if(t)return og.error("could not load recorder",t);this.Ns(e)}))}stopRecording(){var e,t;null==(e=this.As)||e.call(this),this.As=void 0,null==(t=this.Ls)||t.stop()}Bs(){var e,t;null==(e=this.As)||e.call(this),this.As=void 0,null==(t=this.Ls)||t.discard()}js(){var e,t;null==(e=this.ti)||e.unregister(rp),null==(t=this.ti)||t.unregister(ra)}Hs(e,t){if(er(e))return null;var r=ei(e)?e:parseFloat(e);return"number"!=typeof r||!Number.isFinite(r)||0>r||r>1?(og.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Us(e){if(this.ti){var t,r,i=this.ti,n=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,n=this.Hs(null==(t=this.Se.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),s=this.Hs(null==r?void 0:r.sampleRate,"remote config sampleRate"),o=null!=n?n:s;er(o)&&this.js();var a=null==r?void 0:r.minimumDurationMilliseconds;i.register({[ro]:b({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:b({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:o,minimumDurationMilliseconds:X(a)?null:a,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(t=this.As)||t.call(this),this.As=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Us(e),void this.Bs()):(this.Us(e),void this.startIfEnabledOrStop()):(this.Fs===op&&(this.Fs=of,og.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this.Ls)&&r.log?this.Ls.log(e,t):og.warn("log called before recorder was ready")}get qs(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(ro);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}zs(){var e,t,r=this._instance.get_property(ro);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return og.warn("persisted remote config for session recording is invali
2d and will be ignored",e),!1}var i=null!=(e=t.cache_timestamp)?e:Date.now();return 36e5>=Date.now()-i}Ns(e){var t,r;if(null==(t=f.__PosthogExtensions__)||!t.initSessionRecording)return og.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[rV]:!0});if(this.Ls||(this.Ls=null==(r=f.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this.Ls._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.zs()){if(this.Fs===of||this.Fs===op)return;return this.Fs=op,og.info("persisted remote config is stale, requesting fresh config before starting"),void new nB(this._instance).load()}this.Fs=oh,this.Ls.start(e)}onRRwebEmit(e){var t;null==(t=this.Ls)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Ls||null==(t=this.ti)||t.register({[ru]:!0}),null==(e=this.Ls)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Ls||null==(t=this.ti)||t.register({[rl]:!0}),null==(e=this.Ls)||e.overrideSampling()}overrideTrigger(e){var t,r;this.Ls||null==(r=this.ti)||r.register({["url"===e?rc:rd]:!0}),null==(t=this.Ls)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Ls)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this.Ls)||!r.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.Vs=!1,this.Ws=null,this.Gs=!1,this.instance=e,this.rageclicks=new oi(e.config.rageclick),this.Zs=null}initialize(){this.startIfEnabled()}get Se(){var e,t,r=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=null==(e=r.url_allowlist)?void 0:e.map(e=>new RegExp(e)),r.url_ignorelist=null==(t=r.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),r}Qs(){if(this.isBrowserSupported()){if(n&&a){var e=e=>{e=e||(null==n?void 0:n.event);try{this.Js(e)}catch(e){os.error("Failed to capture event",e)}};if(ie(a,"submit",e,{capture:!0}),ie(a,"change",e,{capture:!0}),ie(a,"click",e,{capture:!0}),this.Se.capture_copied_text){var t=e=>{e=e||(null==n?void 0:n.event);try{this.Js(e,on)}catch(e){os.error("Failed to capture copy/cut event",e)}};ie(a,"copy",t,{capture:!0}),ie(a,"cut",t,{capture:!0})}}}else os.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Vs&&(this.Qs(),this.Vs=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Gs=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[t8]:!!e.autocapture_opt_out}),this.Ws=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Zs=e}getElementSelectors(e){var t,r=[];return null==(t=this.Zs)||t.forEach(t=>{var i=null==a?void 0:a.querySelectorAll(t);null==i||i.forEach(i=>{e===i&&r.push(t)})}),r}get isEnabled(){var e,t,r=null==(e=this.instance.persistence)?void 0:e.props[t8];if(et(this.Ws)&&!es(r)&&!this.instance.Er())return!1;var i=null!=(t=this.Ws)?t:!!r;return!!this.instance.config.autocapture&&!i}Js(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,i=iD(e);iA(i)&&(i=i.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&iW(i,this.instance.config.rageclick)&&this.Js(e,"$rageclick");var s=t===on;if(i&&function(e,t,r,i,s,o){if(void 0===r&&(r=void 0),!n||iG(e)||null!=(a=r)&&a.url_allowlist&&!iR(r.url_allowlist,o)||null!=(l=r)&&l.url_ignorelist&&iR(r.url_ignorelist,o))return!1;if(null!=(u=r)&&u.dom_event_allowlist){var a,l,u,c,d,h,p=r.dom_event_allowlist;if(p&&!p.some(e=>t.type===e))return!1}var{parentIsUsefulElement:f,targetElementList:v}=iJ(e,i);if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(X(r))return!0;var i,n=function(e){if(r.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var s of e)if(i=n(s))return i.v;return!1}(v,r)||!i$(v,null==(c=r)?void 0:c.css_selector_allowlist)||i$(v,null!=(d=null==(h=r)?void 0:h.css_selector_ignorelist)?d:iU))return!1;try{var g=n.getComputedStyle(e);
2if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return f?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(iN.indexOf(m)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,this.Se,s,s?["copy","cut"]:void 0,this.instance)){var{props:o,explicitNoCapture:a}=function(e,t){var r,i,{e:s,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:c}=t;if(!iT(e))return{props:{}};for(var d=[e],h=e;h.parentNode&&!iI(h,"body");)if(iO(h.parentNode))d.push(h.parentNode.host),h=h.parentNode.host;else{if(!iT(h.parentNode))break;d.push(h.parentNode),h=h.parentNode}var p,f=[],v={},g=!1,m=!1;if(r3(d,e=>{var t=iK(e);if(iI(e,"a")){var r=e.getAttribute("href");g=!!(t&&r&&i3(r))&&(c?tc(r):r)}B(iF(e),"ph-no-capture")&&(m=!0),f.push(function(e,t,r,i,n){void 0===n&&(n=!1);var s=e.tagName.toLowerCase(),o={tag_name:s};iN.indexOf(s)>-1&&!r&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?oo(1024,i4(e)):oo(1024,iM(e)));var a=iF(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),r3(e.attributes,function(r){var s;if((!iY(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&i3(r.value)&&(!Z(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=r.value;"class"===r.name&&(a=iC(a).join(" ")),o["attr__"+r.name]=oo(1024,"href"===r.name&&n?tc(a):a)}});for(var l=1,u=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!iT(t))return t}(c);)l++,c.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,l,c)),r4(v,function(e){if(!iK(e))return{};var t={};return r3(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&i3(i)&&(t[r]=i)}}),t}(e))}),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text=iI(e,"a")||iI(e,"button")?i4(e):iM(e)),g){f[0].attr__href=g;var _,y,w=null==(_=nu(g))?void 0:_.host,S=null==n||null==(y=n.location)?void 0:y.host;w&&S&&w!==S&&(p=g)}return{props:r4({$event_type:s.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:f.map(e=>{var t,r,i,n={text:null==(r=e.$el_text)?void 0:r.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:(t=e.attr__class)?J(t)?t:iC(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return r5(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,r]=e;return n.attributes[t]=r}),n}).map(e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))i+="."+n.replace(/"/g,"");var s=b({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(r=e.nth_of_type)?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return r5(s).sort((e,t)=>{var[r]=e,[i]=t;return r.localeCompare(i)}).forEach(e=>{var[t,r]=e;return o[i5(t.toString())]=i5(r.toString())}),(i+=":")+r5(o).map(e=>{var[t,r]=e;return t+'="'+r+'"'}).join("")}).join(";")},null!=(r=f[0])&&r.$el_text?{$el_text:null==(i=f[0])?void 0:i.$el_text}:{},p&&"click"===s.type?{$external_click_url:p}:{},v)}}(i,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Gs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),t===on){var u,c=iL(null==n||null==(u=n.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return K(null==a?void 0:a.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ks=(null==n||null==(t=n.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tX.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ys&&this.Ys(),this.Ys=void 0,tX.info("History API monitoring stopped")}monitorHistoryChanges(){n&&n.history&&(this.Xs("pushState"),this.Xs("replaceState"),this.eo())}Xs(e){var t;if(n&&(null==(t=n.history[e])||!t.__posthog_wrapped__)){var r=this;!function(e,t,r){try{if(!(t in e))return ol;var i={next:e[t]},n=r(function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)});K(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}}
2)),e[t]=n}catch(e){return ol}}(n.history,e,t=>function(i,n,s){t.call(this,i,n,s),r.ro(e)})}}ro(e){try{var t,r=null==n||null==(t=n.location)?void 0:t.pathname;if(!r)return;r!==this.Ks&&this.isEnabled&&this._instance.capture(rX,{navigation_type:e}),this.Ks=r}catch(t){tX.error("Error capturing "+e+" pageview",t)}}eo(){if(!this.Ys){var e=()=>{this.ro("popstate")};ie(n,"popstate",e),this.Ys=()=>{n&&n.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(e){var t;this.io=!1,this.Vs=!1,this.no=null,this.instance=e,this.io=!(null==(t=this.instance.persistence)||!t.props[t7]),this.rageclicks=new oi(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Y(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(e=this.Se.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return er(this.Se.capture_heatmaps)?er(this.Se.enable_heatmaps)?this.io:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.Vs||(om.info("starting..."),this.so(),this.ke());else{var e;clearInterval(null!=(e=this.no)?e:void 0),this.oo(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[t7]:t}),this.io=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}ao(e){this.fe(e.originalEvent,"deadclick")}ke(){this.no&&clearInterval(this.no),this.no="visible"===(null==a?void 0:a.visibilityState)?setInterval(this.zr.bind(this),this.flushIntervalMilliseconds):null}so(){n&&a&&(this.lo=this.zr.bind(this),ie(n,rQ,this.lo),this.uo=e=>this.fe(e||(null==n?void 0:n.event)),ie(a,"click",this.uo,{capture:!0}),this.ho=e=>this.do(e||(null==n?void 0:n.event)),ie(a,"mousemove",this.ho,{capture:!0}),this.co=new i9(this.instance,i8,this.ao.bind(this)),this.co.startIfEnabledOrStop(),this.vo=this.ke.bind(this),ie(a,rY,this.vo),this.Vs=!0)}oo(){var e;n&&a&&(this.lo&&n.removeEventListener(rQ,this.lo),this.uo&&a.removeEventListener("click",this.uo,{capture:!0}),this.ho&&a.removeEventListener("mousemove",this.ho,{capture:!0}),this.vo&&a.removeEventListener(rY,this.vo),clearTimeout(this.fo),null==(e=this.co)||e.stop(),this.Vs=!1)}po(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(e,t,r){for(var i=e;i&&iT(i)&&!iI(i,"body")&&i!==r;){var s,o,a,l=void 0;try{l=null==(s=null!=(o=null==(a=i.ownerDocument)?void 0:a.defaultView)?o:n)?void 0:s.getComputedStyle(i).position}catch(e){break}if(B(t,l))return!0;i=ij(i)}return!1}(iD(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:t}}fe(e,t){var r;if(void 0===t&&(t="click"),!iP(e.target)&&o_(e)){var i=this.po(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&iW(iD(e),this.instance.config.rageclick)&&this.kt(b({},i,{type:"rageclick"})),this.kt(i)}}do(e){!iP(e.target)&&o_(e)&&(clearTimeout(this.fo),this.fo=setTimeout(()=>{this.kt(this.po(e,"mousemove"))},500))}kt(e){if(n){var t=this.Se.disable_capture_url_hashes?tc(n.location.href):n.location.href,r=this.Se.custom_personal_data_properties,i=nd(t,this.Se.mask_personal_data_properties?[...ng,...r||[]]:[],n_);this.R=this.R||{},this.R[i]||(this.R[i]=[]),this.R[i].push(e)}}zr(){this.R&&!Q(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:i9,webVitalsAutocapture:class{constructor(e){var t;this.io=!1,this.Vs=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.mo=()=>{clearTimeout(this.yo),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((e,t)=>b({},e,{["$web_vitals_"+t.name+"_event"]:b({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.bo=e=>{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t,r=this._o();if(!X(r))if(er(null==e?void 0:e.name)||er(null==e?void 0:e.value))oc.error("Invalid metric received",e);else if(!this.wo||this.wo>e.value){this.R.url!==r&&(this.mo(),this.yo=setTimeout(this.mo,this.flushToCaptureTimeoutMs)),X(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=X(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),n=b({},e,{$current_url:r,timestamp:Date.now()});X(i)||(n.$session_id=i.sessionId,n.$window_id=i.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.mo()}else oc.error("Ignoring metric with value >= "+this.wo,e)},this.xo=()=>
2{if(!this.Vs){var e,t,r,i,n=f.__PosthogExtensions__;X(n)||X(n.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:r,onINP:i}=n.postHogWebVitalsCallbacks),e&&t&&r&&i?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.bo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.bo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.bo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.bo.bind(this)),this.Vs=!0):oc.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.io=!(null==(t=this._instance.persistence)||!t.props[rr]),this.startIfEnabled()}get ko(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=Y(this.ko)?null==(e=this.ko)?void 0:e.web_vitals_allowed_metrics:void 0;return er(r)?(null==(t=this._instance.persistence)?void 0:t.props[rs])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Y(this.ko)?this.ko.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Y(this.ko)?this.ko.web_vitals_attribution:void 0;return null!=e&&e}get wo(){var e=Y(this.ko)&&ei(this.ko.__web_vitals_max_value)?this.ko.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==l?void 0:l.protocol;if("http:"!==e&&"https:"!==e)return oc.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Y(this.ko)?this.ko.web_vitals:es(this.ko)?this.ko:void 0;return es(t)?t:this.io}startIfEnabled(){this.isEnabled&&!this.Vs&&(oc.info("enabled, starting..."),this.Bt(this.xo))}onRemoteConfig(e){if("capturePerformance"in e){var t=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[rr]:t}),this._instance.persistence.register({[rs]:r})),this.io=t,this.startIfEnabled()}}Bt(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?oc.error("failed to load script",t):e()})}_o(){var e=n?this._instance.config.disable_capture_url_hashes?tc(n.location.href):n.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return nd(e,this._instance.config.mask_personal_data_properties?[...ng,...t||[]]:[],n_)}oc.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,r,i;this.xo=()=>{var e;if(n&&this.isEnabled&&null!=(e=f.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.So&&this.Se.capture_unhandled_errors&&(this.So=t(this.captureException.bind(this))),!this.Co&&this.Se.capture_unhandled_rejections&&(this.Co=r(this.captureException.bind(this))),!this.Io&&this.Se.capture_console_errors&&(this.Io=i(this.captureException.bind(this)))}catch(e){oa.error("failed to start",e),this.To()}}},this._instance=e,this.Mo=!(null==(t=this._instance.persistence)||!t.props[t9]),this.Eo=new ef({refillRate:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?r:1,bucketSize:null!=(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?i:10,refillInterval:1e4,Ae:oa}),this.Se=this.Po(),this.startIfEnabledOrStop()}Po(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(e)?t=b({},t,e):(X(e)?this.Mo:e)&&(t=b({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(oa.info("enabled"),this.To(),this.Bt(this.xo)):this.To()}Bt(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return oa.error("failed to load script",t);e()})}To(){var e,t,r;null==(e=this.So)||e.call(this),this.So=void 0,null==(t=this.Co)||t.call(this),this.Co=void 0,null==(r=this.Io)||r.call(this),this.Io=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Mo=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[t9]:this.Mo}),this.Se=this.Po(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.Po()}captureException(e){var t,r,i,n=null!=(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)?t:"Exception";this.Eo.consumeRateLimit(n)?oa.info("Skipping exception capture because of client rate limiting.",{exception:n}):null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this.Ro=[],this.Oo=new tE([new tL,new tz,new tD,new tM,new tB,new tq,new t$,new tV],function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var n=[],s=t.split("\n"),o=i;s.length>o;o++){var a=s[o];if(1024>=a.length){var l=tF.test(a)?a.replace(tF,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){n.push(c);break}}if(n.length>=50)break}}}if(!n.length)return[];var d=Array.from(n);return d.reverse(),d.slice(0,50).map(e=>b({},e,{filename:e.filename||(d[d.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",tA,tR)),this._instance=e,this.Ro=null!=(t=null==(r=this._instance.persistence)?void 0:r.get_property(re))?t:[],this.Lo=tK(this.Fo()),this.Ao=new tY(this.Lo)}onConfigChange(){this.Lo=tK(this.Fo()),this.Ao.setConfig(this.Lo)}onRemoteConfig(e){var t,r,i;if("errorTracking"in e){var n=null!=(t=null==(r=e.errorTracking)?void 0:r.suppressionRules)?t:[],s=null==(i=e.errorTracking)?void 0:i.captureExtensionExceptions;this.Ro=n,this._instance.persistence&&this._instance.persistence.register({[re]:this.Ro,[rt]:s})}}get Do(){var e,t=!!this._instance.get_property(rt),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=r?r:t)&&e}buildProperties(e,t){return this.Oo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.Lo.enabled)try{if(!Z(e)||0===e.trim().length)return void o$.warn("Ignoring exception step because message must be a non-empty string");var r=this.$o(t),{sanitizedProperties:i,droppedKeys:n}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((r,i)=>(tG.has(i)?t.push(i):r[i]=e[i],r),{}),droppedKeys:t}}(r);n.length>0&&o$.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Ao.add(b({[tH]:e,[tW]:(new Date).toISOString()},i))}catch(e){o$.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.No(t)){if(this.qo(t))return this.Bo("Exception dropped: matched a suppression rule"),void o$.info("Skipping exception capture because a suppression rule matched");if(!this.Do&&this.jo(t))return this.Bo("Exception dropped: thrown by a browser extension"),void o$.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Ho(t))return this.Bo("Exception dropped: thrown by the PostHog SDK"),void o$.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.Lo.enabled&&er(e.$exception_steps)?this.Uo(e):e;try{var i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",an:!0});return i&&this.Ao.clear(),i}catch(e){return o$.error("Failed to capture exception event. Dropping this exception.",e),void this.Ao.clear()}}catch(e){return void o$.error("Failed to process exception event. Ignoring this exception.",e)}}Uo(e){try{var t=this.Ao.getAttachable();return 0===t.length?e:b({},e,{$exception_steps:t})}catch(t){return o$.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Bo(e){this.Lo.enabled&&this.Ao.add({[tH]:e,[tW]:(new Date).toISOString()})}$o(e){return Y(e)?b({},e):{}}Fo(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}qo(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>
2{var{type:r,value:i}=t;return Z(r)&&r.length>0&&e.$exception_types.push(r),Z(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.Ro.some(e=>{var r=e.values.map(e=>{var r,i=s$[e.operator],n=J(e.value)?e.value:[e.value],s=null!=(r=t[e.key])?r:[];return n.length>0&&i(n,s)});return"OR"===e.type?r.some(Boolean):r.every(Boolean)})}jo(e){return e.flatMap(e=>{var t,r;return null!=(t=null==(r=e.stacktrace)?void 0:r.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}Ho(e){if(e.length>0){var t,r,i,n,s=null!=(t=null==(r=e[0].stacktrace)?void 0:r.frames)?t:[],o=s[s.length-1];return null!=(i=null==o||null==(n=o.filename)?void 0:n.includes("posthog.com/static"))&&i}return!1}No(e){return!er(e)&&J(e)}}},oW,{siteApps:class{constructor(e){this.Go=0,this._instance=e,this.Zo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qo(e,t){if(t){var r=this.globalsForEvent(t);this.Zo.push(r),this.Zo.length>1e3&&(this.Zo=this.Zo.slice(10))}}get siteAppLoaders(){var e;return null==(e=f._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Qo.bind(this));this.Jo=()=>{e(),this.Zo=[],this.Jo=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,r,i,n,s,o,a,l={},u=this._instance.get_property("$groups")||[];for(var[c,d]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:d};var{$set_once:h,$set:p}=e;return{event:b({},w(e,ow),{properties:b({},e.properties,p?{$set:b({},null!=(t=null==(r=e.properties)?void 0:r.$set)?t:{},p)}:{},h?{$set_once:b({},null!=(i=null==(n=e.properties)?void 0:n.$set_once)?i:{},h)}:{}),elements_chain:null!=(s=null==(o=e.properties)?void 0:o.$elements_chain)?s:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Ko(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(oS.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(oS.error("prepare_external_dependency_script returned null"),null):e}Yo(){if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var e,t,r,i,n,s,o,l,u=null==a?void 0:a.defaultView,c=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!c)return()=>{};if(this.Go++,this.Xo)return this.ea();var d=[],h=this,p=new WeakSet,f=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push(()=>{e[t]=i})}},v=e=>{if(p.has(e))return e;var t=h.Ko(e);return t&&p.add(t),t},g=e=>e.map(e=>"string"==typeof e?e:v(e)).filter(e=>!et(e));return f(c,"appendChild",e=>function(t){var r=v(t);return r?e.call(this,r):t}),f(c,"insertBefore",e=>function(t,r){var i=v(t);return i?e.call(this,i,r):t}),f(c,"replaceChild",e=>function(t,r){var i=v(t);return i?e.call(this,i,r):r}),[null==(t=u.Element)?void 0:t.prototype,null==(r=u.Document)?void 0:r.prototype,null==(i=u.DocumentFragment)?void 0:i.prototype].forEach(e=>{f(e,"append",e=>function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}),f(e,"prepend",e=>function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))})}),[null==(n=u.Element)?void 0:n.prototype,null==(s=u.CharacterData)?void 0:s.prototype,null==(o=u.DocumentType)?void 0:o.prototype].forEach(e=>{f(e,"before",e=>function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}),f(e,"after",e=>function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,g(r))}),f(e,"replaceWith",e=>function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];var n=g(r);return r.length&&!n.length?void 0:e.apply(this,n)})}),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",e=>function(t,r){var i=v(r);return i?e.call(this,t,i):null}),this.Xo=()=>
2{d.forEach(e=>e()),this.Xo=void 0},this.ea()}ea(){var e=!1;return()=>{var t;e||(e=!0,this.Go--,0===this.Go&&(null==(t=this.Xo)||t.call(this)))}}ta(e,t){void 0===t&&(t=!0);var r=this.Yo();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this.Zo.length&&(oS.info("Processing "+this.Zo.length+" events for site app with id "+e.id),this.Zo.forEach(e=>this.ta(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(r=this.Jo)||r.call(this))},i=!1,n=n=>{t.errored=!n,t.loaded=!0,oS.info("Site app with id "+e.id+" "+(n?"loaded":"errored")),i&&r()};try{var{processEvent:s}=this.ta(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);s&&(t.processEvent=s),i=!0}catch(t){oS.error(oE+e.id,t),n(!1)}if(i&&t.loaded)try{r()}catch(r){oS.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}ra(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}ia(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t.ta(()=>null==i.processEvent?void 0:i.processEvent(r))}catch(t){oS.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var n of Object.values(this.apps))i(n)}}onRemoteConfig(e){var t,r,i,n=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.ra(),void this._instance.on("eventCaptured",e=>this.ia(e))):void oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this.Jo)||r.call(this),null!=(i=e.siteApps)&&i.length)if(this.isEnabled){var s=function(e){var t;f["__$$ph_site_app_"+e]=n._instance,null==(t=f.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(n._instance,a,t=>{if(t)return oS.error(oE+e,t)})};for(var{id:o,url:a}of e.siteApps)s(o)}else oS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},oG,{tracingHeaders:class{constructor(e){this.na=void 0,this.sa=void 0,this.oa=void 0,this.xo=()=>{var e,t,r=this.aa();r?(X(this.na)&&(this.na=null==(e=f.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),X(this.sa)&&(this.sa=null==(t=f.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.To()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Bt(e){var t,r;null!=(t=f.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=f.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return ou.error("failed to load script",t);e()})}la(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}aa(){var e=this.la();return J(e)?(J(this.oa)?this.oa.splice(0,this.oa.length,...e):this.oa=[...e],e.length>0?this.oa:void 0):(J(this.oa)&&this.oa.splice(0),this.oa=e||void 0,this.oa)}To(){var e,t;null==(e=this.na)||e.call(this),null==(t=this.sa)||t.call(this),this.na=void 0,this.sa=void 0}startIfEnabledOrStop(){this.aa()?this.Bt(this.xo):this.To()}}},{toolbar:class{constructor(e){this.instance=e}xa(e){f.ph_toolbar_state=e}ka(){var e;return null!=(e=f.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),it(this.instance.config)||!n||!a)return!1;e=null!=e?e:n.location,r=null!=r?r:n.history;try{if(!t){try{n.localStorage.setItem("test","test"),n.localStorage.removeItem("test")}catch(e){return!1}t=null==n?void 0:n.localStorage}var i,s=oO||nh(e.hash,"__posthog")||nh(e.hash,"state"),o=s?r6(()=>JSON.parse(atob(decodeURIComponent(s))))||r6(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(oC)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}Sa(e){var t=f.ph_load_toolbar||f.ph_load_editor;!er(t)&&K(t)?t(e,this.instance):oR.warn("No toolbar load function found")}loadToolbar(e){var t,r=!(null==a||!a.getElementById(rj));if(!n||r)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=b({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});return(n.localStorage.setItem(oC,JSON.stringify(b({},s,{source:void 0}))),2===this.ka())?this.Sa(s):0===this.ka()&&(this.xa(1),null==(t=f.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{e?(oR.error("[Toolbar] Failed to load",e),this.xa(0)):(this.xa(2),this.Sa(s))}),ie(n,"turbolinks:load",()=>{this.xa(0),this.loadToolbar(s)})),!0}Ca(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},oJ,{conversations:class{constructor(e){this.Ia=void 0,this._conversationsManager=null,this.Ta=!1,this.Ma=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;er(t)||(es(t)?this.Ia=t:(this.Ia=t.enabled,this.Ma=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Ia=void 0,this.Ma=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ta||this._instance.config.disable_conversations||it(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==f?void 0:f.__PosthogExtensions__;if(e&&!X(this.Ia)&&this.Ia)if(this.Ma&&this.Ma.token){this.Ta=!0;try{var t=e.initConversations;if(t)return this.Ea(t),void(this.Ta=!1);var r=e.loadExternalDependency;if(!r)return void this.Pa(rz);r(this._instance,"conversations",t=>{t||!e.initConversations?this.Pa("Could not load conversations script",t):this.Ea(e.initConversations),this.Ta=!1})}catch(e){this.Pa("Error initializing conversations",e),this.Ta=!1}}else oB.error("Conversations enabled but missing token in remote config.")}}Ea(e){if(this.Ma)try{this._conversationsManager=e(this.Ma,this._instance),oB.info("Conversations loaded successfully")}catch(e){this.Pa("Error completing conversations initialization",e)}else oB.error("Cannot complete initialization: remote config is null")}Pa(e,t){oB.error(e,t),this._conversationsManager=null,this.Ta=!1}show(){this._conversationsManager?this._conversationsManager.show():oB.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ia&&!et(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,r){var i=this;return y(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(oB.warn(oV),null)})()}getMessages(e,t){var r=this;return y(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(oB.warn(oV),null)})()}markAsRead(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(oB.warn(oV),null)})()}getTickets(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(oB.warn(oV),null)})()}requestRestoreLink(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(oB.warn(oV),null)})()}restoreFromToken(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(oB.warn(oV),null)})()}restoreFromUrlToken(){var e=this;return y(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(oB.warn(oV),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}vn(){var e;null==(e=this._conversationsManager)||e.setIdentity()}fn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.Ra=!1,this.Oa=!1,this.Ae=tZ("[logs]"),this.Or=[],this.La=[],this.ys=0,this.Fa=()=>{var e,t;this.ys=0,null==(e=this.Aa)||e.onReconnect(),null==(t=this.Da)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Ra=!0),n&&ie(n,"online",this.Fa)}$a(e,t,r,i){var n,s,o,a,l,u,c,d,h,p,f,v,g,m,_=(n=null==(m=this._instance)||null==(m
2=m.config)?void 0:m.logs,h=null!=(s=null==n?void 0:n.flushIntervalMs)?s:3e3,p=null!=(o=null==n?void 0:n.maxBufferSize)?o:100,v=X(f=null!=r&&r.consoleCapture?void 0:null!=(a=null==n?void 0:n.maxLogsPerInterval)?a:1e3)?Math.max(p,2048):Math.max(p,f),{serviceName:null!=(l=null!=(u=null==(g=null==n?void 0:n.resourceAttributes)?void 0:g["service.name"])?u:null==n?void 0:n.serviceName)?l:null==r?void 0:r.serviceNameDefault,serviceVersion:null!=(c=null==g?void 0:g["service.version"])?c:null==n?void 0:n.serviceVersion,environment:null!=(d=null==g?void 0:g["deployment.environment"])?d:null==n?void 0:n.environment,resourceAttributes:g,beforeSend:null==n?void 0:n.beforeSend,flushIntervalMs:h,maxBufferSize:p,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:f,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new t_(this.Na(e,t),_,this.Ae,()=>this.qa(),e=>e(),void 0,i),_]}Ba(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.Aa&&this.ja===r||(null==(t=this.Aa)||t.reset(),this.ja=r,[this.Aa,this.Ha]=this.$a(()=>this.Or,e=>{this.Or=e})),this.Aa}Ua(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.Da&&this.za===r||(null==(t=this.Da)||t.reset(),this.za=r,[this.Da,this.Va]=this.$a(()=>this.La,e=>{this.La=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},oz)),this.Da}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=null==(t=e.logs)?void 0:t.captureConsoleLogs;!er(r)&&r&&(this.Ra=!0,this.loadIfEnabled())}reset(){var e,t;this.Or=[],null==(e=this.Aa)||e.reset(),this.La=[],null==(t=this.Da)||t.reset(),this.ys=0}captureLog(e){this.Ba().captureLog(e)}le(e){this.Ua().captureLog(e)}get logger(){return this.Wa||(this.Wa={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Wa}flushLogs(e){e?this.Ga(e):(this.Aa&&this.Aa.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)),this.Da&&this.Da.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)))}loadIfEnabled(){if(this.Ra&&!this.Oa){var e=null==f?void 0:f.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var r;t||null==(r=e.logs)||!r.initializeLogs?this.Ae.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.Oa=!0)}):this.Ae.error(rz)}else this.Ae.error("PostHog Extensions not found.")}}Na(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===A.LogsQueue?e():void 0,setPersistedProperty(e,r){e===A.LogsQueue&&t(null!=r?r:[])},ht:e=>this.ht(e),getLibraryId:()=>m.LIB_NAME,getLibraryVersion:()=>m.LIB_VERSION}}ht(e){return new Promise(t=>{if(np(this.ys,3))t({kind:"fatal",error:Error("logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(n),t(e))},n=setTimeout(()=>i({kind:"retry-later",error:Error("logs request timed out")}),9e4);this._instance._send_request({method:"POST",url:this.Za(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t,r=e.statusCode;(this.Qa(r),r>=200&&300>r)?i({kind:"ok"}):413===r?i({kind:"too-large"}):0!==r&&429!==r&&500>r?i({kind:"fatal",error:Error("logs request failed with status "+r)}):i({kind:"retry-later",error:null!=(t=e.error)?t:Error("logs request failed with status "+r)})}})}})}Qa(e){(0!==e||this._instance.__loaded)&&(this.ys=nf(e,this.ys,3,()=>this.Ae.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Ga(e){this.Or.length>0&&this.Ja(e,this.Or,this.Ha,m.LIB_NAME,e=>{this.Or=e}),this.La.length>0&&this.Ja(e,this.La,this.Va,oz,e=>{this.La=e})}Ja(e,t,r,i,n){if(0!==t.length){var s=t.map(e=>e.record);n([]);var o=tm(s,tg(r,m.LIB_NAME,m.LIB_VERSION),i,m.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Za(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}Za(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}qa(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:r,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=i,er(n)||(t.sessionStartTimestamp=n),er(s)||(t.lastActivityTimestamp=s)}if(null!=f&&null!=(e=f.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tc(f.location.href):f.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},{metrics:class{constructor(e){this.Ae=tZ("[metrics]"),this._instance=e}initialize(){}Ba(){var e,t,r,i,n,s,o,a,l=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this.Aa&&this.ja===l||(null==(t=this.Aa)||t.reset(),this.ja=l,this.Aa=new tS(this.Na(),{serviceName:null!=(r=null==(a=null==l?void 0:l.resourceAttributes)?void 0:a["service.name"])?r:null==l?void 0:l.serviceName,serviceVersion:null!=(i=null==a?void 0:a["service.version"])?i:null==l?void 0:l.serviceVersion,environment:null!=(n=null==a?void 0:a["deployment.environment"])?n:null==l?void 0:l.environment,resourceAttributes:a,beforeSend:null==l?void 0:l.beforeSend,flushIntervalMs:null!=(s=null==l?void 0:l.flushIntervalMs)?s:1e4,maxSeriesPerFlush:null!=(o=null==l?void 0:l.maxSeriesPerFlush)?o:1e3},this.Ae)),this.Aa}count(e,t,r){void 0===t&&(t=1),this.Ba().count(e,t,r)}gauge(e,t,r){this.Ba().gauge(e,t,r)}histogram(e,t,r){this.Ba().histogram(e,t,r)}flush(e){if(!this.Aa)return Promise.resolve();if(e){var t=this.Aa.drainWindow();return t&&this.Tt(t,e),Promise.resolve()}return this.Aa.flush().catch(e=>this.Ae.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.Aa)||e.reset()}Na(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Tt:e=>t.Tt(e),getLibraryId:()=>m.LIB_NAME,getLibraryVersion:()=>m.LIB_VERSION}}Tt(e,t){return new Promise(r=>{var i=!1,n=e=>{i||(i=!0,clearTimeout(s),r(e))},s=setTimeout(()=>n({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(b({method:"POST",url:this.Ka(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,r=e.statusCode;r>=200&&300>r?n({kind:"ok"}):413===r?n({kind:"too-large"}):0!==r&&429!==r&&500>r?n({kind:"fatal",error:Error("metrics request failed with status "+r)}):n({kind:"retry-later",error:null!=(t=e.error)?t:Error("metrics request failed with status "+r)})}}))})}Ka(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});or.__defaultExtensionClasses=b({},oK);var oY=(m.SDK_DIST_CHANNEL="npm",i=sZ[s6]=new or,function(){function e(){e.done||(e.done=!0,s8=!1,r3(sZ,function(e){e._dom_loaded()}))}null!=a&&a.addEventListener?"complete"===a.readyState?e():ie(a,"DOMContentLoaded",e,{capture:!1}):n&&tX.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),i),oQ=e.i(819928);let oX=0,oZ=e=>{let t=Date.now();t-oX<6e4||(oX=t)},o0=e=>e.split("@")[0],o1=!1;function o2(e){try{if(!o1)return;let t={};for(let[r,i]of Object.entries(e))""===i||null==i?oY.unregister(r):t[r]=i;Object.keys(t).length>0&&oY.register(t)}catch(e){oZ(e instanceof Error?e.message:e)}}function o3(e){try{if(!o1)return;let t={};for(let[r,i]of Object.entries(e))""!==i&&null!=i&&(t[r]=i);Object.keys(t).length>0&&oY.register_once(t)}catch(e){oZ(e instanceof Error?e.message:e)}}e.s(["initPostHog",0,function(){if(o1||"Cypress"in window)return;let e="cherry"===(0,oQ.getClientProductId)()?"phc_rmR2vgjE34uMpWBeSkzrcFVPcaZUkTNQrEAu9Ss8XqQe":"phc_tHuUNcmwBH6d5niQFXpysqJnXgX7
2DTjnt4twb4qD9vk4";o1=!0;try{oY.init(e,{api_host:"/ingest",ui_host:"https://ph.siki.ai",defaults:"2026-05-30",person_profiles:"identified_only",autocapture:!1,rageclick:!1,disable_session_recording:!0,advanced_disable_feature_flags:!0,disable_external_dependency_loading:!0})}catch(e){o1=!1,oZ(e instanceof Error?e.message:e)}},"phCapture",0,function(e,t,r){try{if(!o1)return;if(r?.userId){let e=o0(r.userId);e&&oY.get_distinct_id()!==e&&oY.identify(e)}oY.capture(e,{...t,$lib:"prism"})}catch(e){oZ(e instanceof Error?e.message:e)}},"phIdentify",0,function(e,t,r){try{if(!e||!o1)return;let i=o0(e);if(!i)return;oY.identify(i,t,r?.setOnce),t&&o2(t),r?.setOnce&&o3(r.setOnce)}catch(e){oZ(e instanceof Error?e.message:e)}},"phRegisterUserProperties",0,o2,"phRegisterUserPropertiesOnce",0,o3,"phReset",0,function(){try{o1&&oY.reset()}catch(e){oZ(e instanceof Error?e.message:e)}},"phSetPersonProperties",0,function(e,t){try{if(!o1)return;oY.setPersonProperties(e,t)}catch(e){oZ(e instanceof Error?e.message:e)}},"phSuperPropertyKeys",0,function(e){try{if(!o1)return[];let t=oY.persistence?.props;if(!t||"object"!=typeof t)return[];return Object.keys(t).filter(t=>t.startsWith(e))}catch(e){return oZ(e instanceof Error?e.message:e),[]}},"phUnsetPersonProperties",0,function(e){try{if(!o1||0===e.length)return;oY.unsetPersonProperties(e)}catch(e){oZ(e instanceof Error?e.message:e)}}],255734)},61537,(e,t,r)=>{var i=Object.prototype.hasOwnProperty;function n(e){return"[Throws: "+(e?e.message:"?")+"]"}function s(e){var t=[];return function e(r){if(null===r||"object"!=typeof r)return r;if(-1!==t.indexOf(r))return"[Circular]";if(t.push(r),"function"==typeof r.toJSON)try{var s=e(r.toJSON());return t.pop(),s}catch(e){return n(e)}if(Array.isArray(r)){var o=r.map(e);return t.pop(),o}var a=Object.keys(r).reduce(function(t,s){return t[s]=e(function(e,t){if(i.call(e,t))try{return e[t]}catch(e){return n(e)}return e[t]}(r,s)),t},{});return t.pop(),a}(e)}t.exports=function(e,t,r){return JSON.stringify(s(e),t,r)},t.exports.ensureProperties=s},865256,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Observable=void 0;let i=e=>!!Symbol[e],n=e=>i(e)?Symbol[e]:"@@"+e,s=n("iterator"),o=n("observable"),a=n("species");function l(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function u(e){let t=e.constructor;return void 0!==t&&null===(t=t[a])&&(t=void 0),void 0!==t?t:m}function c(e){c.log?c.log(e):setTimeout(()=>{throw e})}function d(e){Promise.resolve().then(()=>{try{e()}catch(e){c(e)}})}function h(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=l(t,"unsubscribe");e&&e.call(t)}}catch(e){c(e)}}function p(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function f(e,t,r){e._state="running";let i=e._observer;try{let n=l(i,t);switch(t){case"next":n&&n.call(i,r);break;case"error":if(p(e),n)n.call(i,r);else throw r;break;case"complete":p(e),n&&n.call(i)}}catch(e){c(e)}"closed"===e._state?h(e):"running"===e._state&&(e._state="ready")}function v(e,t,r){if("closed"!==e._state){if("buffering"===e._state)return void e._queue.push({type:t,value:r});if("ready"!==e._state){e._state="buffering",e._queue=[{type:t,value:r}],d(()=>(function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(f(e,t[r].type,t[r].value),"closed"!==e._state);++r);}})(e));return}f(e,t,r)}}class g{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,i={get closed(){return"closed"===r._state},next(e){v(r,"next",e)},error(e){v(r,"error",e)},complete(){v(r,"complete")}};try{this._cleanup=t.call(void 0,i)}catch(e){i.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(p(this),h(this))}}class m{constructor(e){if(!(this instanceof m))throw TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new g(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(TypeError(e+" is not a function"));function i(){n.unsubscribe(),t()}let n=this.subscribe({next(t){try{e(t,i)}catch(e){r(e),n.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){try{r=e(r)}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this),r=arguments.length>1,i=!1,n=arguments[1],s=n;return new t(t=>this.subscribe({next(n){let o=!i;if(i=!0,!o||r)try{s=e(s,n)}catch(e){return t.error(e)}else s=n},error(e){t.error(e)},complete(){if(!i&&!r)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(s),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=u(this);return new t(r=>{let i,n=0;return!function s(o){i=o.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){n===e.length?(i=void 0,r.complete()):s(t.from(e[n++]))}})}(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this);return new t(r=>{let i=[],n=this.subscribe({next(n){if(e)try{n=e(n)}catch(e){return r.error(e)}let o=t.from(n).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=i.indexOf(o);e>=0&&i.splice(e,1),s()}});i.push(o)},error(e){r.error(e)},complete(){s()}});function s(){n.closed&&0===i.length&&r.complete()}return()=>
2{i.forEach(e=>e.unsubscribe()),n.unsubscribe()}})}[o](){return this}static from(e){let t="function"==typeof this?this:m;if(null==e)throw TypeError(e+" is not an object");let r=l(e,o);if(r){let i=r.call(e);if(Object(i)!==i)throw TypeError(i+" is not an object");return i instanceof m&&i.constructor===t?i:new t(e=>i.subscribe(e))}if(i("iterator")&&(r=l(e,s)))return new t(t=>{d(()=>{if(!t.closed){for(let i of r.call(e))if(t.next(i),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{d(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})});throw TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:m)(t=>{d(()=>{if(!t.closed){for(let r=0;r<e.length;++r)if(t.next(e[r]),t.closed)return;t.complete()}})})}static get[a](){return this}}r.Observable=m,Object.defineProperty(m,Symbol("extensions"),{value:{symbol:o,hostReportError:c},configurable:!0})},782291,(e,t,r)=>{t.exports=e.r(865256).Observable},774876,488797,400868,e=>{"use strict";let t;e.s([],542666),e.i(542666),(p=v||(v={})).SET="$set",p.SET_ONCE="$setOnce",p.ADD="$add",p.APPEND="$append",p.PREPEND="$prepend",p.REMOVE="$remove",p.PREINSERT="$preInsert",p.POSTINSERT="$postInsert",p.UNSET="$unset",p.CLEAR_ALL="$clearAll",(f=g||(g={})).IDENTIFY="$identify",f.GROUP_IDENTIFY="$groupidentify",f.REVENUE="revenue_amount";var r,i,n,s,o,a,l,u,c,d,h,p,f,v,g,m,_,y,b,w,S,E,k,x,P,T,I,A,O,C=function(){return(C=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function R(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function F(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function L(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function M(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function D(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}var N=("function"==typeof SuppressedError&&SuppressedError,function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!$(t,r))return!1}return!0}),$=function(e,t){var r,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var n=!0;try{for(var s=L(t),o=s.next();!o.done;o=s.next()){var a=o.value;if(Array.isArray(a))return!1;if("object"==typeof a)n=n&&N(a);else if(!["number","string"].includes(typeof a))return!1;if(!n)return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}else if(null==t)return!1;else if("object"==typeof t)return N(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},j=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));N(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?C({},this.properties):{};return e[m.REVENUE_PRODUCT_ID]=this.productId,e[m.REVENUE_QUANTITY]=this.quantity,e[m.REVENUE_PRICE]=this.price,e[m.REVENUE_TYPE]=this.revenueType,e[m.REVENUE_CURRENCY]=this.currency,e[m.REVENUE]=this.revenue,e[m.RECEIPT]=this.receipt,e[m.RECEIPT_SIG]=this.receiptSig,e},e}();(r=m||(m={})).REVENUE_PRODUCT_ID="$productId",r.REVENUE_QUANTITY="$quantity",r.REVENUE_PRICE="$price",r.REVENUE_TYPE="$revenueType",r.REVENUE_CURRENCY="$currency",r.REVENUE="$revenue",r.RECEIPT="$receipt",r.RECEIPT_SIG="$receiptSig",(i=_||(_={}))[i.None=0]="None",i[i.Error=1]="Error",i[i.Warn=2]="Warn",i[i.Verbose
2=3]="Verbose",i[i.Debug=4]="Debug",(n=y||(y={})).US="US",n.EU="EU",n.STAGING="STAGING";var U=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],q="data-amp-track-",B=["div","span","h1","h2","h3","h4","h5","h6"],V={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};e.s(["DEFAULT_ACTION_CLICK_ALLOWLIST",0,B,"DEFAULT_CSS_SELECTOR_ALLOWLIST",0,U,"DEFAULT_DATA_ATTRIBUTE_PREFIX",0,q,"EXCLUDE_INTERNAL_REFERRERS_CONDITIONS",0,V,"IdentifyOperation",0,v,"LogLevel",0,_,"OfflineDisabled",0,null,"RevenueProperty",0,m,"ServerZone",0,y,"SpecialEventType",0,g],422623);var z=e.i(422623);e.s(["Types",0,z],774876);var H=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},W=function(e){return function(){var t=C({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},G=function(e,t){var r,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var n=L(t.split(".")),s=n.next();!s.done;s=n.next()){var o=s.value;if(!(o in e))return;e=e[o]}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return e},J=function(e,t){return function(){var r,i,n={};try{for(var s=L(t),o=s.next();!o.done;o=s.next()){var a=o.value;n[a]=G(e,a)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n}},K=function(e,t,r,i,n){return void 0===n&&(n=null),function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var a=r(),l=a.logger,u=a.logLevel;if(u&&u<_.Debug||!u||!l)return e.apply(n,s);var c={type:"invoke public method",name:t,args:s,stacktrace:H(1),time:{start:new Date().toISOString()},states:{}};i&&c.states&&(c.states.before=i());var d=e.apply(n,s);return d&&d.promise?d.promise.then(function(){i&&c.states&&(c.states.after=i()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))}):(i&&c.states&&(c.states.after=i()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))),d}},Y=function(e,t){return(Y=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function Q(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Y(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var X=function(){return(X=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function Z(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function ee(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function et(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function er(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);
2if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ei(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function en(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var es="".concat("AMP","_unsent"),eo="$default_instance",ea="https://api2.amplitude.com/2/httpapi",el="https://api.eu.amplitude.com/2/httpapi",eu="https://api2.amplitude.com/batch",ec="https://api.eu.amplitude.com/batch",ed="dclid",eh="fbclid",ep="gbraid",ef="gclid",ev="ko_click_id",eg="li_fat_id",em="msclkid",e_="rdt_cid",ey="ttclid",eb="twclid",ew="wbraid",eS={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},eE=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],ek=["authorization","cookie","set-cookie"],ex=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return C({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(b.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(b.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(b.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(b.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(b.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(b.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(b.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(b.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(b.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[b.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return!(void 0!==this._properties[b.CLEAR_ALL]||this._propertySet.has(t))&&(e===b.ADD?"number"==typeof r:e===b.UNSET||e===b.REMOVE||$(t,r))},e}();(s=b||(b={})).SET="$set",s.SET_ONCE="$setOnce",s.ADD="$add",s.APPEND="$append",s.PREPEND="$prepend",s.REMOVE="$remove",s.PREINSERT="$preInsert",s.POSTINSERT="$postInsert",s.UNSET="$unset",s.CLEAR_ALL="$clearAll";var eP=[b.CLEAR_ALL,b.UNSET,b.SET,b.SET_ONCE,b.ADD,b.APPEND,b.PREPEND,b.PREINSERT,b.POSTINSERT,b.REMOVE];e.s(["Identify",0,ex,"OrderedIdentifyOperations",0,eP],488797),(o=w||(w={})).Unknown="unknown",o.Skipped="skipped",o.Success="success",o.RateLimit="rate_limit",o.PayloadTooLarge="payload_too_large",o.Invalid="invalid",o.Failed="failed",o.Timeout="Timeout",o.SystemError="SystemError";var eT=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=w.Unknown),{event:e,code:t,message:r}},eI=function(){var t="ampIntegrationContext";return"u">typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:e.g},eA=D([],M(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eO=function(e){var t,r=eI();if(!(null==(t=null==r?void 0:r.crypto)?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,eO);var i=r.crypto.getRandomValues(new Uint8Array(16));return i[6]=15&i[6]|64,i[8]=63&i[8]|128,D([],M(i.entries()),!1).map(function(e){var t=M(e,2),r=t[0],i=t[1];return[4,6,8,10].includes(r)?"-".concat(eA[i]):eA[i]}).join("")},eC=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,i;return R(this,void 0,void 0,function(){var n;return F(this,function(s){switch(s.label){case 0:if(void 0===e.name&&(e.name=eO(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),n=e.name,this.pluginStatus.has(n))return this.loggerProvider.warn("Plugin with name ".concat(n," already exists, skipping registration")),[2];return e.type=null!=(r=e.type)?r:"enrichment",this.pluginStatus.set(n,"locked"),[4,null==(i=e.setup)?void 0:i.call(e,t,this.client)];case 1:if(s.sent(),"locked"!==this.pluginStatus.get(n))return[2];return this.plugins.push(e),this.pluginStatus.set(n,"installed"),[2]}})})},e.prototype.deregister=function(e,t){var r;return R(this,void 0,void 0,function(){var i,n;return F(this,function(s){switch(s.label){case 0:if(this.pluginStatus.delete(e),-1===(i=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return n=this.plugins[i],this.plugins.splice(i,1),[4,null==(r=n.teardown)?void 0:r.call(n)];case 1:return s.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null==(t=e.teardown)?void 0:t.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(r){t.queue.push([e,r]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return R(this,void 0,void 0,function(){var t,r,i,n,s,o,a,l,u,c,d,h,p,f,v;return F(this,function(g){switch(g.label){case 0:if(!e)return[2];t=M(e,1)[0],r=M(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),i=this.plugins.filter(function(e){return"before"===e.type}),g.label=1;case 1:g.trys.push([1,6,7,8]),s=(n=L(i)).next(),g.label=2;case 2:if(s.done)return[3,5];if(!(o=s.value).execute)return[3,4];return[4,o.execute(C({},t))];case 3:if(null===(a=g.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(o.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(o.name),"', event: ").concat(JSON.stringify(t))),g.label=4;case 4:return s=n.next(),[3,2];case 5:return[3,8];case 6:return h={error:g.sent()},[3,8];
2case 7:try{s&&!s.done&&(p=n.return)&&p.call(n)}finally{if(h)throw h.error}return[7];case 8:l=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),g.label=9;case 9:g.trys.push([9,14,15,16]),c=(u=L(l)).next(),g.label=10;case 10:if(c.done)return[3,13];if(!(o=c.value).execute)return[3,12];return[4,o.execute(C({},t))];case 11:if(null===(a=g.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(o.name),"', event: ").concat(JSON.stringify(t))),r({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(o.name),"', event: ").concat(JSON.stringify(t))),g.label=12;case 12:return c=u.next(),[3,10];case 13:return[3,16];case 14:return f={error:g.sent()},[3,16];case 15:try{c&&!c.done&&(v=u.return)&&v.call(u)}finally{if(f)throw f.error}return[7];case 16:return d=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(t))),Promise.all(d.map(function(e){var r=C({},t);return e.execute(r).catch(function(e){return eT(r,0,String(e))})})).then(function(e){var i=M(e,1)[0]||eT(t,100,"Event not tracked, no destination plugins on the instance");r(i)}),[2]}})})},e.prototype.flush=function(){return R(this,void 0,void 0,function(){var e,t=this;return F(this,function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return r.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return r.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onIdentityChanged)||r.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onSessionIdChanged)||r.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var r;null==(r=t.onOptOutChanged)||r.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return R(this,void 0,void 0,function(){var t,r,i,n,s,o;return F(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),r=(t=L(this._optOutListeners)).next(),a.label=1;case 1:if(r.done)return[3,6];i=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,i(e)];case 3:return a.sent(),[3,5];case 4:return n=a.sent(),this.loggerProvider.error("Error calling optOut listener",n),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return s={error:a.sent()},[3,9];case 8:try{r&&!r.done&&(o=t.return)&&o.call(t)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null==(t=e.onReset)||t.call(e)})},e}(),eR=function(e,t){return C(C({},t),{event_type:g.IDENTIFY,user_properties:e.getUserProperties()})},eF=function(e,t,r,i){var n;return C(C({},i),{event_type:g.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((n={})[e]=t,n)})},eL=function(e,t,r){var i,n=new ex;return n.set(e,t),C(C({},r),{event_type:g.IDENTIFY,user_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},eM=function(e){return{promise:e||Promise.resolve()}},eD=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new eC(this),this.name=e}return e.prototype._init=function(e){return R(this,void 0,void 0,function(){return F(this,function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}})})},e.prototype.runQueuedFunctions=function(e){return R(this,void 0,void 0,function(){var t,r,i,n,s,o;return F(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),i=(r=L(t)).next(),a.label=2;case 2:if(i.done)return[3,7];if(!((n=(0,i.value)())&&"promise"in n))return[3,4];return[4,n.promise];case 3:return a.sent(),[3,6];case 4:return[4,n];case 5:a.sent(),a.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s={error:a.sent()},[3,10];
2case 9:try{i&&!i.done&&(o=r.return)&&o.call(r)}finally{if(s)throw s.error}return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,r){var i=C(C(C({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),eM(this.dispatch(i))},e.prototype.identify=function(e,t){var r=eR(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),eM(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,i){var n=eF(e,t,r,i);return eM(this.dispatch(n))},e.prototype.setGroup=function(e,t,r){var i=eL(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),eM(this.dispatch(i))},e.prototype.revenue=function(e,t){var r=C(C({},t),{event_type:g.REVENUE,event_properties:e.getEventProperties()});return eM(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),eM())},e.prototype._addPlugin=function(e){return eM(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),eM())},e.prototype._removePlugin=function(e){return eM(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(eT(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return R(this,void 0,void 0,function(){var t=this;return F(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(r){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,r))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,r=null!=(t=this.userProperties)?t:{},i=C({},r);if(void 0===e)return i;var n={};return Object.keys(e).forEach(function(t){Object.values(v).includes(t)||(n[t]=e[t])}),eP.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];
2switch(t){case v.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case v.UNSET:Object.keys(r).forEach(function(e){delete i[e]});break;case v.SET:Object.assign(i,r)}}}),Object.assign(i,n),i},e.prototype.process=function(e){return R(this,void 0,void 0,function(){var t,r;return F(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,eT(e,0,"Event skipped due to optOut config")];return e.event_type===g.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)];case 1:return 200===(t=i.sent()).code?this.config.loggerProvider.log(t.message):100===t.code?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return r=String(i.sent()),this.config.loggerProvider.error(r),[2,t=eT(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,!!e))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return eM(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),eN=function(e,t){var r=Math.max(t,1);return e.reduce(function(e,t,i){var n=Math.floor(i/r);return e[n]||(e[n]=[]),e[n].push(t),e},[])},e$="Amplitude Logger ",ej=function(){function e(){this.logLevel=_.None}return e.prototype.disable=function(){this.logLevel=_.None},e.prototype.enable=function(e){void 0===e&&(e=_.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<_.Verbose||console.log("".concat(e$,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<_.Warn||console.warn("".concat(e$,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<_.Error||console.error("".concat(e$,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<_.Debug||console.log("".concat(e$,"[Debug]: ").concat(e.join(" ")))},e}(),eU=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:eo,logLevel:_.Warn,loggerProvider:new ej,offline:!1,optOut:!1,serverUrl:ea,serverZone:"US",useBatch:!1}},eq=function(){function e(e){this._optOut=!1;var t,r,i,n,s=eU();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=null!=(r=e.logLevel)?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:s.offline,this.optOut=null!=(i=e.optOut)?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!=(n=e.useBatch)?n:s.useBatch,this.loggerProvider.enable(this.logLevel);var o=eB(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=o.serverZone,this.serverUrl=o.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),eB=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=eU().serverZone),void 0===r&&(r=eU().useBatch),e)return{serverUrl:e,serverZone:void 0};var i,n=["US","EU"].includes(t)?t:eU().serverZone;return{serverZone:n,serverUrl:(i=r,"EU"===n?i?ec:el:i?eu:ea)}},eV=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ez(e){return e>=200&&e<300}var eH=new Set([ea,el,eu,ec]);function eW(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var eG=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return R(this,void 0,void 0,function(){var r,i=this;return F(this,function(n){switch(n.label){case 0:return this.config=e,this.storageKey="".concat(es,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(r=n.sent())&&r.length>0&&Promise.all(r.map(function(e){return i.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=eO()),new Promise(function(r){t.queue.push({event:e,attempts:0,callback:function(e){return r(e)},timeout:0}),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})}
2,e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),R(this,void 0,void 0,function(){var t,r,i=this;return F(this,function(n){switch(n.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],r=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):r.push(e)}),[4,eN(t,this.config.flushQueueSize).reduce(function(t,r){return R(i,void 0,void 0,function(){return F(this,function(i){switch(i.label){case 0:return[4,t];case 1:return i.sent(),[4,this.send(r,e)];case 2:return[2,i.sent()]}})})},Promise.resolve())];case 1:return n.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var r;return void 0===t&&(t=!0),R(this,void 0,void 0,function(){var i,n,s,o,a;return F(this,function(l){var u,c,d;switch(l.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];i={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new eV,l.label=1;case 1:return l.trys.push([1,3,,4]),u=n=eB(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),s=!!eH.has(u)||c,[4,this.config.transportProvider.send(n,i,s)];case 2:if(null===(o=l.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(eW(o))):this.fulfillRequest(e,o.statusCode,o.status),[2];return this.handleResponse(o,e),[3,4];case 3:return a=(d=l.sent())instanceof Error?d.message:String(d),this.config.loggerProvider.error(a),null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:a,stack_trace:H()}),this.handleResponse({status:w.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){ez(e.statusCode)||null==(r=this.diagnosticsClient)||r.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:eW(e),stack_trace:H()});var r,i=e.status;switch(i){case w.Success:this.handleSuccessResponse(e,t);break;case w.Invalid:this.handleInvalidResponse(e,t);break;case w.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case w.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(i,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var r=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var i=new Set(D(D(D(D([],M(Object.values(e.body.eventsWithInvalidFields)),!1),M(Object.values(e.body.eventsWithMissingFields)),!1),M(Object.values(e.body.eventsWithInvalidIdLengths)),!1),M(e.body.silencedEvents),!1).flat()),n=t.filter(function(t,n){return!i.has(n)||void r.fulfillRequest([t],e.statusCode,e.body.error)});n.length>0&&this.config.loggerProvider.warn(eW(e));
2var s=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(s)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(eW(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),n=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,o=new Set(i),a=new Set(n),l=new Set(s),u=t.filter(function(t,i){return t.event.user_id&&o.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void r.fulfillRequest([t],e.statusCode,e.body.error):(l.has(i)&&(t.timeout=r.throttleTimeout),!0)});u.length>0&&this.config.loggerProvider.warn(eW(e));var c=this.removeEventsExceedFlushMaxRetries(u);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),i=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(i)},e.prototype.fulfillRequest=function(e,t,r){var i,n,s;ez(t)?null==(s=this.diagnosticsClient)||s.increment("analytics.events.sent",e.length):(null==(i=this.diagnosticsClient)||i.increment("analytics.events.dropped",e.length),null==(n=this.diagnosticsClient)||n.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:H()})),this.removeEvents(e),e.forEach(function(e){return e.callback(eT(e.event,t,r))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),eJ=e.i(334977),eK=function(e){return void 0===e&&(e=eo),eJ.AnalyticsConnector.getInstance(e)},eY=function(e,t){eK(t).identityStore.editIdentity().setUserId(e).commit()},eQ=function(e,t){eK(t).identityStore.editIdentity().setDeviceId(e).commit()},eX=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},eZ=function(){function e(){this.name="identity",this.type="before",this.identityStore=eK().identityStore}return e.prototype.execute=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return R(this,void 0,void 0,function(){return F(this,function(t){return e.instanceName&&(this.identityStore=eK(e.instanceName).identityStore),[2]})})},e}(),e0=function(){var e,t=eI();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var r=t.split("=",2),i=e1(r[0]),n=e1(r[1]);return n&&(e[i]=n),e},{}):{}},e1=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},e2=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var r=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(r))),Promise.resolve({remoteConfig:r.remoteConfig,lastFetch:new Date(r.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}
2(),e3=function(){function e(e,t,r,i){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new e2(e,t)}return e.prototype.subscribe=function(e,t,r){var i=eO(),n={id:i,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(n),"all"===t?this.subscribeAll(n):this.subscribeWaitForRemote(n,t.timeout),i},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return -1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return R(this,void 0,void 0,function(){var e,t=this;return F(this,function(r){switch(r.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=r.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(r){t.sendCallback(r,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){n.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),n.sendCallback(e,t,"remote"),n.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(i=s.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(i))),null!==i.remoteConfig?this.sendCallback(e,i,"cache"):this.logger.debug("Remote config client skips sending c
2allback because cache is empty (first time user).")),[4,t];case 2:return s.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return R(this,void 0,void 0,function(){var r,i;return F(this,function(n){switch(n.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),n.label=1;case 1:return n.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return i=n.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,i,"remote"),this.storage.setConfig(i),[3,5];case 3:return n.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(i=n.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,i,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,i,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var i;e.lastCallback=new Date,i=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(i,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),R(this,void 0,void 0,function(){var r,i,n,s,o,a,l=this;return F(this,function(u){switch(u.label){case 0:r=t/e,i={remoteConfig:null,lastFetch:new Date},n=function(i){var n,o,a,u,c,d;return F(this,function(h){switch(h.label){case 0:n=!0,o=new AbortController,a=setTimeout(function(){return o.abort()},t),h.label=1;case 1:return h.trys.push([1,7,8,9]),[4,fetch(s.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:o.signal})];case 2:if((u=h.sent()).ok)return[3,4];return[4,u.text()];case 3:return c=h.sent(),s.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(u.status,": ").concat(c)),401===u.status||403===u.status?(s.logger.error("Remote config client fetch failed with ".concat(u.status,". Invalid API key; future fetches will be skipped.")),s.isLastFetchInvalidApiKey=!0,n=!1):u.status>=400&&u.status<500&&429!==u.status&&(n=!1),[3,6];case 4:return[4,u.json()];case 5:return[2,{value:{remoteConfig:h.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=h.sent())instanceof Error&&"AbortError"===d.name?s.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):s.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!n)return[2,"break"];if(!(i<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(r))})];case 10:h.sent(),h.label=11;case 11:return[2]}})},s=this,o=0,u.label=1;case 1:if(!(o<e))return[3,4];return[5,n(o)];case 2:if("object"==typeof(a=u.sent()))return[2,a.value];if("break"===a)return[3,4];u.label=3;case 3:return o++,[3,1];case 4:return[2,i]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(r.toString())},e.CONFIG_GROUP="browser",e}(),e4="tags",e5="counters",e6="histograms",e8="events",e7="internal",e9="last_flush_timestamp",te=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return(null==(e=eI())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return R(this,void 0,void 0,function(){return F(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,r){var i=indexedDB.open(e.dbName,1);i.onerror=function(){e.dbPromise=null,r(Error("Failed to open IndexedDB"))},i.onsuccess=function(){var r=i.result;r.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},r.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),r.close()},t(r)},i.onupgradeneeded=function(t){var r=t.target.result;e.createTables(r)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(e4)||e.createObjectStore(e4,{keyPath:"key"}),e.objectStoreNames.contains(e5)||e.createObjectStore(e5,{keyPath:"key"}),e.objectStoreNames.contains(e6)||e.createObjectStore(e6,{keyPath:"key"}
2),e.objectStoreNames.contains(e8)||e.createObjectStore(e8,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(e7)||e.createObjectStore(e7,{keyPath:"key"})},e.prototype.setTags=function(e){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:if(s.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=s.sent().transaction([e4],"readwrite")).objectStore(e4),[2,new Promise(function(i){var s=Object.entries(e);t.oncomplete=function(){i()},t.onabort=function(e){n.logger.debug("DiagnosticsStorage: Failed to set tags",e),i()},s.forEach(function(e){var t=M(e,2),i=t[0],s=t[1];r.put({key:i,value:s}).onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to set tag",i,s,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:if(s.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=s.sent().transaction([e5],"readwrite")).objectStore(e5),[2,new Promise(function(i){var s=Object.entries(e);t.oncomplete=function(){i()},t.onabort=function(e){n.logger.debug("DiagnosticsStorage: Failed to increment counters",e),i()},s.forEach(function(e){var t=M(e,2),i=t[0],s=t[1],o=r.get(i);o.onsuccess=function(){var e=o.result,t=e?e.value:0;r.put({key:i,value:t+s}).onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to update counter",i,e)}},o.onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to read existing counter",i,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:if(s.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=s.sent().transaction([e6],"readwrite")).objectStore(e6),[2,new Promise(function(i){var s=Object.entries(e);t.oncomplete=function(){i()},t.onabort=function(e){n.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),i()},s.forEach(function(e){var t=M(e,2),i=t[0],s=t[1],o=r.get(i);o.onsuccess=function(){var e,t=o.result;e=t?{key:i,count:t.count+s.count,min:Math.min(t.min,s.min),max:Math.max(t.max,s.max),sum:t.sum+s.sum}:{key:i,count:s.count,min:s.min,max:s.max,sum:s.sum},r.put(e).onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i,e)}},o.onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",i,e)}})})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:if(s.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return r=(t=s.sent().transaction([e8],"readwrite")).objectStore(e8),[2,new Promise(function(i){t.oncomplete=function(){i()},t.onabort=function(e){n.logger.debug("DiagnosticsStorage: Failed to add event records",e),i()};var s=r.count();s.onsuccess=function(){var t=Math.max(0,10-s.result);t<e.length&&n.logger.debug("DiagnosticsStorage: Only added ".concat(t," of ").concat(e.length," events due to storage limit")),e.slice(0,t).forEach(function(e){r.add(e).onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},s.onerror=function(e){n.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return R(this,void 0,void 0,function(){var r,i,n;return F(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return i=(r=s.sent().transaction([e7],"readwrite")).objectStore(e7),[2,new Promise(function(n,s){r.onabort=function(){return s(Error("Failed to set internal value"))};var o=i.put({key:e,value:t});o.onsuccess=function(){return n()},o.onerror=function(){return s(Error("Failed to set internal value"))}})];case 2:return n=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",n),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return R(this,void 0,void 0,function(){var t,r,i;return F(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(t=n.sent().transaction([e7],"readonly")).objectStore(e7),[2,new Promise(function(i,n){t.onabort=function(){return n(Error("Failed to get internal value"))};var s=r.get(e);s.onsuccess=function(){return i(s.result)},s.onerror=function(){return n(Error("Failed to get internal value"))}})];case 2:return i=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return R(this,void 0,void 0,function(){var e,t;return F(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(e9)];case 1:return[2,(e=r.sent())?parseInt(e.value,10):void 0];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(e9,e.toString())];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(r,i){var n=e.objectStore(t).clear();n.onsuccess=function(){return r()},n.onerror=function(){return i(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return R(this,void 0,void 0,function(){var e,t,r,i,n,s,o;return F(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent().transaction([e4,e5,e6,e8],"readwrite"),[4,Promise.all([this.getAllFromStore(e,e4),this.getAllFromStore(e,e5),this.getAllFromStore(e,e6),this.getAllFromStore(e,e8)])];case 2:return r=(t=M.apply(void 0,[a.sent(),4]))[0],i=t[1],n=t[2],s=t[3],[4,Promise.all([this.clearTable(e,e5),this.clearTable(e,e6),this.clearTable(e,e8)])];case 3:return a.sent(),[2,{tags:r,counters:i,histogramStats:n,events:s}];case 4:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",o),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,i){var n=e.objectStore(t).getAll();n.onsuccess=function(){return r(n.result)},n.onerror=function(){return i(Error("Failed to get all from ".concat(t)))}})},e}(),tt=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return t}
2,tr=function(e,t){return 31*Math.abs(tt(e.toString()))%1e5/1e5<t},ti=function(){var e=eI();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},tn=function(e){var t=eI();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",C({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,i=null==t?void 0:t.stack,n=ts({filename:e.filename,stack:i});n&&r({type:"error",message:e.message,stack:i,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:n}})},!0),t.addEventListener("unhandledrejection",function(e){var t,i=e.reason instanceof Error?e.reason:void 0,n=null==i?void 0:i.stack,s=to(n),o=ts({filename:s,stack:n});o&&r({type:"unhandledrejection",message:null!=(t=null==i?void 0:i.message)?t:ta(e.reason),stack:n,filename:s,errorName:null==i?void 0:i.name,metadata:{isTrusted:e.isTrusted,matchReason:o}})},!0)}},ts=function(e){var t,r,i=ti();if(0!==i.length)try{for(var n=L(i),s=n.next();!s.done;s=n.next()){var o=s.value;if(e.filename&&e.filename.includes(o))return"filename";if(e.stack&&e.stack.includes(o))return"stack"}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},to=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ta=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},tl=function(){function e(e,t,r,i){void 0===r&&(r="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===r?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(i,null,2)),this.config=C({enabled:!0,sampleRate:0},i),this.startTimestamp=Date.now(),this.shouldTrack=tr(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,te.isSupported()?this.storage=new te(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),tn(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(void 0===t&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");var r=this.inMemoryHistograms[e];r?(r.count+=1,r.min=Math.min(r.min,t),r.max=Math.max(r.max,t),r.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10)return void this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return R(this,void 0,void 0,function(){var e,t,r,i;return F(this,function(n){switch(n.label){case 0:if(!this.storage)return[2];return e=C({},this.inMemoryTags),t=C({},this.inMemoryCounters),r=C({},this.inMemoryHistograms),i=D([],M(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(r),this.storage.addEventRecords(i)])];case 1:return n.sent(),[2]}})})},e.prototype._flush=function(){return R(this,void 0,void 0,function(){var e,t,r,i,n,s,o,a,l,u;return F(this,function(c){switch(c.label){case 0:if(!this.storage)return[2];return[4,this.saveAllDataToStorage()];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:if(t=(e=c.sent()).tags,r=e.counters,i=e.histogramStats,n=e.events,this.storage.setLastFlushTimestamp(Date.now()),s={},t.forEach(function(e){s[e.key]=e.value}),o={},r.forEach(function(e){o[e.key]=e.value}),a={}
2,i.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),l=n.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(o).length&&0===Object.keys(a).length&&0===l.length)return[2];return u={tags:s,histogram:a,counters:o,events:l},this.fetch(u),[2]}})})},e.prototype.fetch=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!eI())throw Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:if(!r.sent().ok)return this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2];return this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3];case 2:return t=r.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return R(this,void 0,void 0,function(){var e,t,r;return F(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=i.sent()||-1))return this.storage.setLastFlushTimestamp(e),this._setFlushTimer(3e5),[2];return(r=e-t)>=3e5?this._flush():this._setFlushTimer(3e5-r),[2]}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=tr(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),tu=e.i(61537),tc=tu.default||tu,td=function(e,t){var r,i,n;return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1&&("string"!=typeof(null==(i=null==(r=null==(n=eI())?void 0:n.chrome)?void 0:r.runtime)?void 0:i.id)||!!(null==e?void 0:e[t]))},th=function(e){return td(e,"attribution")},tp=function(e){return td(e,"formInteractions")},tf=function(e){return td(e,"pageViews")},tv=function(e){return td(e,"sessions")},tg=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},tm=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},t_=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},ty=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;if(!0===t)return{mainThreadBlock:!0};if("object"==typeof t&&null!==t)return t}},tb=function(e){if(tm(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tw=function(e){if(t_(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tS=function(e){var t;if(tg(e.autocapture)){var r=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?r=e.autocapture.networkTracking:e.networkTrackingOptions&&(r=e.networkTrackingOptions),X(X({},r),{captureRules:null==(t=null==r?void 0:r.captureRules)?void 0:t.map(function(t){var r,i,n;if((null==(r=t.urls)?void 0:r.length)&&(null==(i=t.hosts)?void 0:i.length)){var s=JSON.stringify(t.hosts),o=JSON.stringify(t.urls);return null==(n=e.loggerProvider)||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(s,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),X(X({},t),{hosts:void 0})}return t})})}},tE=function(e){var t,r=function(){return!1},i=void 0,n=e.pageCounter;return tf(e.defaultTracking)&&(r=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(i=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:i,eventType:t,pageCounter:n}},tk=function(e){if(tp(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},tx=function(e,t){for(var r=0;r<t.length;r++){var i=t[r],n=i.name,s=i.args,o=i.resolve,a=e&&e[n];if("function"==typeof a){var l=a.apply(e,s);"function"==typeof o&&o(null==l?void 0:l.promise)}}return e},tP=function(e){return e&&void 0!==e._q},tT=function(){if("u"<typeof navigator)return"";var e,t,r,i,n=navigator.userLanguage;return null!=(i=null!=(r=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?r:n)?i:""},tI="2.42.5",tA="amplitude-ts",tO=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tA,"/").concat(tI),"u">typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,r;return ee(this,void 0,void 0,function(){var i,n,s;return et(this,function(o){return i=new Date().getTime(),n=null!=(t=this.config.lastEventId)?t:-1,s=null!=(r=e.event_id)?r:n+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=i),[2,X(X(X(X(X(X(X(X({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:tT()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:eO(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent})]})})},e}(),tC=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return R(this,void 0,void 0,function(){return F(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return R(this,void 0,void 0,function(){return F(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return[2,(t=r.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return R(this,void 0,void 0,function(){return F(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return R(this,void 0,void 0,function(){return F(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return R(this,void 0,void 0,function(){return F(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),tR=function(){var e,t=eI();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},tF=function(){function e(e,t){void 0===t&&(t={}),this.options=C({},e),this.config=t}return e.prototype.isEnabled=function(){return R(this,void 0,void 0,function(){var t,r,i,n=this;return F(this,function(s){switch(s.label){case 0:return t="AMP_TEST",r=new e(C({},this.options)),i=String(Date.now()),[4,r.transaction(t,function(e){var r,s;try{e.set(i);var o=e.get()===i;return!o&&n.config.diagnosticsClient&&(null==(r=n.config.diagnosticsClient)||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(n.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null==(s=n.config.diagnosticsClient)||s.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:a,sync:!0})}return!1}
2finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:return t=r.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var r=tD(t);if(void 0===r)return void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));return JSON.parse(r)}catch(r){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t));return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,r;return R(this,void 0,void 0,function(){var i,n,s,o,a,l,u,c;return F(this,function(d){switch(d.label){case 0:i=eI(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(n=null==i?void 0:i.cookieStore))return[3,3];return[4,n.getAll(e)];case 2:if(s=d.sent()){s.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:s.map(function(e){return e.domain})}),null==(r=this.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(o=L(s)).next();!a.done;a=o.next())if(l=a.value,tN(l.domain,this.options.domain))return[2,l.value]}catch(e){u={error:e}}finally{try{a&&!a.done&&(c=o.return)&&c.call(o)}finally{if(u)throw u.error}}}d.label=3;case 3:return[3,5];case 4:return d.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,r,i=this,n=eI(),s=(null!=(r=null==(t=null==n?void 0:n.document)?void 0:t.cookie.split("; "))?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),o=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&s.length>1&&(o=s.find(function(t){var r;try{var n=a(t.substring(e.length+1));return n||null==(r=i.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.document.cookie"),n}catch(e){return!1}})),o||(o=s[0]),o)return o.substring(e.length+1)},e.prototype.set=function(e,t){return R(this,void 0,void 0,function(){return F(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var i=null!=(r=this.options.expirationDays)?r:0,n=null!==t?i:-1,s=void 0;if(n){var o=new Date;o.setTime(o.getTime()+24*n*36e5),s=o}var a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t))));s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite));var l=eI();(null==l?void 0:l.document)&&(l.document.cookie=a)}catch(t){var u=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}},e.prototype.remove=function(e){return R(this,void 0,void 0,function(){return F(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return R(this,void 0,void 0,function(){return F(this,function(e){return[2]})})},e.isDomainWritable=function(t){return R(this,void 0,void 0,function(){var r,i;return F(this,function(n){switch(n.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",i=new e({domain:"."+t}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,i.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var i=!!r.get();return i&&(e.cachedTlds[t]=!0),i}finally{r.set(null)}})];case 2:return[2,!!n.sent()];case 3:return n.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return R(this,void 0,void 0,function(){var r,i,n=this;return F(this,function(s){switch(s.label){case 0:if(r=tR(),i=function(){return t({get:function(){return n.getSync(e)},set:function(t){return n.setSync(e,t)}})},!r)return[2,i()];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),i)];case 2:return[2,s.sent()];case 3:return s.sent(),[2,i()];case 4:return[2]}})})},e.cachedTlds={},e}(),tL=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},tM=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},tD=function(e){var t;return null!=(t=tL(e))?t:tM(e)},tN=function(e,t){if(""===e&&""===t)return!0;
2if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,i=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===i.toLowerCase()},t$=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},tj=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return R(this,void 0,void 0,function(){var t,r,i;return F(this,function(n){switch(n.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),i="AMP_TEST",n.label=1;case 1:return n.trys.push([1,4,5,7]),[4,r.set(i,t)];case 2:return n.sent(),[4,r.get(i)];case 3:return[2,n.sent()===t];case 4:return n.sent(),[2,!1];case 5:return[4,r.remove(i)];case 6:return n.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=r.sent()))return[2,void 0];return[2,JSON.parse(t)];case 2:return r.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return R(this,void 0,void 0,function(){return F(this,function(r){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var r;return R(this,void 0,void 0,function(){return F(this,function(i){try{null==(r=this.storage)||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return R(this,void 0,void 0,function(){return F(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return R(this,void 0,void 0,function(){return F(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),tU=function(e){function t(t){var r,i,n,s=this;try{n=null==(r=eI())?void 0:r.localStorage}catch(e){null==(i=null==t?void 0:t.loggerProvider)||i.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),n=void 0}return(s=e.call(this,n)||this).loggerProvider=null==t?void 0:t.loggerProvider,s}return Q(t,e),t.prototype.set=function(t,r){var i;return ee(this,void 0,void 0,function(){var n;return et(this,function(s){switch(s.label){case 0:if(!(Array.isArray(r)&&r.length>1e3))return[3,2];return n=r.length-1e3,[4,e.prototype.set.call(this,t,r.slice(0,1e3))];case 1:return s.sent(),null==(i=this.loggerProvider)||i.error("Failed to save ".concat(n," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},t}(tj),tq=function(e){function t(){var t;return e.call(this,null==(t=eI())?void 0:t.sessionStorage)||this}return Q(t,e),t}(tj),tB=function(){function e(){}return e.prototype.send=function(e,t,r){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,r,i,n,s,o,a,l,u,c,d,h,p,f,v,g,m,_,y,b,S,E,k=e.code||0,x=this.buildStatus(k);switch(x){case w.Success:return{status:x,statusCode:k,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(r=e.payload_size_bytes)?r:0,serverUploadTime:null!=(i=e.server_upload_time)?i:0}};case w.Invalid:return{status:x,statusCode:k,body:{error:null!=(n=e.error)?n:"",missingField:null!=(s=e.missing_field)?s:"",eventsWithInvalidFields:null!=(o=e.events_with_invalid_fields)?o:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{},eventsWithInvalidIdLengths:null!=(l=e.events_with_invalid_id_lengths)?l:{},epsThreshold:null!=(u=e.eps_threshold)?u:0,exceededDailyQuotaDevices:null!=(c=e.exceeded_daily_quota_devices)?c:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(h=e.silenced_events)?h:[],throttledDevices:null!=(p=e.throttled_devices)?p:{},throttledEvents:null!=(f=e.throttled_events)?f:[]}};case w.PayloadTooLarge:return{status:x,statusCode:k,body:{error:null!=(v=e.error)?v:""}};case w.RateLimit:return{status:x,statusCode:k,body:{error:null!=(g=e.error)?g:"",epsThreshold:null!=(m=e.eps_threshold)?m:0,throttledDevices:null!=(_=e.throttled_devices)?_:{},throttledUsers:null!=(y=e.throttled_users)?y:{},exceededDailyQuotaDevices:null!=(b=e.exceeded_daily_quota_devices)?b:{},exceededDailyQuotaUsers:null!=(S=e.exceeded_daily_quota_users)?S:{},throttledEvents:null!=(E=e.throttled_events)?E:[]}};case w.Timeout:default:return{status:x,statusCode:k}}},e.prototype.buildStatus=function(e){return ez(e)?w.Success:429===e?w.RateLimit:413===e?w.PayloadTooLarge:408===e?w.Timeout:e>
2=400&&e<500?w.Invalid:e>=500?w.Failed:w.Unknown},e}();function tV(){return"u">typeof CompressionStream}function tz(e){return R(this,void 0,void 0,function(){var t;return F(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,new Response(new Blob([e]).stream().pipeThrough(new t("gzip"))).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var tH=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.state={done:4},r.customHeaders=t,r}return Q(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),ee(this,void 0,void 0,function(){var i=this;return et(this,function(n){return[2,new Promise(function(n,s){"u"<typeof XMLHttpRequest&&s(Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===i.state.done){var e=o.responseText;try{n(i.buildResponse(JSON.parse(e)))}catch(e){n(i.buildResponse({code:o.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},l=JSON.stringify(t),u=r&&l.length>=2048&&tV(),c=function(e){var t,r;a=X(X({},i.customHeaders),a);try{for(var n=er(Object.entries(a)),s=n.next();!s.done;s=n.next()){var l=ei(s.value,2),u=l[0],c=l[1];o.setRequestHeader(u,c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}o.send(e)};ee(i,void 0,void 0,function(){var e;return et(this,function(t){switch(t.label){case 0:if(!u)return[3,2];return[4,tz(l)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(l),[3,3];case 2:c(l),t.label=3;case 3:return[2]}})}).catch(s)})]})})},t}(tB),tW=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return Q(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),ee(this,void 0,void 0,function(){var i,n,s,o,a,l,u;return et(this,function(c){switch(c.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");if(i=JSON.stringify(t),n=r&&i.length>=2048&&tV(),s=i,o={"Content-Type":"application/json",Accept:"*/*"},!n)return[3,2];return[4,tz(i)];case 1:(a=c.sent())&&(o["Content-Encoding"]="gzip",s=a),c.label=2;case 2:return[4,fetch(e,{headers:o=X(X({},this.customHeaders),o),body:s,method:"POST"})];case 3:return[4,(l=c.sent()).text()];case 4:u=c.sent();try{return[2,this.buildResponse(JSON.parse(u))]}catch(e){return[2,this.buildResponse({code:l.status})]}}})})},t}(tB),tG=function(e){function t(){return e.call(this)||this}return Q(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),ee(this,void 0,void 0,function(){var r=this;return et(this,function(i){return[2,new Promise(function(i,n){var s=eI();if(!(null==s?void 0:s.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var o=JSON.stringify(t);if(s.navigator.sendBeacon(e,o))return i(r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()}));return i(r.buildResponse({code:500}))}catch(e){n(e)}})]})})},t}(tB),tJ=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},tK=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},tY="[Amplitude]",tQ="".concat(tY," Form Started"),tX="".concat(tY," Form Submitted"),tZ="".concat(tY," File Downloaded"),t0="session_start",t1="session_end",t2="".concat(tY," File Extension"),t3="".concat(tY," File Name"),t4="".concat(tY," Link ID"),t5="".concat(tY," Link Text"),t6="".concat(tY," Link URL"),t8="".concat(tY," Form ID"),t7="".concat(tY," Form Name"),t9="".concat(tY," Form Destination"),re="cookie",rt=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rr=function(e,t,r,i,n,s){void 0===n&&(n=!0),e.referrer;var o=e.referring_domain,a=Z(e,["referrer","referring_domain"]),l=t||{},u=(l.referrer,l.referring_domain),c=Z(l,["referrer","referring_domain"]),d=r.excludeInternalReferrers;if(d){var h=ro(d,i);if(!(h instanceof TypeError)&&e.referring_domain&&rc(e.referring_domain,s)){if("always"===h)return ra(h,e.referring_domain,i),!1;else if("ifEmptyCampaign"===h&&Object.values(X(X({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return ra(h,e.referring_domain,i),!1}}if(ri(r.excludeReferrers,e.referring_domain))return i.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!n&&Object.values(e).every(function(e){return!e})&&t)return i.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var p=JSON.stringify(a)!==JSON.stringify(c),f=rt(o||"")!==rt(u||""),v=!t||p||f;return v?i.debug("This is a new campaign. An $identify event will be sent."):i.debug("This is not a new campaign because it's the same as the previous one."),v},ri=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some(function(e){return e instanceof RegExp?e.test(t):e===t})},rn=function(e,t){var r=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(r)},rs=function(e){var t=e;
2return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},ro=function(e,t){if(!0===e)return V.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(V).includes(r))return r;if(void 0===r)return V.always}var i="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(i),TypeError(i)};function ra(e,t,r){var i="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?r.debug(i):"ifEmptyCampaign"===e&&r.debug("".concat(i," with empty campaign parameters"))}var rl=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],ru=function(e){var t,r,i=e||(null==(r=null==(t=eI())?void 0:t.location)?void 0:r.hostname);if(!i)return"";var n=i.split("."),s=n[n.length-1],o=n[n.length-2];return(rl.find(function(e){return i.endsWith(".".concat(e))})&&(s=n[n.length-2]+"."+n[n.length-1],o=n[n.length-3]),o)?"".concat(o,".").concat(s):s},rc=function(e,t){var r=eI();return!!r&&rn(e,(t||"").trim()||ru(r.location.hostname))},rd=function(e){function t(t,r,i,n,s,o,a,l,u,c,d,h,p,f,v,g,m,y,b,w,S,E,k,x,P,T,I,A,O,C,R,F,L,M,D,N,$,j,U,q,B,V,z,H){void 0===i&&(i=new tC),void 0===n&&(n={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===l&&(l=1e3),void 0===u&&(u=5),void 0===c&&(c=30),void 0===d&&(d=re),void 0===g&&(g=new ej),void 0===m&&(m=_.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===x&&(x="US"),void 0===I&&(I=18e5),void 0===A&&(A=new tU({loggerProvider:g})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===C&&(C="fetch"),void 0===R&&(R=!1),void 0===F&&(F=!0),void 0===j&&(j=!0),void 0===U&&(U=0),void 0===z&&(z=!1);var W,G=this;(G=e.call(this,{apiKey:t,storageProvider:A,transportProvider:rf(C)})||this).apiKey=t,G.appVersion=r,G.cookieOptions=n,G.defaultTracking=s,G.autocapture=o,G.flushIntervalMillis=l,G.flushMaxRetries=u,G.flushQueueSize=c,G.identityStorage=d,G.ingestionMetadata=h,G.instanceName=p,G.loggerProvider=g,G.logLevel=m,G.minIdLength=y,G.offline=b,G.partnerId=S,G.plan=E,G.serverUrl=k,G.serverZone=x,G.sessionTimeout=I,G.storageProvider=A,G.trackingOptions=O,G.transport=C,G.useBatch=R,G.fetchRemoteConfig=F,G.networkTrackingOptions=N,G.identify=$,G.enableDiagnostics=j,G.diagnosticsSampleRate=U,G.diagnosticsClient=q,G.remoteConfig=B,G.topLevelDomain=V,G.enableRequestBodyCompression=z,G.customEnrichment=H,G.version=tI,G._optOut=!1,G._cookieStorage=i,G.deviceId=a,G.lastEventId=f,G.lastEventTime=v,G.optOut=w,G.deferredSessionId=T,G.sessionId=P,G.pageCounter=M,G.userId=L,G.debugLogsEnabled=D,G.loggerProvider.enable(D?_.Debug:G.logLevel),G.networkTrackingOptions=N,G.identify=$,G.enableDiagnostics=j,G.diagnosticsSampleRate=U,G.diagnosticsClient=q;var J=null!=(W=null==B?void 0:B.fetchRemoteConfig)?W:F;return G.remoteConfig=G.remoteConfig||{},G.remoteConfig.fetchRemoteConfig=J,G.fetchRemoteConfig=J,G.topLevelDomain=V||ru(),G}return Q(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
2,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof tF&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(t$(this.apiKey),e)},t}(eq),rh=function(e,t,r){switch(void 0===e&&(e=re),void 0===t&&(t={}),e){case"localStorage":return new tU;case"sessionStorage":return new tq;case"none":return new tC;default:return new tF(X(X({},t),{expirationDays:t.expiration}),r)}},rp=function(e){var t,r;return void 0===e&&(e={}),(null==(t=e.remoteConfig)?void 0:t.fetchRemoteConfig)===!0||(null==(r=e.remoteConfig)?void 0:r.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},rf=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0;return"xhr"===t?new tH(r):"beacon"===t?new tG:new tW(r)},rv=function(){return(rv=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function rg(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function rm(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function r_(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function ry(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var rb="data-amp-mask",rw="*****",rS=/\b(?:\d[ -]*?){13,16}\b/,rE=/(\d{3}-?\d{2}-?\d{4})/g,rk=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,rx=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,i,n=e;n=(n=(n=n.replace(rS,rw)).replace(rE,rw)).replace(rk,rw);try{for(var s=L(t),o=s.next();!o.done;o=s.next()){var a=o.value;try{n=n.replace(a,rw)}catch(e){}}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return n},rP=function(e){if("u"<typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(rb)?rw:e?e(document.title):document.title},rT=function(){function e(){}return e.prototype.parse=function(){return R(this,void 0,void 0,function(){return F(this,function(e){return[2,C(C(C(C({},eS),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=e0();
2return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=null!=(t=null==(e=r.referrer)?void 0:e.split("/")[2])?t:void 0}catch(e){}return r},e.prototype.getClickIds=function(){var e,t=e0();return(e={})[ed]=t[ed],e[eh]=t[eh],e[ep]=t[ep],e[ef]=t[ef],e[ev]=t[ev],e[eg]=t[eg],e[em]=t[em],e[e_]=t[e_],e[ey]=t[ey],e[eb]=t[eb],e[ew]=t[ew],e},e}(),rI=function(e){var t={};for(var r in e){var i=e[r];i&&(t[r]=i)}return t},rA="AMP_PAGE_VIEW",rO=function(e){void 0===e&&(e={});var t,r,i,n=eI(),s=void 0,o=!1,a=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,c=void 0===u?"[Amplitude] Page Viewed":u,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==s||s.error("Malformed URI sequence: ",e)}return t},h=function(e){return rg(void 0,void 0,void 0,function(){var t,r,i;return rm(this,function(n){switch(n.label){case 0:return t=d("u">typeof location&&location.href||""),i={event_type:c},r=[{}],[4,rC()];case 1:return[2,(i.event_properties=rv.apply(void 0,[rv.apply(void 0,r.concat([n.sent()])),{"[Amplitude] Page Domain":"u">typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"u">typeof location&&d(location.pathname)||"","[Amplitude] Page Title":rP(rx),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),i)]}})})},p=function(){return void 0===a||"function"==typeof a&&a()},f="u">typeof location?location.href:null,v=function(){rg(void 0,void 0,void 0,function(){var e,r,n,o,a;return rm(this,function(u){switch(u.label){case 0:if(r=rF(l,e=location.href,f||"")&&p(),f=e,!r)return[3,4];if(n=void 0,i&&(n=eO(),i.set(rA,{pageViewId:n})),null==s||s.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(o=t).track,[4,h(n)];case 2:a.apply(o,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return rg(void 0,void 0,void 0,function(){var l,u,c;return rm(this,function(d){switch(d.label){case 0:if(t=a,r=e,(s=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,n){try{i=new tj(n.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}n.addEventListener("popstate",v),n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var i=r_(r,3),n=i[0],s=i[1],a=i[2];e.apply(t,[n,s,a]),o&&v()}})}if(!p())return[3,2];return s.log("Tracking page view event"),l=void 0,i&&(l=eO(),i.set(rA,{pageViewId:l})),c=(u=t).track,[4,h(l)];case 1:c.apply(u,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return rg(void 0,void 0,void 0,function(){var t,n,o;return rm(this,function(l){switch(l.label){case 0:if(!("attribution"===a&&rR(e)))return[3,4];if(null==s||s.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!i)return[3,2];return[4,i.get(rA)];case 1:t=null==(n=l.sent())?void 0:n.pageViewId,l.label=2;case 2:return[4,h(t)];case 3:e.event_type=(o=l.sent()).event_type,e.event_properties=rv(rv({},e.event_properties),o.event_properties),l.label=4;case 4:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=rv(rv({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return rg(void 0,void 0,void 0,function(){return rm(this,function(e){return n&&(n.removeEventListener("popstate",v),o=!1),[2]})})}}},rC=function(){return rg(void 0,void 0,void 0,function(){var e;return rm(this,function(t){switch(t.label){case 0:return e=rI,[4,new rT().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},rR=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[v.SET]||{},i=t[v.UNSET]||{},n=ry(ry([],r_(Object.keys(r)),!1),r_(Object.keys(i)),!1);return Object.keys(eS).every(function(e){return n.includes(e)})}return!1},rF=function(e,t,r){if("pathOnly"!==e)return t!==r;if(""==r)return!0;var i=new URL(t),n=new URL(r);return i.origin+i.pathname!==n.origin+n.pathname},rL=function(){var e,t,r=[],i=function(e,t,i){e.addEventListener(t,i),r.push({element:e,type:t,handler:i})},n=function(){r.forEach(function(e){var t=e.element,r=e.type,i=e.handler;null==t||t.removeEventListener(r,i)}),r=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,n){return ee(void 0,void 0,void 0,function(){var s,o;return et(this,function(a){return t=tk(r),s=function(){if(!n)return void r.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");if("u">typeof document){var s=new WeakSet,o=function(e){if(!s.has(e)){s.add(e);var o=!1;i(e,"change",function(){var t,r=rD(e);o||n.track(tQ,((t={})[t8]=rM(e.id),t[t7]=rM(e.name),t[t9]=r,t)),o=!0}),i(e,"submit",function(i){var s,a,l=rD(e);if(o||n.track(tQ,((s={})[t8]=rM(e.id),s[t7]=rM(e.name),s[t9]=l,s)),o=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"u">typeof SubmitEvent&&i instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(i))return}catch(e){r.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else r.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");n.track(tX,((a={})[t8]=rM(e.id),a[t7]=rM(e.name),a[t9]=l,a)),o=!1})}};
2Array.from(document.getElementsByTagName("form")).forEach(o),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&o(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(o)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?s():(o=eI())?o.addEventListener("load",s):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return ee(void 0,void 0,void 0,function(){return et(this,function(t){return[2,e]})})},teardown:function(){return ee(void 0,void 0,void 0,function(){return et(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},rM=function(e){if("string"==typeof e)return e},rD=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},rN=function(){var e,t=[],r=function(e,r,i){e.addEventListener(r,i),t.push({element:e,type:r,handler:i})},i=function(){t.forEach(function(e){var t=e.element,r=e.type,i=e.handler;null==t||t.removeEventListener(r,i)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,i){return ee(void 0,void 0,void 0,function(){var n,s;return et(this,function(o){return n=function(){if(!i)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");if("u">typeof document){var n=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,n=s.exec(t.href),o=null==n?void 0:n[1];o&&r(e,"click",function(){var r;o&&i.track(tZ,((r={})[t2]=o,r[t3]=t.pathname,r[t4]=e.id,r[t5]=e.text,r[t6]=e.href,r))})},s=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(n),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?n():(s=eI())?s.addEventListener("load",n):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return ee(void 0,void 0,void 0,function(){return et(this,function(t){return[2,e]})})},teardown:function(){return ee(void 0,void 0,void 0,function(){return et(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},r$=!1,rj=function(e){r$||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),r$=!0)},rU=function(){var e=eI(),t=[],r=function(r,i){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,i),t.push({type:r,handler:i}))},i=function(){t.forEach(function(t){var r=t.type,i=t.handler;null==e||e.removeEventListener(r,i)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return ee(void 0,void 0,void 0,function(){return et(this,function(i){return"u"<typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,r("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),r("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return ee(void 0,void 0,void 0,function(){return et(this,function(e){return i(),[2]})})}}};function rq(e,t,r){var i,n,s=[];try{for(var o=er(null!=t?t:[]),a=o.next();!a.done;a=o.next()){var l=a.value;try{s.push(new RegExp(l))}catch(e){r.loggerProvider.warn("Invalid regex pattern: ".concat(l),e)}}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return e.concat(s)}var rB=function(){return(rB=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function rV(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function rz(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function rH(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);
2if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function rW(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function rG(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var rJ="https://app.amplitude.com",rK={US:rJ,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},rY="__AMPLITUDE_MESSENGER_INSTANCE__",rQ="__AMPLITUDE_MESSENGER__",rX=function(){function e(e){var t=(void 0===e?{}:e).origin;this[S]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?rJ:t}return e.prototype.notify=function(e){var t,r,i,n;null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Message sent: ",JSON.stringify(e)),null==(n=null==(i=window.opener)?void 0:i.postMessage)||n.call(i,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var i=this;void 0===r&&(r={timeout:15e3});var n="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),s={id:n,action:e,args:t};return new Promise(function(t,o){i.requestCallbacks[n]={resolve:t,reject:o},i.notify(s),r.timeout>0&&setTimeout(function(){o(Error("".concat(e," timed out (id: ").concat(n,")"))),delete i.requestCallbacks[n]},r.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null==(t=this.logger)||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null==(s=null==(n=this.logger)?void 0:n.warn)||s.call(n,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var r,i,n,s,o=this.pendingMessages.get(e);if(o){this.pendingMessages.delete(e);try{for(var a=L(o),l=a.next();!l.done;l=a.next()){var u=l.value;t(u)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return R(this,void 0,void 0,function(){var t,r,i;return F(this,function(n){switch(n.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];r=(document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,r){var i;try{var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=e,n.addEventListener("load",function(){t({status:!0})},{once:!0}),n.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null==(i=document.head)||i.appendChild(n)}catch(e){r(e)}})).then(function(){}),this.scriptLoadPromises.set(e,r),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r];case 2:return n.sent(),[3,4];case 3:throw i=n.sent(),this.scriptLoadPromises.delete(e),i;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,i=this,n=void 0===e?{}:e,s=n.logger,o=n.endpoint;s&&(this.logger=s),o&&this.endpoint===rJ&&(this.endpoint=o),this.isSetup||(this.isSetup=!0,null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null==(r=null==(t=i.logger)?void 0:t.debug)||r.call(t,"Message received: ",JSON.stringify(e)),i.endpoint===e.origin){var t,r,n,s,o,a=e.data,l=null==a?void 0:a.action;if(l)if("id"in a&&a.id)null==(s=null==(n=i.logger)?void 0:n.debug)||s.call(n,"Received Response to previous request: ",JSON.stringify(e)),i.handleResponse(a);else{if("ping"===l)return void i.notify({action:"pong"});var u=i.actionHandlers.get(l);if(u)u(a.data);else{var c=null!=(o=i.pendingMessages.get(l))?o:[];c.push(a.data),i.pendingMessages.set(l,c)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=eI();(null==e?void 0:e[rQ])===this&&delete e[rQ]},e}();S=rY;var rZ="__AMPLITUDE_BACKGROUND_CAPTURE__",r0=e.i(782291);function r1(e,t){return new r0.default(function(r){e.subscribe({next:function(e){t(e).then(function(e){return r.next(e)}).catch(function(e){return r.error(e)})},error:function(e){r.error(e)},complete:function(){r.complete()}})})}function r2(e,t){return new r0.default(function(r){var i=!1,n=new Set,s=function(){var e,t;i=!0;try{for(var r=L(n),s=r.next();!s.done;s=r.next()){var o=s.value;try{o.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}n.clear()},o=function(e){var t=e.subscribe({next:function(e){i||r.next(e)},error:function(e){i||(i=!0,r.error(e),s())},complete:function(){n.delete(t),i||0!==n.size||(r.complete(),s(),i=!0)}});n.add(t)};return o(e),o(t),s})}function r3(e){var t=new Set,r=null;function i(){null==r||r.unsubscribe(),r=null,t.clear()}return new r0.default(function(n){return t.add(n),null===r&&(r=e.subscribe({next:function(e){try{for(var r,i,n,s=L(t),o=s.next();!o.done;o=s.next()){var a=o.value;null==(n=a.next)||n.call(a,e)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},error:function(e){try{for(var r,n,s,o=L(t),a=o.next();!a.done;a=o.next()){var l=a.value;null==(s=l.error)||s.call(l,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}i()},complete:function(){try{for(var e,r,n,s=L(t),o=s.next();!o.done;o=s.next()){var a=o.value;null==(n=a.complete)||n.call(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}i()}})),function(){t.delete(n),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var r4="1.27.2",r5="[Amplitude] Element Clicked",r6="[Amplitude] Element Tag",r8="[Amplitude] Element Text",r7="[Amplitude] Page URL",r9="[Amplitude] Viewport Height",ie="[Amplitude] Viewport Width",it="[Amplitude] Page View ID",ir="data-amp-mask-attributes",ii=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},is=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},io=["input","select","textarea"],ia=function(e,t){var r,i=null==(r=null==window?void 0:window.getComputedStyle)?void 0:r.call(window,e);return(null==i?void 0:i.getPropertyValue("cursor"))==="pointer"&&"click"===t},il=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&ii(window.location.href,r))&&!!ii(window.location.href,t)},iu=function(e,t,r){return void 0===r&&(r=!1),function(i,n){var s,o,a=e.shouldTrackEventResolver,l=null==(o=null==(s=null==n?void 0:n.tagName)?void 0:s.toLowerCase)?void 0:o.call(s);if(!l)return!1;if(a)return a(i,n);if(!il(e))return!1;var u=String(null==n?void 0:n.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}var c=ia(n,i);if(r&&c)return!0;
2if(t&&!t.some(function(e){var t;return!!(null==(t=null==n?void 0:n.matches)?void 0:t.call(n,e))}))return!1;switch(l){case"input":case"select":case"textarea":return"change"===i||"click"===i;default:if(c)return!0;return"click"===i}}},ic=function(e){var t,r,i,n=null==(r=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:r.call(t),s=e instanceof HTMLElement&&(null==(i=e.getAttribute("contenteditable"))?void 0:i.toLowerCase())==="true";return!io.includes(n)&&!s},id=function(e){return Object.keys(e).reduce(function(t,r){var i=e[r];return null!=i&&("object"!=typeof i||0!==Object.keys(i).length)&&("string"!=typeof i||0!==i.trim().length)&&(t[r]=i),t},{})},ih=function(){var e;try{var t=eI(),r=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var i=JSON.parse(r);if("string"==typeof i.pageViewId)return i.pageViewId}catch(e){}},ip=function(e,t){return e?t.some(function(t){var r;return null==(r=null==e?void 0:e.matches)?void 0:r.call(e,t)})?e:ip(null==e?void 0:e.parentElement,t):null},iv=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};(a=E||(E={}))[a.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",a[a.MIDDLE=1]="MIDDLE",a[a.RIGHT=2]="RIGHT";var ig="__AMPLITUDE_VISUAL_TAGGING__",im=r0,i_=eI(),iy=null==i_?void 0:i_.console,ib={},iw={},iS=!1,iE=function(e,t){if(!iy||"function"!=typeof iy[e]||!iw[e]&&(iw[e]=iy[e],iy[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{if(ib[e]&&!iS){iS=!0;var i=ib[e];i&&i.forEach(function(r){try{r(e,t)}catch(e){}})}}catch(e){}return iS=!1,iw[e].apply(iy,t)},0))return Error("Console override failed");ib[e]?ib[e].push(t):ib[e]=[t]},ik=function(e){var t,r;try{for(var i=L(Object.values(ib)),n=i.next();!n.done;n=i.next())for(var s=n.value,o=s.length-1;o>=0;o--)if(s[o]===e){s.splice(o,1);break}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},ix=eI(),iP=function(){return new im.default(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},iT=function(e){return void 0===e&&(e="click"),new im.default(function(t){var r,i=function(e){t.next(e)};return null==(r=eI())||r.document.addEventListener(e,i,{capture:!0}),function(){var t;null==(t=eI())||t.document.removeEventListener(e,i,{capture:!0})}})},iI=function(){var e=r2(new im.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=rB(rB({},r),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(r.message=t.error),e.next(r)}};return ix.addEventListener("error",t),function(){ix.removeEventListener("error",t)}}),new im.default(function(e){var t=function(t){var r={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(r.message=t.reason.message,r.stack=t.reason.stack):"string"==typeof t.reason&&(r.message=t.reason),e.next(r)};return ix.addEventListener("unhandledrejection",t),function(){ix.removeEventListener("unhandledrejection",t)}}));return r2(e,new im.default(function(e){var t=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(n=r[0][0]),e.next({kind:"console",message:n})};return iE("error",t),function(){ik(t)}}))},iA=function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){console.error("Error matching event to filter",e)}return!1},iO=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var r=document.documentElement;if(e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector)return r.querySelector(e.selector);return r}}catch(e){}},iC=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var i=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=i}})},iR={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},iF=function(e){var t,r,i,n,s=Object.values(iR).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return s;try{for(var o=rH(e),a=o.next();!a.done;a=o.next()){var l=a.value;try{try{for(var u=(i=void 0,rH(l.definition)),c=u.next();!c.done;c=u.next()){var d=iR[c.value.event_type];d&&s[d].add(l.id)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return s},iL=function(e){var t,r,i,n,s=new Map;try{for(var o=rH(e),a=o.next();!a.done;a=o.next()){var l=a.value;try{for(var u=(i=void 0,rH(l.conditions)),c=u.next();!c.done;c=u.next()){var d=c.value;if("LABELED_EVENT"===d.type){var h=d.match.eventId,p=s.get(h);p||(p=[],s.set(h,p)),p.push(l)}}}catch(e){i={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return s},iM=function(e,t){var r,i,n,s,o=new Set;try{for(var a=rH(e),l=a.next();!l.done;l=a.next()){var u=l.value,c=t.get(u.id);if(c)try{for(var d=(n=void 0,rH(c)),h=d.next();!h.done;h=d.next()){var p=h.value;o.add(p)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(s=d.return)&&s.call(d)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return Array.from(o)}
2,iD=function(){function e(e,t,r,i){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=i}return e.prototype.evaluate=function(e){var t,r,i=this.options.pageActions;if(!i)return e;var n=iM(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return i.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return iR[t.event_type]===e.type&&t.filters.every(function(t){return iA(e,t)})})}),this.labeledEventToTriggerMap);try{for(var s=rH(n),o=s.next();!o.done;o=s.next()){var a=o.value;iC(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=r},e}(),iN=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ir,rb]),i$=["type"],ij=["svg","path","g"],iU=["password","hidden"],iq=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),iB=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],i=e;i;){var n=iV(i,!!t,i===e);if(!n||(r.push(n),n.optimized))break;i=i.parentElement}return r.reverse(),r.join(" > ")},iV=function(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE)return null;var i,n,s=e.getAttribute("id");if(t){if(s)return new iq(c(s),!0);var o=e.tagName.toLowerCase();if("body"===o||"head"===o||"html"===o)return new iq(o,!0)}var a=e.tagName.toLowerCase();if(s)return new iq(a+c(s),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new iq(a,!0);function u(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]}function c(e){return"#"+CSS.escape(e)}for(var d=u(e),h=!1,p=!1,f=-1,v=-1,g=l.children,m=0;g&&(-1===f||!p)&&m<g.length;++m){var _=g[m];if(_.nodeType===Node.ELEMENT_NODE){if(v+=1,_===e){f=v;continue}if(!p&&_.tagName.toLowerCase()===a){h=!0;var y=new Set(d);if(!y.size){p=!0;continue}for(var b=u(_),w=0;w<b.length;++w){var S=b[w];if(y.has(S)&&(y.delete(S),!y.size)){p=!0;break}}}}}var E=a;if(r&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(E+="[type="+CSS.escape(e.getAttribute("type")||"")+"]"),p)E+=":nth-child("+String(f+1)+")";else if(h)try{for(var k=rH(d),x=k.next();!x.done;x=k.next()){var P=x.value;E+="."+CSS.escape(P.slice(1))}}catch(e){i={error:e}}finally{try{x&&!x.done&&(n=k.return)&&n.call(k)}finally{if(i)throw i.error}}return new iq(E,!1)},iz=function(e,t){var r,i,n,s=this;this.replaceSensitiveString=function(e){return rx(e,s.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,i,n,o=performance.now(),a=[];if(!e)return[];for(var l=function(e){var t=[];if(!e)return t;
2t.push(e);for(var r=e.parentElement;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e),u=new Map,c=l.length-1;c>=0;c--){var d=l[c];if(d){var h,p=(h=d.getAttribute(ir))?h.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],f=new Set(rG(rG([],rW(c===l.length-1?[]:null!=(i=u.get(l[c+1]))?i:new Set),!1),rW(p),!1));u.set(d,f)}}a=l.map(function(e){var t;return function(e,t){if(null===e)return null;var r,i,n,s,o,a,l=String(e.tagName).toLowerCase(),u={tag:l},c=Array.from(null!=(s=null==(n=e.parentElement)?void 0:n.children)?s:[]);c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(o=e.previousElementSibling)?void 0:o.tagName)?void 0:a.toLowerCase();d&&(u.prevSib=String(d));var h=e.getAttribute("id");h&&(u.id=String(h));var p=Array.from(e.classList);p.length&&(u.classes=p);var f={},v=Array.from(e.attributes).filter(function(e){return!iN.has(e.name)}),g=!ic(e);if(!iU.includes(String(e.getAttribute("type")))&&!ij.includes(l))try{for(var m=rH(v),_=m.next();!_.done;_=m.next()){var y=_.value;if(!g||i$.includes(y.name)){if(t.has(y.name)){f[y.name]=rw;continue}f[y.name]=String(y.value).substring(0,128)}}}catch(e){r={error:e}}finally{try{_&&!_.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return Object.keys(f).length&&(u.attrs=f),u}(e,null!=(t=u.get(e))?t:new Set)});var v=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=rW(t,2),i=r[0],n=r[1];e.attrs&&(e.attrs[i]=s.replaceSensitiveString(n))})};try{for(var g=rH(a),m=g.next();!m.done;m=g.next()){var _=m.value;v(_)}}catch(e){t={error:e}}finally{try{m&&!m.done&&(r=g.return)&&r.call(g)}finally{if(t)throw t.error}}var y=performance.now();return null==(n=s.diagnosticsClient)||n.recordHistogram("autocapturePlugin.getHierarchy",y-o),a},this.getNearestLabel=function(e){var t,r=e.parentElement;if(!r)return"";try{t=r.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?s.getText(t):s.getNearestLabel(r)},this.getElementPath=function(e){if(!e)return"";var t,r=performance.now(),i=iB(e),n=performance.now();return null==(t=s.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",n-r),i},this.getEventProperties=function(e,t,r){var i,n,o,a,l=null==(o=null==(n=null==t?void 0:t.tagName)?void 0:n.toLowerCase)?void 0:o.call(n),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=s.getHierarchy(t),d=null==(a=c[0])?void 0:a.attrs,h=s.getNearestLabel(t),p=Object.entries(null!=d?d:{}).reduce(function(e,t){var i=rW(t,2),n=i[0],s=i[1];if(n.startsWith(r)){var o=n.replace(r,"");o&&(e[o]=s||"")}return e},{}),f=((i={})["[Amplitude] Element Hierarchy"]=c,i[r6]=l,i[r8]=s.getText(t),i["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),i["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),i["[Amplitude] Element Attributes"]=p,i["[Amplitude] Element Path"]=s.getElementPath(t),i["[Amplitude] Element Parent Label"]=h,i[r7]=is(window.location.href.split("?")[0]),i["[Amplitude] Page Title"]=rP(s.replaceSensitiveString),i[r9]=window.innerHeight,i[ie]=window.innerWidth,i),v=ih();if(v&&(f[it]=v),f["[Amplitude] Element ID"]=t.getAttribute("id")||"",f["[Amplitude] Element Class"]=t.getAttribute("class"),f["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===l&&"click"===e&&t instanceof HTMLAnchorElement){var g=t.href.substring(0,128);f["[Amplitude] Element Href"]=s.replaceSensitiveString(g)}return id(f)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,i,n){void 0===n&&(n=!1);var o=s.addTypeAndTimestamp(e,t);if(("click"===o.type||"change"===o.type)&&null!==o.event.target){if(n&&ia(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=s.getEventProperties(o.type,o.closestTrackedAncestor,i),o;var a=ip(o.event.target,r);a&&(o.closestTrackedAncestor=a,o.targetElementProperties=s.getEventProperties(o.type,a,i))}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=iO(e,t);if(r){if("TEXT"===e.elementExtractType)return s.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,r,i="[".concat(rb,"], [contenteditable]");if(!e.querySelector(i))return e.innerText;var n="",o=Array.from(e.childNodes);try{for(var a=rH(o),l=a.next();!l.done;l=a.next()){var u=l.value;if(u.nodeType===Node.TEXT_NODE){n+=u.textContent||"";continue}if(u instanceof Element){if(u.hasAttribute(rb)||u.hasAttribute("contenteditable")){n+=rw;continue}n+=s.getTextWithMaskedDescendants(u)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n},this.getText=function(e){if(null!==e.closest("[".concat(rb,"]")))return rw;var t="";return t=e.querySelector("[".concat(rb,"], [contenteditable]"))?s.getTextWithMaskedDescendants(e):e.innerText||"",s.replaceSensitiveStr
2ing(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,r,i,n=null==(i=null==(r=null==e?void 0:e.tagName)?void 0:r.toLowerCase)?void 0:i.call(r);return id(((t={})[r6]=n,t[r8]=s.getText(e),t[r7]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var o=null!=(n=e.maskTextRegex)?n:[],a=[];try{for(var l=rH(o),u=l.next();!u.done;u=l.next()){var c=u.value;if(a.length>=25)break;if(c instanceof RegExp)a.push(c);else if("pattern"in c&&"string"==typeof c.pattern)try{a.push(RegExp(c.pattern,"i"))}catch(e){}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=a},im=r0;(l=k||(k={})).ClickObservable="clickObservable",l.ChangeObservable="changeObservable",l.NavigateObservable="navigateObservable",l.MutationObservable="mutationObservable",l.ScrollObservable="scrollObservable",l.ExposureObservable="exposureObservable",l.BrowserErrorObservable="browserErrorObservable",l.SelectionObservable="selectionObservable",l.MouseMoveObservable="mouseMoveObservable";var iH=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",r4);var r,i,n,s,o,a,l,u,c,d,h,p,f,v=e.dataAttributePrefix,g=void 0===v?q:v,m=e.visualTaggingOptions,_=void 0===m?{enabled:!0}:m;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:U,e.actionClickAllowlist=null!=(i=e.actionClickAllowlist)?i:B,e.debounceTime=null!=(n=e.debounceTime)?n:0;var y=(null==(s=e.viewportContentUpdated)?void 0:s.enabled)!==!1,b=null!=(l=null!=(a=null==(o=e.viewportContentUpdated)?void 0:o.exposureDuration)?a:e.exposureDuration)?l:150;e.viewportContentUpdated=rB(rB({},e.viewportContentUpdated),{exposureDuration:b}),e.pageUrlExcludelist=null==(u=e.pageUrlExcludelist)?void 0:u.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(e){console.warn("Invalid regex pattern: ".concat(t.pattern),e)}return e},[]);var w="@amplitude/plugin-autocapture-browser",S=[],E=new iz(e,t),x=new Set,P=new Set,T=function(){var t,r,i,n=r3(iT().map(function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,g)})),s=r3(new im.default(function(t){var r,i=function(r){var i=E.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,g);t.next(i)};return null==(r=eI())||r.document.addEventListener("change",i,{capture:!0}),function(){var e;return null==(e=eI())?void 0:e.document.removeEventListener("change",i)}}));window.navigation&&(i=r3(new im.default(function(t){var r=function(r){var i=E.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,g);t.next(i)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var o=r3(iP().map(function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,g)})),a=new im.default(function(e){var t,r=function(t){e.next(t)};return null==(t=eI())||t.addEventListener("scroll",r),function(){var e;null==(e=eI())||e.removeEventListener("scroll",r)}}),l=(t=e.cssSelectorAllowlist,new im.default(function(e){var r,i=eI();if(!(null==i?void 0:i.IntersectionObserver))return function(){};var n=new IntersectionObserver(function(t){t.forEach(function(t){e.next(t)})},{root:null,rootMargin:"0px",threshold:1}),s=t.join(",");(null!=(r=null==i?void 0:i.document.querySelectorAll(s))?r:[]).forEach(function(e){n.observe(e)});var a=o.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(s)&&n.observe(e),e.querySelectorAll(s).forEach(function(e){n.observe(e)}))})})});return function(){a.unsubscribe(),n.disconnect()}}));return(r={})[k.ChangeObservable]=s,r[k.ClickObservable]=n,r[k.MutationObservable]=o,r[k.NavigateObservable]=i,r[k.ScrollObservable]=a,r[k.ExposureObservable]=l,r},I=iF(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),A=iL(null!=(p=null==(h=e.pageActions)?void 0:h.triggers)?p:[]),O=new iD(I,A,E,e),C=function(t){var r,i;t&&(e.pageActions=rB(rB({},e.pageActions),t),I=iF(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),A=iL(null!=(i=e.pageActions.triggers)?i:[]),O.update(I,A,e))};return{name:w,type:"enrichment",setup:function(t,r){return rV(void 0,void 0,void 0,function(){var i,n,s,o,a,l,u,c,d,h,p,v,m,I,A,R,F,L,M,D,N;return rz(this,function($){if("u"<typeof document)return[2];if(i=!1,n={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){C(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),s=iu(e,e.cssSelectorAllowlist),o=iu(e,e.actionClickAllowlist),U=(j={allObservables:a=T(),amplitude:r,shouldTrackEvent:s,evaluateTriggers:O.evaluate.bind(O)}).amplitude,q=j.allObservables,B=j.shouldTrackEvent,V=j.evaluateTriggers,l=q.clickObservable.filter(iv).filter(function(e){return B("click",e.closestTrackedAncestor)}).map(function(e){return V(e)}).subscribe(function(e){null==U||U.track(r5,e.targetElementProperties)}),S.push(l),H=(z={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,rG(rG([],rW(e),!1),[g],!1))},amplitude:r,shouldTrackEvent:s,evaluateTriggers:O.evaluate.bind(O)}).amplitude,W=z.allObservables,G=z.getEventProperties,J=z.shouldTrackEvent,K=z.evaluateTriggers,u=W.changeObservable.filter(iv).filter(function(e){return J("change",e.closestTrackedAncestor)}).map(function(e){return K(e)}).subscribe(function(e){null==H||H.track("[Amplitude] Element Changed",G("change",e.closestTrackedAncestor))}),S.push(u),Q=(Y={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,rG(rG([],rW(e),!1),[g],!1))},amplitude:r,shouldTrackEvent:s,shouldTrackActionClick:o}).amplitude,X=Y.allObservables,Z=Y.options,ee=Y.getEventProperties,et=Y.shouldTrackEvent,er=Y.shouldTrackActionClick,ei=X.clickObservable,en=X.mutationObservable,es=X.navigateObservable,eo=ei.filter(function(e){return!et("click",e.closestTrackedAncestor)}).map(function(e){var t=ip(e.event.target,Z.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=ee(e.type,e.closestTrackedAncestor)),e}).filter(iv).filter(function(e){return er("click",e.closestTrackedAncestor)}),ea=es?r2(en,es):en,el=r2(eo,ea),eu=null,ec=null,(c=r1(el,function(e){if(eu&&(clearTimeout(eu),eu=null),"click"===e.type)ec=e,eu=setTimeout(function(){eu=null,ec=null},500);else if(ec){var t=ec;return ec=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==Q||Q.track(r5,ee("click",e.closestTrackedAncestor)))}))&&S.push(c),(ed={allObservables:a,amplitude:r}).amplitude,eh=ed.allObservables.scrollObservable,ep={maxX:0,maxY:0},ef=eh.subscribe(function(){var e,t,r,i,n=eI(),s=Math.floor(null!=(t=null!=(e=null==n?void 0:n.scrollX)?e:null==n?void 0:n.pageXOffset)?t:0),o=Math.floor(null!=(i=null!=(r=null==n?void 0:n.scrollY)?r:null==n?void 0:n.pageYOffset)?i:0);ep.maxX=Math.max(ep.maxX,s),ep.maxY=Math.max(ep.maxY,o)}),d={unsubscribe:function(){ef.unsubscribe()},getState:function(){return ep},reset:function(){ep.maxX=0,ep.maxY=0}},S.push(d),h={},p=eI(),v=function(e){e&&i||(setTimeout(function(){i=!1},100),i=!0,function(e){var t,r,i,n,s,o,a=e.amplitude,l=e.scrollTracker,u=e.currentElementExposed,c=e.elementExposedForPage,d=e.exposureTracker,h=e.isPageEnd,p=e.lastScroll,f=l.getState(),v=eI(),g=null!=(r=null==v?void 0:v.innerWidth)?r:0,m=null!=(i=null==v?void 0:v.innerHe
2ight)?i:0,_=((t={})[r7]=is(null!=(o=null==(s=null==(n=null==v?void 0:v.location)?void 0:n.href)?void 0:s.split("?")[0])?o:""),t["[Amplitude] Max Page X"]=f.maxX+g,t["[Amplitude] Max Page Y"]=f.maxY+m,t[r9]=m,t[ie]=g,t["[Amplitude] Element Exposed"]=Array.from(u),t),y=ih();if(y&&(_[it]=y),0===u.size&&f.maxX===p.maxX&&f.maxY===p.maxY){h&&(l.reset(),c.clear(),null==d||d.reset());return}null==a||a.track("[Amplitude] Viewport Content Updated",_),p.maxX=f.maxX,p.maxY=f.maxY,u.clear(),h&&(l.reset(),c.clear(),null==d||d.reset())}({amplitude:r,scrollTracker:d,currentElementExposed:P,elementExposedForPage:x,exposureTracker:h.exposure,isPageEnd:e,lastScroll:n}))},m=function(e){!x.has(e)&&(x.add(e),P.add(e),JSON.stringify(Array.from(P)).length>=18e3&&v(!1))},y&&(eg=(ev={allObservables:a,onExposure:m,dataExtractor:E,exposureDuration:b}).allObservables,em=ev.onExposure,e_=ev.dataExtractor,eb=void 0===(ey=ev.exposureDuration)?150:ey,ew=new Map,eS=new Map,eE=eg.exposureObservable.subscribe(function(e){var t=e.target;if(e.isIntersecting){if(!ew.get(t)){var r=setTimeout(function(){ew.set(t,!0),em(e_.getElementPath(t)),eS.set(t,null)},eb);eS.set(t,r)}}else if(!e.isIntersecting&&e.intersectionRatio<1){var r=eS.get(t);r&&(clearTimeout(r),eS.set(t,null))}}),h.exposure={unsubscribe:function(){eE.unsubscribe()},reset:function(){eS.forEach(function(e){e&&clearTimeout(e)}),eS.clear(),ew.clear()}},h.exposure&&S.push(h.exposure),I=function(){v(!0)},null==p||p.addEventListener("beforeunload",I),f=function(){null==p||p.removeEventListener("beforeunload",I)},S.push({unsubscribe:function(){return f()}}),(A=a[k.NavigateObservable])?S.push(A.subscribe(function(){v(!0)})):p&&(R=function(){v(!0)},p.addEventListener("popstate",R),F=p.history.pushState,p.history&&F&&(p.history.pushState=new Proxy(F,{apply:function(e,t,r){var i=rW(r,3),n=i[0],s=i[1],o=i[2];e.apply(t,[n,s,o]),v(!0)}})),S.push({unsubscribe:function(){p.removeEventListener("popstate",R),p.history&&F&&(p.history.pushState=F)}}))),null==(N=null==t?void 0:t.loggerProvider)||N.log("".concat(w," has been successfully added.")),window.opener&&_.enabled){var j,U,q,B,V,z,H,W,G,J,K,Y,Q,X,Z,ee,et,er,ei,en,es,eo,ea,el,eu,ec,ed,eh,ep,ef,ev,eg,em,e_,ey,eb,ew,eS,eE;if(L=e.cssSelectorAllowlist,M=e.actionClickAllowlist,function(e,t){if(!0!==e[ig]){e[ig]=!0;var r=t.dataExtractor,i=t.isElementSelectable,n=t.cssSelectorAllowlist,s=t.actionClickAllowlist,o=null,a=function(t){e.notify({action:"element-selected",data:t})},l=function(t,r){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:r}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:r})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var u;o=null==(u=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:u.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:l,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:n,actionClickAllowlist:s,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:r4}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null==(e=null==o?void 0:o.close)||e.call(o)})}}(D=function(){var e=eI(),t=null==e?void 0:e[rQ];if("object"==typeof t&&null!==t&&rY in t&&!0===t[rY])return t;var r=new rX(void 0);return e&&(e[rQ]=r),r}(),{dataExtractor:E,isElementSelectable:iu(e,rG(rG([],rW(L),!1),rW(M),!1)),cssSelectorAllowlist:L,actionClickAllowlist:M}),!0!==D[rZ]){D[rZ]=!0;var ek="https://cdn.amplitude.com/libs/background-capture-1.0.1.js.gz",ex=null,eP=function(e,t){var r,i;"background-capture-complete"===e&&(null==(i=null==(r=D.logger)?void 0:r.debug)||i.call(r,"Background capture complete"),D.notify({action:"background-capture-complete",data:t}))};D.registerActionHandler("initialize-background-capture",function(){null==(t=null==(e=D.logger)?void 0:e.debug)||t.call(e,"Initializing background capture (external script)");var e,t,r=new URL(ek,D.endpoint).toString();D.loadScriptOnce(r).then(function(){var e,t,r;null==(t=null==(e=D.logger)?void 0:e.debug)||t.call(e,"Backgroun
2d capture script loaded (external)"),ex=null==(r=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:r.call(window,{messenger:D,onBackgroundCapture:eP}),D.notify({action:"background-capture-loaded"})}).catch(function(){var e;null==(e=D.logger)||e.warn("Failed to initialize background capture")})}),D.registerActionHandler("close-background-capture",function(){var e;null==(e=null==ex?void 0:ex.close)||e.call(ex),ex=null})}D.setup(rB({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:rK[t.serverZone]}))}return[2]})})},execute:function(e){return rV(void 0,void 0,void 0,function(){return rz(this,function(t){return[2,e]})})},teardown:function(){return rV(void 0,void 0,void 0,function(){var e,t,r,i;return rz(this,function(n){try{for(t=(e=rH(S)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},im=r0,iW=D(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],M(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),iG=["*"],iJ=["mutation","navigate"];function iK(e,t){var r,i,n,s,o=t.event,a=o.pageX,l=o.pageY;e.yMin=Math.min(null!=(r=e.yMin)?r:l,l),e.yMax=Math.max(null!=(i=e.yMax)?i:l,l),e.xMin=Math.min(null!=(n=e.xMin)?n:a,a),e.xMax=Math.max(null!=(s=e.xMax)?s:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function iY(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:rB({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}var im=r0;(u=x||(x={})).INCREASING="increasing",u.DECREASING="decreasing",(c=P||(P={})).X="x",c.Y="y";var iQ=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new im.default(function(e){var r=null,i=null,n=null;return t.subscribe(function(t){var s={x:t.clientX,y:t.clientY};if(null===r){r=s;return}s.x>r.x?(i===x.DECREASING&&e.next(P.X),i=x.INCREASING):s.x<r.x&&(i===x.INCREASING&&e.next(P.X),i=x.DECREASING),s.y>r.y?(n===x.DECREASING&&e.next(P.Y),n=x.INCREASING):s.y<r.y&&(n===x.INCREASING&&e.next(P.Y),n=x.DECREASING),r=s})})};function iX(e){var t=e.changes,r=e.changesThreshold,i=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<i}function iZ(e){e.changes=[],e.startTime=void 0}function i0(e){for(var t=e.changes,r=e.thresholdMs,i=0,n=t[t.length-1];i<t.length&&!(n-t[i]<r);i++);0!==i&&(e.startTime=t[i],e.changes.splice(0,i))}var i1=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,i=void 0===r?20:r,n=e.thresholdMs,s=void 0===n?2e3:n;return new im.default(function(e){var r={changes:[],changesThreshold:i,thresholdMs:s},n={changes:[],changesThreshold:i,thresholdMs:s},o=void 0,a=null;function l(){void 0!==o&&(e.next(o),o=void 0,null!==a&&clearTimeout(a),iZ(r),iZ(n))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===P.X?r:n,i=+Date.now(),t.startTime=t.startTime||i,u=t.changes,c=t.changesThreshold,u.push(i),u.length>c&&u.shift();var t,i,u,c,d=function(e,t){var r=void 0;if(iX(e)&&(r=e.startTime),iX(t)){var i=t.startTime;i&&(!r||i<r)&&(r=i)}return r}(r,n);return d?(o=o||d,a=setTimeout(function(){l(),a=null},s)):l(),i0(r),i0(n),function(){null!==a&&(clearTimeout(a),a=null)}})})},i2=function(e){var t=e.amplitude,r=e.options,i=e.allObservables,n=e.directionChanges,s=e.thresholdMs;return i1({mouseDirectionChangeObservable:iQ({allWindowObservables:i}),directionChanges:void 0===n?20:n,thresholdMs:void 0===s?2e3:s}).subscribe(function(e){il(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function i3(e,t,r,i){if(!i)return[];var n=e[t];return"object"==typeof n&&null!==n&&"cssSelectorAllowlist"in n&&Array.isArray(n.cssSelectorAllowlist)?n.cssSelectorAllowlist:r}var i4=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-frustration-browser",i=[],n=!1!==e.errorClicks;e.errorClicks||(n=!1);var s=!1!==e.deadClicks&&null!==e.deadClicks,o=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var l=i3(e,"rageClicks",iG,o),u=i3(e,"deadClicks",iW,s),c=i3(e,"errorClicks",iW,n),d=null!=(t=e.dataAttributePrefix)?t:q,h=new iz(e),p=rG([],rW(new Set(rG(rG(rG([],rW(l),!1),rW(u),!1),rW(c),!1))),!1),f=function(){var e,t,r=r3(iT("pointerdown").map(function(e){return h.addAdditionalEventProperties(e,"click",p,d,!0)})),i=r3(iI().map(function(e){return h.addTypeAndTimestamp(e,"error")})),n=r3(iP().map(function(e){return h.addAdditionalEventProperties(e,"mutation",p,d)}));window.navigation&&(t=r3(new im.default(function(e){var t=function(t){e.next(rB(rB({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return h.addAdditionalEventProperties(e,"navigate",p,d)})));var s=r3(new im.default(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var r=void 0,i=void 0;try{if(r=t.selectionStart,i=t.selectionEnd,r===i)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),o=r3(new im.default(function(e){var t=function(t){e.next(t)},r={capture:!0};return ix.document.addEventListener("mousemove",t,r),function(){ix.document.removeEventListener("mousemove",t,r)}}));return(e={})[k.ClickObservable]=r,e[k.MutationObservable]=n,e[k.NavigateObservable]=t,e[k.BrowserErrorObservable]=i,e[k.SelectionObservable]=s,e[k.MouseMoveObservable]=o,e};return{name:r,type:"enrichment",setup:function(t,p){return rV(void 0,void 0,void 0,function(){var v,g,m,_,y,b,w,S;return rz(this,function(k){var x,P,T,I,A,O,C,R,F,L,M,D,N,$,j,U,q,B,V,z,H,W;return"u"<typeof document?[2]:(v=f(),o&&(g=function(e){var t=this,r=e.amplitude,i=e.allObservables,n=e.shouldTrackRageClick,s=i.clickObservable,o=i.selectionObservable,a=[],l={},u=null;function c(e){a=[],l={},e&&(iK(l,e),a.push(e))}var d=r1(s.filter(function(e){return n("click",e.closestTrackedAncestor)}),function(e){return rV(t,void 0,void 0,function(){var t;return rz(this,function(r){var i,n,s,o;return(iK(l,e),t=null,0===a.length||(i=a).length>0&&i[i.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(s=Math.max(0,(n=a).length-4+1),o=n[s],e.t
2imestamp-o.timestamp>=1e3)||l.isOutOfBounds)?(u&&(t=iY(a)),c(e)):a.push(e),(u&&(clearTimeout(u.timerId),u.resolve(t),u=null),a.length>=4)?[2,new Promise(function(e){u={resolve:e,timerId:setTimeout(function(){e(iY(a))},1e3)}})]:[2,null]})})}),h=null==o?void 0:o.subscribe(function(){c()}),p=d.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){p.unsubscribe(),null==h||h.unsubscribe()}}}({allObservables:v,amplitude:p,shouldTrackRageClick:iu(e,l)}),i.push(g)),s&&(P=(x={amplitude:p,allObservables:v,getEventProperties:function(e,t){return h.getEventProperties(e,t,d)},shouldTrackDeadClick:iu(e,u)}).amplitude,T=x.allObservables,I=x.getEventProperties,A=x.shouldTrackDeadClick,O=T.clickObservable,C=T.mutationObservable,R=T.navigateObservable,F=O.filter(function(e){return iv(e)&&A("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===E.LEFT_OR_TOUCH_CONTACT}),L=R?r2(C,R):C,M=r2(F,L),D=null,m=r1(M,function(e){if(D&&iJ.includes(e.type))clearTimeout(D),D=null;else if("click"===e.type)return D?Promise.resolve(null):new Promise(function(t){D=setTimeout(function(){t(e),D=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};P.track("[Amplitude] Dead Click",rB(rB({},I("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),i.push(m)),n&&($=(N={amplitude:p,allObservables:v,shouldTrackErrorClick:iu(e,c)}).amplitude,j=N.allObservables,U=N.shouldTrackErrorClick,q=j.clickObservable,B=j.browserErrorObservable,V=q.filter(function(e){return iv(e)&&U("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===E.LEFT_OR_TOUCH_CONTACT}),z=null,H=null,W=function(){null!==z&&(clearTimeout(z),z=null),H=null},_=r2(V,B).subscribe(function(e){var t;if("click"===e.type){W(),H=e,z=setTimeout(W,2e3);return}"error"===e.type&&H&&($.track("[Amplitude] Error Click",rB(((t={})["[Amplitude] Kind"]=e.event.kind,t["[Amplitude] Message"]=e.event.message,t["[Amplitude] Stack"]=e.event.stack,t["[Amplitude] Filename"]=e.event.filename,t["[Amplitude] Line Number"]=e.event.lineNumber,t["[Amplitude] Column Number"]=e.event.columnNumber,t),H.targetElementProperties)),W())}),i.push(_)),a&&(y=void 0,b=void 0,"object"==typeof e.thrashedCursor&&(y=e.thrashedCursor.directionChanges,b=e.thrashedCursor.threshold,y&&y<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(y," is below the minimum of ").concat(5,", setting to ").concat(5)),y=5),b&&b>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(b," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),b=4e3)),w=i2({amplitude:p,options:e,allObservables:v,directionChanges:y,thresholdMs:b}),i.push(w)),null==(S=null==t?void 0:t.loggerProvider)||S.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return rV(void 0,void 0,void 0,function(){return rz(this,function(t){return[2,e]})})},teardown:function(){return rV(void 0,void 0,void 0,function(){var e,t,r,n;return rz(this,function(s){try{for(t=(e=rH(i)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(r)throw r.error}}return[2]})})}}};function i5(e,t){var r=e.startTime+e.duration;return t.filter(function(t){return t.startTime<r&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}var i6=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",r=[],i=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(n,s){return rV(void 0,void 0,void 0,function(){var o,a,l;return rz(this,function(u){return"u"<typeof document||(i&&(o=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(o=e.mainThreadBlock.durationThreshold),a=function(e){var t=e.amplitude,r=e.options,i=e.durationThreshold,n=void 0===i?100:i,s=function(){if("u"<typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!s)return{unsubscribe:function(){}};var o=[],a=new PerformanceObserver(function(e){var t,r,i=performance.now();try{for(var n=rH(e.getEntries()),s=n.next();!s.done;s=n.next()){var a=s.value;o.push(a)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}for(var l=i-1e4;o.length>0&&o[0].startTime<l;)o.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var i,a;try{for(var l=rH(e.getEntries()),u=l.next();!u.done;u=l.next()){var c=u.value;if(!il(r))return;if(!(c.duration<n)){var d="long-animation-frame"===s?function(e,t){var r,i=i5(e,t),n=null!=(r=e.scripts)?r:[],s=n.map(function(e){return e.sourceURL}
2).filter(Boolean),o=n.map(function(e){return e.sourceFunctionName}).filter(Boolean),a=n.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),l=n.map(function(e){return e.invokerType}).filter(Boolean),u=n.map(function(e){return e.invoker}).filter(Boolean);return rB(rB(rB(rB(rB(rB(rB({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},i.length>0&&{"[Amplitude] Main Thread Block Measures":i}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":n.length}),s.length>0&&{"[Amplitude] Main Thread Block Script URLs":s}),o.length>0&&{"[Amplitude] Main Thread Block Script Functions":o}),a.length>0&&{"[Amplitude] Main Thread Block Script Positions":a}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),u.length>0&&{"[Amplitude] Main Thread Block Invokers":u})}(c,o):function(e,t){var r,i=i5(e,t),n=null!=(r=e.attribution)?r:[];return rB(rB({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},i.length>0&&{"[Amplitude] Main Thread Block Measures":i}),n.length>0&&{"[Amplitude] Main Thread Block Attribution":n.map(function(e){return e.name})})}(c,o);t.track("[Amplitude] Main Thread Block",d)}}}catch(e){i={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}});try{l.observe({entryTypes:[s]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}({amplitude:s,options:e,durationThreshold:o}),r.push(a)),null==(l=null==n?void 0:n.loggerProvider)||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return rV(void 0,void 0,void 0,function(){return rz(this,function(t){return[2,e]})})},teardown:function(){return rV(void 0,void 0,void 0,function(){var e,t,i,n;return rz(this,function(s){try{for(t=(e=rH(r)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){i={error:e}}finally{try{t&&!t.done&&(n=e.return)&&n.call(e)}finally{if(i)throw i.error}}return[2]})})}}};function i8(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function i7(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function i9(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function ne(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function nt(e,t,r){e&&function e(t){var r,i,n=t.json,s=t.targetObject,o=t.allowlist,a=t.excludelist,l=t.ancestors,u=t.parentObject,c=t.targetKey;s||(s=n);var d=Object.keys(s);try{for(var h=L(d),p=h.next();!p.done;p=h.next()){var f,v=p.value,g=D(D([],M(l),!1),[v],!1);(f=s[v],"string"==typeof f||"number"==typeof f||"boolean"==typeof f||null==f)?(!ni(g,o)||ni(g,a))&&delete s[v]:e({json:n,targetObject:s[v],allowlist:o,excludelist:a,ancestors:g,parentObject:s,targetKey:v})}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}0===Object.keys(s).length&&u&&c&&delete u[c]}({json:e,allowlist:t.map(nr),excludelist:r.map(nr),ancestors:[]})}function nr(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function ni(e,t){return t.some(function(t){return function e(t,r,i,n){if(void 0===i&&(i=0),void 0===n&&(n=0),n===r.length)return i===t.length;if(i===t.length){for(;n<r.length&&"**"===r[n];)n++;return n===r.length}var s=r[n];if("**"===s){if(n+1===r.length)return!0;for(var o=i;o<=t.length;o++)if(e(t,r,o,n+1))return!0;return!1}return("*"===s||s===t[i])&&e(t,r,i+1,n+1)}(e,t)})}"function"==typeof SuppressedError&&SuppressedError;var nn=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,r,i=this.request.headers,n={};if(Array.isArray(i))i.forEach(function(e){var t=M(e,2),r=t[0],i=t[1];n[r]=i});else if(i instanceof Headers)i.forEach(function(e,t){n[t]=e});else if("object"==typeof i&&null!==i)try{for(var s=L(Object.entries(i)),o=s.next();!o.done;o=s.next()){var a=M(o.value,2),l=a[0],u=a[1];n[l]=u}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return nd(n,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=eI();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=no(t,100),this._bodySize}}
2,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),R(this,void 0,void 0,function(){return F(this,function(r){return 0===e.length?[2,null]:[2,nu(this.body,e,t)]})})},e}(),ns=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),nd(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return no(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),R(this,void 0,void 0,function(){return F(this,function(r){return 0===e.length?[2,null]:[2,nu(this.body,e,t)]})})},e}();function no(e,t){var r,i,n,s,o=eI(),a=null==o?void 0:o.TextEncoder;if(a){if("string"==typeof e)s=e,n=new a().encode(s).length;else if(e instanceof Blob)n=(s=e).size;else if(e instanceof URLSearchParams)s=e,n=new a().encode(s.toString()).length;else if(ArrayBuffer.isView(e))n=(s=e).byteLength;else if(e instanceof ArrayBuffer)n=(s=e).byteLength;else if(e instanceof FormData){var l=0,u=0;try{for(var c=L(e.entries()),d=c.next();!d.done;d=c.next()){var h=M(d.value,2),p=h[0],f=h[1];if(l+=p.length,"string"==typeof f)l+=new a().encode(f).length;else{if(!(f instanceof Blob))return;l+=f.size}if(++u>=t)return}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}n=l}else if(e instanceof ReadableStream){s=e;return}return n}}var na=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var r=this.response.headers,i={};return null==(t=null==r?void 0:r.forEach)||t.call(r,function(e,t){i[t]=e}),nd(i,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,r=null==(t=null==(e=this.response.headers)?void 0:e.get)?void 0:t.call(e,"content-length"),i=r?parseInt(r,10):void 0;return this._bodySize=i,i},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return R(this,void 0,void 0,function(){return F(this,function(e){switch(e.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this.clonedResponse.text(),new Promise(function(e){return setTimeout(function(){return e(null)},500)})])];case 2:return[2,e.sent()];case 3:return e.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),R(this,void 0,void 0,function(){return F(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,nu(r.sent(),e,t)]}})})},e}(),nl=function(){function e(e,t,r,i){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=i}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){if(void 0===e&&(e=[]),!this.headersString)return{};var t,r,i={},n=this.headersString.split("\r\n");try{for(var s=L(n),o=s.next();!o.done;o=s.next()){var a=o.value,l=M(a.split(": "),2),u=l[0],c=l[1];u&&c&&(i[u]=c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return nd(i,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),R(this,void 0,void 0,function(){var r;return F(this,function(i){return 0===e.length?[2,null]:(r=this.getJson())?(nt(r,e,t),[2,r]):[2,null]})})},e}();function nu(e,t,r){if(!e)return null;try{var i=JSON.parse(e);return nt(i,t,r),i}catch(e){return null}}(d=T||(T={})).REDACT="redact",d.REMOVE="remove";var nc="[REDACTED]",nd=function(e,t){var r,i,n=t.allow,s=void 0===n?[]:n,o=t.strategy,a=void 0===o?T.REMOVE:o,l=D([],M(ek),!1),u={};try{for(var c=L(Object.keys(e)),d=c.next();!d.done;d=c.next()){var h=d.value;!function(t){var r=t.toLowerCase();l.find(function(e){return e.toLowerCase()===r})?a===T.REDACT&&(u[t]=nc):s.find(function(e){return e.toLowerCase()===r})?u[t]=e[t]:a===T.REDACT&&(u[t]=nc)}(h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return u},nh=function(){function e(e,t,r,i,n,s,o,a,l,u,c){void 0===o&&(o=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=i,this.url=n,this.requestWrapper=s,this.status=o,this.duration=a,this.responseWrapper=l,this.error=u,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,i;
2return Object.fromEntries(Object.entries({type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null==(e=this.requestWrapper)?void 0:e.headers(D([],M(eE),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers(D([],M(eE),!1)),responseBodySize:null==(i=this.responseWrapper)?void 0:i.bodySize}).filter(function(e){var t=M(e,2);return void 0!==(t[0],t[1])}))},e}(),np=function(e,t){void 0===t&&(t=eO()),this.callback=e,this.id=t};function nf(e){try{e()}catch(e){}}var nv=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=eI();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=eI();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,i,n,s,o,a,l,u,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var h=null==(n=null==(i=null==(r=this.globalScope)?void 0:r.XMLHttpRequest)?void 0:i.prototype)?void 0:n.open,p=null==(a=null==(o=null==(s=this.globalScope)?void 0:s.XMLHttpRequest)?void 0:o.prototype)?void 0:a.send,f=null==(c=null==(u=null==(l=this.globalScope)?void 0:l.XMLHttpRequest)?void 0:u.prototype)?void 0:c.setRequestHeader;h&&p&&f&&this.observeXhr(h,p,f);var v=null==(d=this.globalScope)?void 0:d.fetch;v&&this.observeFetch(v),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(r){try{r.callback(e)}catch(e){nf(function(){var r;null==(r=t.logger)||r.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,r,i,n,s,o){if(void 0!==s&&void 0!==o){var a,l,u,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(l=t.url,d=t.method):l=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),l)try{var h=new URL(l);l="".concat(h.protocol,"//").concat(h.host).concat(h.pathname).concat(h.search).concat(h.hash)}catch(e){}d=(null==r?void 0:r.method)||d,i&&(u=i.status),n&&(c={name:n.name||"UnknownError",message:n.message||"An unknown error occurred"},u=0);var p=Math.floor(performance.now()-o),f=Math.floor(s+p),v=new nh(e,d,s,s,l,r,u,p,i,c,f);this.triggerEventCallbacks(v)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(r,i){return R(t,void 0,void 0,function(){var t,n,s,o=this;return F(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){nf(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(r,i)];case 2:return n=a.sent(),[3,4];case 3:return s=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,i?new nn(i):void 0,n?new na(n):void 0,s,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){nf(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(n)return[2,n];throw s}})})})},e.createXhrJsonParser=function(e,t){return function(){var r;try{if("json"===e.responseType){if(null==(r=t.globalScope)?void 0:r.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(r){r instanceof Error&&"InvalidStateError"===r.name&&nf(function(){var r;return null==(r=t.logger)?void 0:r.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))})}return null}},e.prototype.observeXhr=function(t,r,i){if(this.globalScope&&t&&r){var n=this.globalScope.XMLHttpRequest.prototype,s=this;n.open=function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var n=M(r,2),o=n[0],a=n[1];try{this.$$AmplitudeAnalyticsEvent=C({method:o,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},s.getTimestamps())}catch(e){nf(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},n.send=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=this,o=e.createXhrJsonParser(this,s),a=t[0],l=n.$$AmplitudeAnalyticsEvent;return n.$$AmplitudeAnalyticsEvent&&n.addEventListener("loadend",function(){try{var e=n.getAllResponseHeaders(),t=n.getResponseHeader("content-length"),r=new nl(n.status,e,t?parseInt(t,10):void 0,o),i=n.$$AmplitudeAnalyticsEvent.headers,u=new ns(a,i);l.status=n.status,s.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,r,void 0,l.startTime,l.durationStart)}catch(e){nf(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(n,t)},n.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){nf(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}i.apply(this,[e,t])}}},e}()),ng="[Amplitude] Network Request",im=r0,nm="500-599";function n_(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function ny(e,t){var r,i,n=t.split(",");try{for(var s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);
2if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(n),o=s.next();!o.done;o=s.next()){var a=o.value,l=i9(a.split("-").map(Number),2),u=l[0],c=l[1];if(e===u&&void 0===c||e>=u&&e<=c)return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return!1}function nb(e){var t;if(e)try{var r=null==(t=eI())?void 0:t.location.href,i=new URL(e,r),n=i.searchParams.toString(),s=i.hash.replace("#",""),o=i.href,a=i.host;i.hash="",i.search="";var l=i.href;return{query:n,fragment:s,href:o,hrefWithoutQueryOrHash:l,host:a}}catch(e){return}}function nw(e){return"object"!=typeof e||null===e?e?ne([],i9(eE),!1):void 0:0!==e.length?e:void 0}function nS(e){var t,r,i;return!(null==(t=null==e?void 0:e.allowlist)?void 0:t.length)&&!(null==(r=null==e?void 0:e.blocklist)?void 0:r.length)&&!(null==(i=null==e?void 0:e.excludelist)?void 0:i.length)}(I||(I={})).NetworkObservable="networkObservable";var nE=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",i=function(){var e,r=new im.default(function(e){var r=new np(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return nv.subscribe(r,t),function(){nv.unsubscribe(r)}});return(e={})[I.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(n,s){return i8(void 0,void 0,void 0,function(){var o;return i7(this,function(a){var l,u,c,d,h;return"u"<typeof document?[2]:(o=i(),t=null==n?void 0:n.loggerProvider,u=(l={allObservables:o,networkTrackingOptions:e,amplitude:s,loggerProvider:t}).allObservables,c=l.networkTrackingOptions,d=l.amplitude,h=l.loggerProvider,A=u.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,i,n=nb(e.url);if(!n)return!1;var s=n.host;return!(!1!==t.ignoreAmplitudeRequests&&(n_(s,"*.amplitude.com")||n_(s,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return n_(s,e)})))&&(!!t.captureRules||void 0===e.status||!!ny(e.status,nm))&&(!t.captureRules||(ne([],i9(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,r,i,n){if((!e.hosts||e.hosts.find(function(e){return n_(t,e)}))&&(!i||!e.urls||ii(i,e.urls))&&(!n||!e.methods||e.methods.find(function(e){return n.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!ny(r,e.statusCodeRange||nm))&&!0}(t,s,e.status,e.url,e.method)){var r=nw(t.responseHeaders);if(e.responseWrapper&&r){var n=e.responseWrapper.headers(r);n&&(e.responseHeaders=n)}var o=nw(t.requestHeaders);if(e.requestWrapper&&o){var a=e.requestWrapper.headers(o);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!nS(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!nS(t.requestBody)){var l=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,l)}}return void 0!==i}),!!i))&&!(e.requestWrapper&&function(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if("string"!=typeof r)return!1;if(JSON.parse(r).events.find(function(e){return e.event_type===ng}))return!0}catch(e){}return!1}(s,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,r,i,n=e.event,s=nb(n.url);if(s){var o=null==(r=n.responseWrapper)?void 0:r.bodySize,a=null==(i=n.requestWrapper)?void 0:i.bodySize;!function(e,t,r,i){i8(this,void 0,void 0,function(){var n,s,o;return i7(this,function(a){switch(a.label){case 0:if(!(t.requestBodyJson||t.responseBodyJson))return[3,2];return[4,Promise.all([t.requestBodyJson,t.responseBodyJson])];case 1:if(s=(n=i9.apply(void 0,[a.sent(),2]))[0],o=n[1],s)try{e["[Amplitude] Request Body"]=JSON.stringify(s)}catch(e){null==i||i.debug("Failed to stringify request body",e)}if(o)try{e["[Amplitude] Response Body"]=JSON.stringify(o)}catch(e){null==i||i.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(ng,e),[2]}})})}(((t={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=s.query,t["[Amplitude] URL Fragment"]=s.fragment,t["[Amplitude] Request Method"]=n.method,t["[Amplitude] Status Code"]=n.status,t["[Amplitude] Start Time"]=n.startTime,t["[Amplitude] Completion Time"]=n.endTime,t["[Amplitude] Duration"]=n.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=o,t["[Amplitude] Request Type"]=n.type,t["[Amplitude] Request Headers"]=n.requestHeaders,t["[Amplitude] Response Headers"]=n.responseHeaders,t),n,d,h)}}),null==t||t.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return i8(void 0,void 0,void 0,function(){return i7(this,function(t){return[2,e]})})},teardown:function(){return i8(void 0,void 0,void 0,function(){return i7(this,function(e){return A.unsubscribe(),[2]})})}}};function nk(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function nx(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}"function"==typeof SuppressedError&&SuppressedError;let nP=-1,nT=e=>{addEventListener("pageshow",t=>{t.persisted&&(nP=t.timeStamp,e(t))},!0)},nI=(e,t,r,i)=>{let n,s;return o=>{let a;t.value>=0&&(o||i)&&((s=t.value-(n??0))||void 0===n)&&(n=t.value,t.delta=s,a=t.value,t.rating=a>r[1]?"poor":a>r[0]?"needs-improvement":"good",e(t))}},nA=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},nO=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},nC=()=>{let e=nO();return e?.activationStart??0},nR=(e,t=-1)=>{let r=nO(),i="navigate";return nP>=0?i="back-forward-cache":r&&(document.prerendering||nC()>0?i="prerender":document.wasDiscarded?i="restore":r.type&&(i=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(0x82f79cd8fff*Math.random())+1e12}`,navigationType:i}},nF=new WeakMap;function nL(e,t){return nF.get(e)||nF.set(e,new t),nF.get(e)}class nM{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}let nD=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let i=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return i.observe({type:e,buffered:!0,...r}),i}}catch{}},nN=e=>{let t=!1;return()=>{t||(e(),t=!0)}},n$=-1,nj=new Set,nU=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,nq=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of nj)e();isFinite(n$)||(n$="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",nq,!0))}},nB=()=>
2{if(n$<0){let e=nC();n$=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??nU(),addEventListener("visibilitychange",nq,!0),addEventListener("prerenderingchange",nq,!0),nT(()=>{setTimeout(()=>{n$=nU()})})}return{get firstHiddenTime(){return n$},onHidden(e){nj.add(e)}}},nV=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},nz=[1800,3e3],nH=(e,t={})=>{nV(()=>{let r=nB(),i,n=nR("FCP"),s=nD("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(s.disconnect(),t.startTime<r.firstHiddenTime&&(n.value=Math.max(t.startTime-nC(),0),n.entries.push(t),i(!0)))});s&&(i=nI(e,n,nz,t.reportAllChanges),nT(r=>{i=nI(e,n=nR("FCP"),nz,t.reportAllChanges),nA(()=>{n.value=performance.now()-r.timeStamp,i(!0)})}))})},nW=[.1,.25],nG=0,nJ=1/0,nK=0,nY=e=>{for(let t of e)t.interactionId&&(nJ=Math.min(nJ,t.interactionId),nG=(nK=Math.max(nK,t.interactionId))?(nK-nJ)/7+1:0)},nQ=()=>t?nG:performance.interactionCount??0,nX=0;class nZ{u=[];l=new Map;m;p;v(){nX=nQ(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((nQ()-nX)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.u.at(-1),r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(r)}}}let n0=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=nN(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},n1=[200,500];class n2{m;h(e){this.m?.(e)}}let n3=[2500,4e3],n4=[800,1800],n5=e=>{document.prerendering?nV(()=>n5(e)):"complete"!==document.readyState?addEventListener("load",()=>n5(e),!0):setTimeout(e)};function n6(e){var t,r;return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((r=(null==(t=e.entries[0])?void 0:t.startTime)||0,performance.timeOrigin+r)),navigationStart:Math.floor(performance.timeOrigin)}}var n8=function(){var e=null,r=eI(),i=null==r?void 0:r.document,n=null==r?void 0:r.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(r,s){return nk(void 0,void 0,void 0,function(){var o,a;return nx(this,function(l){return void 0===i||(o=is((null==n?void 0:n.href)||"",r.loggerProvider),a={"[Amplitude] Page Domain":(null==n?void 0:n.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":is((null==n?void 0:n.pathname)||"",r.loggerProvider),"[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":is(o.split("?")[0],r.loggerProvider)},((e,t={})=>{nV(()=>{let r=nB(),i,n=nR("LCP"),s=nL(t,n2),o=e=>{for(let o of(t.reportAllChanges||(e=e.slice(-1)),e))s.h(o),o.startTime<r.firstHiddenTime&&(n.value=Math.max(o.startTime-nC(),0),n.entries=[o],i())},a=nD("largest-contentful-paint",o);if(a){i=nI(e,n,n3,t.reportAllChanges);let r=nN(()=>{o(a.takeRecords()),a.disconnect(),i(!0)}),s=e=>{e.isTrusted&&(n0(r),removeEventListener(e.type,s,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,s,{capture:!0});nT(r=>{i=nI(e,n=nR("LCP"),n3,t.reportAllChanges),nA(()=>{n.value=performance.now()-r.timeStamp,i(!0)})})}})})(function(e){a["[Amplitude] LCP"]=n6(e)}),nH(function(e){a["[Amplitude] FCP"]=n6(e)}),((e,r={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let i=nB();nV(()=>{"interactionCount"in performance||t||(t=nD("event",nY,{type:"event",buffered:!0,durationThreshold:0}));let n,s=nR("INP"),o=nL(r,nZ),a=e=>{n0(()=>{for(let t of e)o.h(t);let t=o.L();t&&t.P!==s.value&&(s.value=t.P,s.entries=t.entries,n())})},l=nD("event",a,{durationThreshold:r.durationThreshold??40});n=nI(e,s,n1,r.reportAllChanges),l&&(l.observe({type:"first-input",buffered:!0}),i.onHidden(()=>{a(l.takeRecords()),n(!0)}),nT(()=>{o.v(),n=nI(e,s=nR("INP"),n1,r.reportAllChanges)}))})})(function(e){a["[Amplitude] INP"]=n6(e)}),((e,t={})=>{let r=nB();nH(nN(()=>{let i,n=nR("CLS",0),s=nL(t,nM),o=e=>{for(let t of e)s.h(t);s.i>n.value&&(n.value=s.i,n.entries=s.o,i())},a=nD("layout-shift",o);a&&(i=nI(e,n,nW,t.reportAllChanges),r.onHidden(()=>{o(a.takeRecords()),i(!0)}),nT(()=>{s.i=0,i=nI(e,n=nR("CLS",0),nW,t.reportAllChanges),nA(()=>i())}),setTimeout(i))}))})(function(e){a["[Amplitude] CLS"]=n6(e)}),((e,t={})=>{let r=nR("TTFB"),i=nI(e,r,n4,t.reportAllChanges);n5(()=>{let n=nO();n&&(r.value=Math.max(n.responseStart-nC(),0),r.entries=[n],i(!0),nT(()=>{(i=nI(e,r=nR("TTFB",0),n4,t.reportAllChanges))(!0)}))})})(function(e){a["[Amplitude] TTFB"]=n6(e)}),e=function(){"hidden"===i.visibilityState&&e&&(s.track("[Amplitude] Web Vitals",a),i.removeEventListener("visibilitychange",e),e=null)},i.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return nk(void 0,void 0,void 0,function(){return nx(this,function(t){return[2,e]})})},teardown:function(){return nk(void 0,void 0,void 0,function(){return nx(this,function(t){return e&&(null==i||i.removeEventListener("visibilitychange",e)),[2]})})}}},n7=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(
2Boolean).join("_")},n9=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=X({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:rs((null==(r=t.cookieOptions)?void 0:r.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=n7(t.apiKey,"MKTG"),this.webExpStorageKey=n7(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eS,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return ee(this,void 0,void 0,function(){var e,t;return et(this,function(r){switch(r.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=ei.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||eX(this.sessionTimeout,this.lastEventTime),!rr(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return ee(this,void 0,void 0,function(){var e;return et(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:if(!(e=t.sent()))return[3,3];return[4,this.storage.remove(this.webExpStorageKey)];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new rT().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,i=(t=this.currentCampaign,r=this.options,eR(Object.entries(X(X({},eS),t)).reduce(function(e,t){var i,n=ei(t,2),s=n[0],o=n[1];return(e.setOnce("initial_".concat(s),null!=(i=null!=o?o:r.initialEmptyValue)?i:"EMPTY"),o)?e.set(s,o):e.unset(s)},new ex)));return e&&(i.event_id=e),i},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),se=function(){return(se=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function st(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function sr(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}"function"==typeof SuppressedError&&SuppressedError;var si=new Set([g.IDENTIFY,g.GROUP_IDENTIFY]),sn=function(e){void 0===e&&(e={});var t,r,i,n,s,o,a,l=null!=(t=e.fallbackAttributionEvent)&&t,u=eI(),c={},d=!1,h=!1,p=function(){return st(void 0,void 0,void 0,function(){return sr(this,function(e){switch(e.label){case 0:return[4,new rT().parse()];case 1:return c=rI(e.sent()),l&&(null==i||i.log("Tracking attribution fallback event."),null==r||r.track("[Amplitude] Attribution",c)),[2]}})})},f=function(){p()},v=function(e){return new Proxy(e,{apply:function(e,t,r){Reflect.apply(e,t,r),d&&f()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return st(void 0,void 0,void 0,function(){return sr(this,function(l){switch(l.label){case 0:return r=t,i=e.loggerProvider,d=!0,i.log("Installing event property attribution tracking."),[4,p()];case 1:if(l.sent(),!u)return[2];if(u.addEventListener("popstate",f),!h){if(n=Reflect.get(u.history,"pushState"),s=Reflect.get(u.history,"replaceState"),!n||!s)return[2];o=v(n),u.history.pushState=o,a=v(s),u.history.replaceState=a,h=!0}return[2]}})})},execute:function(e){return st(void 0,void 0,void 0,function(){return sr(this,function(t){return si.has(e.event_type)||(e.event_properties=se(se({},c),e.event_properties)),[2,e]})})},teardown:function(){return st(void 0,void 0,void 0,function(){var e,t;return sr(this,function(r){return u&&(u.removeEventListener("popstate",f),e=Reflect.get(u.history,"pushState"),t=Reflect.get(u.history,"replaceState"),h&&e===o&&n&&(u.history.pushState=n),h&&t===a&&s&&(u.history.replaceState=s)),d=!1,h=!1,n=void 0,s=void 0,o=void 0,a=void 0,c={},[2]})})}}},ss=function(){return(ss=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function so(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function sa(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function sl(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}"function"==typeof SuppressedError&&SuppressedError;var su="AMP_CURRENT_PAGE",sc="AMP_PREVIOUS_PAGE",sd="AMP_URL_INFO";(h=O||(O={})).Direct="direct",h.Internal="internal",h.External="external";var sh=new Set([g.IDENTIFY,g.GROUP_IDENTIFY,g.REVENUE]),sp=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,i=eI(),n=void 0,s=!1,o=void 0,a=!1,l=!1,u=function(e){var t;try{var r=is(e,o);
2t=new URL(r).hostname}catch(e){null==o||o.error("Could not parse URL: ",e)}return t},c=function(e){var t="u">typeof location&&location.hostname||"",i=e?u(e):void 0;if(!i)return O.Direct;var n=r.some(function(e){return -1!==t.indexOf(e)}),s=r.some(function(e){return -1!==i.indexOf(e)});return t===i||s&&n?O.Internal:O.External},d=function(){return so(void 0,void 0,void 0,function(){var e,t,r,i,o;return sa(this,function(a){switch(a.label){case 0:if(!(n&&s))return[3,3];return[4,n.get(sd)];case 1:return e=a.sent(),t=is("u">typeof location&&location.href||""),r=(null==e?void 0:e[su])||"",i=void 0,i=t===r?(null==e?void 0:e[sc])||"":r||document.referrer||"",[4,n.set(sd,((o={})[su]=t,o[sc]=i,o))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},h=function(){d()};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return so(void 0,void 0,void 0,function(){var t,r,c,p,f,v,g,m;return sa(this,function(_){switch(_.label){case 0:if((o=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),l=!0,!i)return[3,7];try{n=new tj(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}return[4,null==n?void 0:n.isEnabled()];case 1:if(s=null!=(m=_.sent())&&m,!(n&&s))return[3,6];return r=(t="u">typeof document&&document.referrer||"")?u(t):void 0,c="u">typeof location&&location.hostname||"",p=is("u">typeof location&&location.href||""),[4,n.get(sd)];case 2:if(v=(null==(f=_.sent())?void 0:f[su])||"",!(r&&r!==c&&v!==p))return[3,4];return[4,n.set(sd,((g={})[su]=p,g[sc]=t,g))];case 3:return _.sent(),[3,6];case 4:return[4,d()];case 5:_.sent(),_.label=6;case 6:i.addEventListener("popstate",h),a||(i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var i=sl(r,3),n=i[0],s=i[1],o=i[2];e.apply(t,[n,s,o]),l&&h()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(e,t,r){var i=sl(r,3),n=i[0],s=i[1],o=i[2];e.apply(t,[n,s,o]),l&&h()}}),a=!0),_.label=7;case 7:return[2]}})})},execute:function(e){return so(void 0,void 0,void 0,function(){var t,r,i;return sa(this,function(o){switch(o.label){case 0:if(t=is("u">typeof location&&location.href||""),!(n&&s))return[3,2];return[4,n.get(sd)];case 1:if(i=(null==(r=o.sent())?void 0:r[sc])||"",sh.has(e.event_type))return[2,e];e.event_properties=ss(ss({},e.event_properties||{}),{"[Amplitude] Page Domain":sf(e,"[Amplitude] Page Domain","u">typeof location&&location.hostname||""),"[Amplitude] Page Location":sf(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":sf(e,"[Amplitude] Page Path","u">typeof location&&is(location.pathname)||""),"[Amplitude] Page Title":sf(e,"[Amplitude] Page Title",rP(rx)),"[Amplitude] Page URL":sf(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":i,"[Amplitude] Previous Page Type":c(i)}),o.label=2;case 2:return[2,e]}})})},teardown:function(){return so(void 0,void 0,void 0,function(){return sa(this,function(e){switch(e.label){case 0:if(i&&(i.removeEventListener("popstate",h),l=!1),!(n&&s))return[3,2];return[4,n.set(sd,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function sf(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}function sv(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((i=i.apply(e,t||[])).next())})}function sg(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){var u=[a,l];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&u[0]?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}"function"==typeof SuppressedError&&SuppressedError;var sm=function(){var e,t,r;function i(t){if(t)try{var r=Function("return "+t)();if("function"==typeof r)return r;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}return{name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(n,s){return sv(void 0,void 0,void 0,function(){var s,o;return sg(this,function(a){return null==(e=n.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(o=n.remoteConfig)?void 0:o.fetchRemoteConfig)&&(n.remoteConfigClient?(s=n.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?i(e.body||""):i("")}),t=function(){var e;return null==(e=n.remoteConfigClient)?void 0:e.unsubscribe(s)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return sv(void 0,void 0,void 0,function(){var i;return sg(this,function(n){if(r)try{return[2,null!=(i=r(t))?i:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return sv(void 0,void 0,void 0,function(){return sg(this,function(e){return t&&t(),[2]})})}}},s_="userProperty",sy="eventProperty",sb=function(e){return e===s_||e===sy},sw=function(e){var t=en([],ei(new Set((Array.isArray(e)?e:[e]).filter(sb))),!1);return t.length>0?t:[s_]},sS=function(e,t){return sw(e.trackingMethod).includes(t)},sE=function(e){return sS(e,s_)},sk=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return Q(t,e),t.prototype.init=function(e,t,r){var i,n;return void 0===e&&(e=""),arguments.length>2?(i=t,n=r):"string"==typeof t?(i=t,n=void 0):(i=null==t?void 0:t.userId,n=t),eM(this._init(X(X({},n),{userId:i,apiKey:e})))},t.prototype._init=function(t){var r,i,n,s,o,a,l,u;return ee(this,void 0,void 0,function(){var c,d,h,p,f,v,g,m,y,b,w,S,E,k,x=this;return et(this,function(P){var T,I,A,O,C,R,F,L,M;switch(P.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=rp(t),d=null!=(r=t.loggerProvider)?r:new ej,t.loggerProvider||d.enable(null!=(i=t.logLevel)?i:_.Warn),h=null!=(n=t.serverZone)?n:"US",f=this._diagnosticsSampleRate,v=null==(s=t.enableDiagnostics)||s,!c)return[3,2];return p=new e3(t.apiKey,d,h,null==(o=t.remoteConfig)?void 0:o.serverUrl),[4,new Promise(function(e){null==p||p.subscribe("configs.diagnostics.browserSDK","all",function(t,r,i){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:i},null,2)),t){var n=t.sampleRate;"number"!=typeof n||isNaN(n)||(f=n);var s=t.enabled;"boolean"==typeof s&&(v=s)}e()})})];case 1:P.sent(),P.label=2;case 2:return(g=new tl(t.apiKey,d,h,{enabled:v,sampleRate:f})).setTag("library","".concat(tA,"/").concat(tI)),"u">typeof navigator&&g.setTag("user_agent",navigator.userAgent),[4,(T=t.apiKey,I=t,A=this,O=g,C={loggerProvider:d,serverZone:h,enableDiagnostics:v,diagnosticsSampleRate:f},void 0===I&&(I={}),ee(void 0,void 0,void 0,function(){var e,t,r,i,n,s,o,a,l,u,c,d,h,p,f,v,g,m,_,y,b,w,S,E,k,x,P,R,F,L,M,D,N,$,j,U,q,B,V,z,H,W,G,J,K,Y,Q,Z,er,en,es;return et(this,function(eo){var ea,el,eu,ec;switch(eo.label){case 0:if(e=I.identityStorage||re,t="",!(e===re&&!(null==(w=I.cookieOptions)?void 0:w.domain)&&(null==(S=I.cookieOptions)?void 0:S.domain)!==""))return[3,2];return[4,(ea=void 0,el=O,ee(void 0,void 0,void 0,function(){var e,t,r,i,n,s,o;return et(this,function(a){switch(a.label){case 0:return[4,new tF(void 0,{diagnosticsClient:el}).isEnabled()];case 1:if(!a.sent()||!ea&&("u"<typeof location||!location.hostname)||1===(t=(e=null!=ea?ea:location.hostname).split(".")).length)return[2,""];for(r=[],i=1,rl.find(function(t){return e.endsWith(".".concat(t))})&&(i=2),n=t.length-i-1;n>=0;--n)r.push(t.slice(n).join("."));n=0,a.label=2;case 2:if(!(n<r.length))return[3,7];s=r[n],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,tF.isDomainWritable(s)];case 4:if(a.sent())return[2,"."+s];return[3,6];case 5:return o=a.sent(),el&&el.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:o instanceof Error?o.message:String(o)}),[3,6];case 6:return n++,[3,2];case 7:return el&&el.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=eo.sent(),eo.label=2;case 2:return r=X({domain:null!=(k=null==(E=I.cookieOptions)?void 0:E.domain)?k:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},I.cookieOptions),i={duplicateResolverFn:function(e){var t=tD(e);return!!t&&tN(JSON.parse(t).cookieDomain,r.domain)},diagnosticsClient:O},[4,(eu=n=rh(I.identityStorage,r,i),void 0===(ec=null==(P=null==(x=I.cookieOptions)?void 0:x.upgrade)||P)&&(ec=!0),ee(void 0,void 0,void 0,function(){var e,t,r,i,n,s,o,a,l;return et(this,function(u){switch(u.label){case 0:return e="".concat("amp","_").concat(T.substring(0,6)),[4,eu.getRaw(e)];case 1:if(!(t=u.sent()))return[2,{optOut:!1}];if(!ec)return[3,3];
2return[4,eu.remove(e)];case 2:u.sent(),u.label=3;case 3:return i=(r=ei(t.split("."),6))[0],n=r[1],s=r[2],o=r[3],a=r[4],l=r[5],[2,{deviceId:i,userId:tK(n),sessionId:tJ(o),lastEventId:tJ(l),lastEventTime:tJ(a),optOut:!!s}]}})}))];case 3:return s=eo.sent(),[4,n.get(t$(T))];case 4:return o=eo.sent(),u=!(l=(a=e0()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<l,c=null!=(D=null!=(M=null!=(L=null!=(R=I.deviceId)?R:u?null!=(F=a.ampDeviceId)?F:a.deviceId:void 0)?L:null==o?void 0:o.deviceId)?M:s.deviceId)?D:eO(),d=null!=(N=null==o?void 0:o.lastEventId)?N:s.lastEventId,h=null!=($=null==o?void 0:o.lastEventTime)?$:s.lastEventTime,p=null!=(U=null!=(j=I.optOut)?j:null==o?void 0:o.optOut)?U:s.optOut,f=null!=(q=null==o?void 0:o.sessionId)?q:s.sessionId,v=null==o?void 0:o.deferredSessionId,g=null!=(V=null!=(B=I.userId)?B:null==o?void 0:o.userId)?V:s.userId,A.previousSessionDeviceId=null!=(z=null==o?void 0:o.deviceId)?z:s.deviceId,A.previousSessionUserId=null!=(H=null==o?void 0:o.userId)?H:s.userId,m={ipAddress:null==(G=null==(W=I.trackingOptions)?void 0:W.ipAddress)||G,language:null==(K=null==(J=I.trackingOptions)?void 0:J.language)||K,platform:null==(Q=null==(Y=I.trackingOptions)?void 0:Y.platform)||Q},_=null==o?void 0:o.pageCounter,y=null==o?void 0:o.debugLogsEnabled,void 0!==I.autocapture&&(I.defaultTracking=I.autocapture),[4,(b=new rd(T,I.appVersion,n,r,I.defaultTracking,I.autocapture,c,I.flushIntervalMillis,I.flushMaxRetries,I.flushQueueSize,e,I.ingestionMetadata,I.instanceName,d,h,null!=(Z=null==C?void 0:C.loggerProvider)?Z:I.loggerProvider,I.logLevel,I.minIdLength,I.offline,p,I.partnerId,I.plan,I.serverUrl,null!=(er=null==C?void 0:C.serverZone)?er:I.serverZone,f,v,I.sessionTimeout,I.storageProvider,m,I.transport,I.useBatch,I.fetchRemoteConfig,g,_,y,I.networkTrackingOptions,I.identify,null!=(en=null==C?void 0:C.enableDiagnostics)?en:I.enableDiagnostics,null!=(es=null==C?void 0:C.diagnosticsSampleRate)?es:A._diagnosticsSampleRate,O,I.remoteConfig,t,I.enableRequestBodyCompression,I.customEnrichment)).storageProvider.isEnabled()];case 5:return eo.sent()||(b.loggerProvider.warn("Storage provider ".concat(b.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),b.storageProvider=new tC),[2,b]}})}))];case 3:if(m=P.sent(),!(c&&p))return[3,5];return[4,new Promise(function(e){null==p||p.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,i){m.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:i},null,2)),t&&function(e,t){if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var r,i,n,s,o,a,l,u,c,d,h,p,f=Object.keys(t);try{for(var v=er(f),g=v.next();!g.done;g=v.next()){var m=g.value;try{var _=t[m];"boolean"==typeof(null==_?void 0:_.enabled)&&(_.enabled?(delete _.enabled,0===Object.keys(_).length&&(t[m]=!0)):t[m]=!1),e(_)}catch(e){}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{if(null==(c=null==(u=null==(l=t.autocapture)?void 0:l.networkTracking)?void 0:u.captureRules)?void 0:c.length)try{for(var y=er(t.autocapture.networkTracking.captureRules),b=y.next();!b.done;b=y.next()){var w=b.value;try{for(var S=(o=void 0,er(["responseHeaders","requestHeaders"])),E=S.next();!E.done;E=S.next()){var k=E.value,x=null!=(d=w[k])?d:{},P=x.captureSafeHeaders,T=x.allowlist;if(P||T){if(void 0!==T&&!Array.isArray(T)){delete w[k];continue}w[k]=en(en([],ei(P?eE:[]),!1),ei(null!=T?T:[]),!1)}}}catch(e){o={error:e}}finally{try{E&&!E.done&&(a=S.return)&&a.call(S)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{b&&!b.done&&(s=y.return)&&s.call(y)}finally{if(n)throw n.error}}}catch(e){}var I=null==(h=t.autocapture)?void 0:h.frustrationInteractions;I&&(I.rageClick&&(I.rageClicks=I.rageClick,delete I.rageClick),I.deadClick&&(I.deadClicks=I.deadClick,delete I.deadClick));try{var A=null==(p=t.autocapture)?void 0:p.elementInteractions;if(A&&"object"==typeof A&&(!0===A.viewportContentUpdated&&(A.viewportContentUpdated={}),!1===A.viewportContentUpdated&&(A.viewportContentUpdated={enabled:!1}),void 0!==A.exposureDuration)){var O=A.viewportContentUpdated;void 0===O?A.viewportContentUpdated={exposureDuration:A.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=A.exposureDuration),delete A.exposureDuration}}catch(e){}}}(e);try{var r,i,n,s,o,a,l;if(t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var u=X({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(n=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:n.length)){u.elementInteractions=X({},e.autocapture.elementInteractions);var c=u.elementInteractions,d=null!=(s=c.pageUrlAllowlist)?s:[],h=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=rq(d,h,t),delete c.pageUrlAllowlistRegex}
2if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(o=e.autocapture.networkTracking.captureRules)?void 0:o.length)){u.networkTracking=X({},e.autocapture.networkTracking);var p=null!=(a=u.networkTracking.captureRules)?a:[];try{for(var f=er(p),v=f.next();!v.done;v=f.next()){var g=v.value;g.urls=rq(null!=(l=g.urls)?l:[],g.urlsRegex,t),delete g.urlsRegex}}catch(e){r={error:e}}finally{try{v&&!v.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=X({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},u)),"object"==typeof t.autocapture&&(t.autocapture=X(X({},t.autocapture),u))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=e.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,m),e()})})];case 4:P.sent(),P.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(P.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=p,y=th((R=this.config).defaultTracking)&&R.defaultTracking&&"object"==typeof R.defaultTracking&&R.defaultTracking.attribution&&"object"==typeof R.defaultTracking.attribution?X({},R.defaultTracking.attribution):{},!(th(this.config.defaultTracking)&&sE(y)))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return ee(x,void 0,void 0,function(){return et(this,function(t){switch(t.label){case 0:if(e)return[3,2];return this.webAttribution=new n9(y,this.config),[4,this.webAttribution.init()];case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new n9(y,this.config),[4,this.webAttribution.init()];case 7:P.sent(),P.label=8;case 8:if(S=!(!(w=(b=e0()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(E=this.config.deferredSessionId)||this.config.optOut||(E=Date.now()),this.setSessionId(null!=(u=null!=(l=null!=(a=t.sessionId)?a:S)?l:E)?u:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return ee(x,void 0,void 0,function(){return et(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(k=eK(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(rU()).promise];case 9:P.sent(),P.label=10;case 10:return[4,this.add(new eG({diagnosticsClient:g})).promise];case 11:return P.sent(),[4,this.add(new tO).promise];case 12:return P.sent(),[4,this.add(new eZ).promise];case 13:if(P.sent(),rj(this.config),!td(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(rN()).promise];case 14:P.sent(),P.label=15;case 15:if(!tp(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(rL()).promise];case 16:P.sent(),P.label=17;case 17:if(!tf(this.config.defaultTracking))return[3,20];if(this.config.optOut)return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rO(tE(this.config))).promise];case 18:return P.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return ee(x,void 0,void 0,function(){return et(this,function(t){switch(t.label){case 0:if(e)return[2];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(rO(tE(this.config))).promise];case 1:return t.sent(),[2]}})})}),P.label=20;case 20:if(!(th(this.config.defaultTracking)&&sS(y,sy)))return[3,22];return this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(sn(y)).promise];case 21:P.sent(),P.label=22;case 22:if(!tm(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(iH(tb(this.config),{diagnosticsClient:g})).promise];case 23:P.sent(),P.label=24;case 24:if(!t_(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(i4(tw(this.config))).promise];case 25:P.sent(),P.label=26;case 26:if(!tg(this.config.autocapture))return[3,28];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(nE(tS(this.config))).promise];case 27:P.sent(),P.label=28;case 28:if(!("boolean"==typeof(F=this.config.autocapture)?F:"object"==typeof F&&!0===F.webVitals))return[3,30];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(n8()).promise];case 29:P.sent(),P.label=30;case 30:if("object"!=typeof(L=this.config.autocapture)||!0!==L.performanceTracking&&"object"!=typeof L.performanceTracking)return[3,32];return this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(i6(ty(this.config))).promise];case 31:P.sent(),P.label=32;case 32:if(!td(this.config.autocapture,"pageUrlEnrichment"))return[3,34];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(sp()).promise];case 33:P.sent(),P.label=34;case 34:if(!("boolean"==typeof(M=this.config.customEnrichment)?M:"object"==typeof M&&null!==M&&!1!==M.enabled))return[3,36];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(sm()).promise];case 35:P.sent(),P.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return P.sent(),k.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,i=Z(t,["time"]);x.track(e.eventType,i,"number"==typeof r?{time:r}:void 0)}),[2]}})})},t.prototype.getUserId=function(){var e;return null==(e=this.config)?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),eY(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),eQ(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(eO()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null==(e=this.config)?void 0:e.deviceId,userId:null==(t=this.config)?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var t,r,i,n=new ex,s=null!=(i=e.userProperties)?i:{};try{for(var o=er(Object.entries(s)),a=o.next();!a.done;a=o.next()){var l=ei(a.value,2),u=l[0],c=l[1];n.set(u,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this.identify(n)}},t.prototype.getOptOut=function(){var e;return null==(e=this.config)?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,r=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),eM(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,eM(Promise.resolve());
2if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return eM(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var i=this.getSessionId();i!==e&&this.timeline.onSessionIdChanged(e);var n=this.config.lastEventTime,s=null!=(t=this.config.lastEventId)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,tv(this.config.defaultTracking)&&(i&&n&&r.push(this.track(t1,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:i,time:n+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var o=this.trackCampaignEventIfNeeded(++s,r);return this.config.identify&&r.push(this.track(eR(this.config.identify)).promise),tv(this.config.defaultTracking)&&r.push(this.track(t0,void 0,{event_id:o?++s:s,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,eM(Promise.all(r))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=rf(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(tP(t)){var i=t._q;t._q=[],t=tx(new ex,i)}return(null==r?void 0:r.user_id)&&this.setUserId(r.user_id),(null==r?void 0:r.device_id)&&this.setDeviceId(r.device_id),e.prototype.identify.call(this,t,r)},t.prototype.groupIdentify=function(t,r,i,n){if(tP(i)){var s=i._q;i._q=[],i=tx(new ex,s)}return e.prototype.groupIdentify.call(this,t,r,i,n)},t.prototype.revenue=function(t,r){if(tP(t)){var i=t._q;t._q=[],t=tx(new j,i)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!sE(this.webAttribution.options))return!1;var r=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return ee(this,void 0,void 0,function(){var r,i,n;return et(this,function(s){return r=Date.now(),i=eX(this.config.sessionTimeout,this.config.lastEventTime),n=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==t0&&t.event_type!==t1&&(!t.session_id||t.session_id===this.getSessionId())&&(i||n?(this.setSessionId(r),n&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=X(X({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",tc(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t}(eD),sx=function(){var e=new sk;return{init:K(e.init.bind(e),"init",W(e),J(e,["config"])),add:K(e.add.bind(e),"add",W(e),J(e,["config.apiKey","timeline.plugins"])),remove:K(e.remove.bind(e),"remove",W(e),J(e,["config.apiKey","timeline.plugins"])),track:K(e.track.bind(e),"track",W(e),J(e,["config.apiKey","timeline.queue.length"])),logEvent:K(e.logEvent.bind(e),"logEvent",W(e),J(e,["config.apiKey","timeline.queue.length"])),identify:K(e.identify.bind(e),"identify",W(e),J(e,["config.apiKey","timeline.queue.length"])),groupIdentify:K(e.groupIdentify.bind(e),"groupIdentify",W(e),J(e,["config.apiKey","timeline.queue.length"])),setGroup:K(e.setGroup.bind(e),"setGroup",W(e),J(e,["config.apiKey","timeline.queue.length"])),revenue:K(e.revenue.bind(e),"revenue",W(e),J(e,["config.apiKey","timeline.queue.length"])),flush:K(e.flush.bind(e),"flush",W(e),J(e,["config.apiKey","timeline.queue.length"])),getUserId:K(e.getUserId.bind(e),"getUserId",W(e),J(e,["config","config.userId"])),setUserId:K(e.setUserId.bind(e),"setUserId",W(e),J(e,["config","config.userId"])),getDeviceId:K(e.getDeviceId.bind(e),"getDeviceId",W(e),J(e,["config","config.deviceId"])),setDeviceId:K(e.setDeviceId.bind(e),"setDeviceId",W(e),J(e,["config","config.deviceId"])),reset:K(e.reset.bind(e),"reset",W(e),J(e,["config","config.userId","config.deviceId"])),getSessionId:K(e.getSessionId.bind(e),"getSessionId",W(e),J(e,["config"])),setSessionId:K(e.setSessionId.bind(e),"setSessionId",W(e),J(e,["config"])),extendSession:K(e.extendSession.bind(e),"extendSession",W(e),J(e,["config"])),setOptOut:K(e.setOptOut.bind(e),"setOptOut",W(e),J(e,["config"])),setTransport:K(e.setTransport.bind(e),"setTransport",W(e),J(e,["config"])),getIdentity:K(e.getIdentity.bind(e),"getIdentity",W(e),J(e,["config"])),setIdentity:K(e.setIdentity.bind(e),"setIdentity",W(e),J(e,["config","config.userId","config.deviceId"])),getOptOut:K(e.getOptOut.bind(e),"getOptOut",W(e),J(e,["config"])),_setDiagnosticsSampleRate:K(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",W(e),J(e,["config"]))}};sx(),e.s(["createInstance",0,sx],400868)},83733,353068,133675,e=>{"use strict";e.i(774876);var t=e.i(400868),r=e.i(488797),i=e.i(255734);let n={development:"6dd2b0b5f3d30b4509c888a88ad1abd0",production:"0efbcc3f56912e80b
268cd18d19150fa7",staging:"a6691c0f10c33706c179206f30536672"},s={plan:{version:"3",branch:"main",source:"web",versionId:"5549e81b-b351-451f-8612-b85e35b6628b"},ingestionMetadata:{sourceName:"browser-typescript-ampli",sourceVersion:"2.0.0"}};class o{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Bot Clicked in Search Results",this.event_properties=e}}class a{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Bot Displayed in Search Results",this.event_properties=e}}class l{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Energy Purchase Succeeded",this.event_properties=e}}class u{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="First Time Visit",this.event_properties=e}}class c{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Onboarding Page Sign Up Clicked",this.event_properties=e}}class d{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Onboarding Page Viewed",this.event_properties=e}}class h{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Paywall Shown",this.event_properties=e}}class p{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Purchase succeeded",this.event_properties=e}}class f{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Received Message",this.event_properties=e}}class v{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Reg: Profile Info Uploaded Successfully",this.event_properties=e}}class g{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Search Term Submitted",this.event_properties=e}}class m{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Sent Message",this.event_properties=e}}class _{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Sticky Checkout Start",this.event_properties=e}}class y{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Stripe Checkout Start",this.event_properties=e}}class b{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Sub Migration Stripe Checkout Page Viewed",this.event_properties=e}}class w{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Log In Failed",this.event_properties=e}}class S{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Logged In",this.event_properties=e}}class E{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Toggle NSFW Setting",this.event_properties=e}}class k{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Web Plus Sub Checkout Start",this.event_properties=e}}class x{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Web Plus Sub Checkout Page Redirected",this.event_properties=e}}let P=()=>({promise:Promise.resolve()}),T=new class{disabled=!1;amplitude;get client(){return this.isInitializedAndEnabled(),this.amplitude}get isLoaded(){return null!=this.amplitude}isInitializedAndEnabled(){return!!this.amplitude&&!this.disabled}load(e){if(this.disabled=e.disabled??!1,this.amplitude)return P();let r=null;if(e.client&&"apiKey"in e.client?r=e.client.apiKey:"environment"in e&&(r=n[e.environment]),e.client&&"instance"in e.client)this.amplitude=e.client.instance;else if(r){this.amplitude=t.createInstance();let i=e.client&&"configuration"in e.client?e.client.configuration:{};return this.amplitude.init(r,void 0,{...s,...i})}return P()}identify(e,t,n){if((0,i.phIdentify)(e??n?.user_id,t,{brand:"channel"}),!this.isInitializedAndEnabled())return P();e&&(n={...n,user_id:e});let s=new r.Identify;if(null!=t)for(let[e,r]of Object.entries(t))s.set(e,r);return this.amplitude.identify(s,n)}flush(){return this.isInitializedAndEnabled()?this.amplitude.flush():P()}track(e,t){return((0,i.phCapture)(e.event_type,e.event_properties,{userId:t?.user_id??this.amplitude?.getUserId(),brand:"channel"}),this.isInitializedAndEnabled())?this.amplitude.track(e,void 0,t):P()}botClickedInSearchResults(e,t){return this.track(new o(e),t)}botDisplayedInSearchResults(e,t){return this.track(new a(e),t)}energyPurchaseSucceeded(e,t){return this.track(new l(e),t)}firstTimeVisit(e,t){return this.track(new u(e),t)}onboardingPageSignUpClicked(e,t){return this.track(new c(e),t)}onboardingPageViewed(e,t){return this.track(new d(e),t)}paywallShown(e,t){return this.track(new h(e),t)}purchaseSucceeded(e,t){return this.track(new p(e),t)}receivedMessage(e,t){return this.track(new f(e),t)}regProfileInfoUploadedSuccessfully(e,t){return this.track(new v(e),t)}searchTermSubmitted(e,t){return this.track(new g(e),t)}sentMessage(e,t){return this.track(new m(e),t)}stickyCheckoutStart(e,t){return this.track(new _(e),t)}stripeCheckoutStart(e,t){return this.track(new y(e),t)}subMigrationStripeCheckoutPageViewed(e,t){return this.track(new b(e),t)}userLogInFailed(e,t){return this.track(new w(e),t)}userLoggedIn(e,t){return this.track(new S(e),t)}userToggleNsfwSetting(e,t){return this.track(new E(e),t)}webPlusSubCheckoutStart(e,t){return this.track(new k(e),t)}webPlusSubCheckoutPageRedirected(e,t){return this.track(new x(e),t)}};e.s(["ApiKey",0,n,"ampli",0,T],353068);let I={production:"955547da68ccd2fa9f6a6801c8a30e17",staging:"dc69390e27cf22c52ff35450b3264bd4",development:"2f6cb3dbcddd0cc67c19f6e1b82a3c42"},A={plan:{version:"2",branch:"main",source:"web",versionId:"23a49e90-723e-487b-becd-f9e8170dcedd"},ingestionMetadata:{sourceName:"browser-typescript-ampli",sourceVersion:"2.0.0"}};class O{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Bot Clicked in Search Results",this.event_properties=e}}class C{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Bot Displayed in Search Results",this.event_properties=e}}class R{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Energy Purchase Succeeded",this.event_properties=e}}class F{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="First Time Visit",this.event_properties=e}}class L{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Onboarding Page Sign Up Clicked",this.event_properties=e}}class M{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Onboarding Page Viewed",this.event_properties=e}}class D{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Paywall Shown",this.event_properties=e}}class N{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Purchase succeeded",this.event_properties=e}}class ${event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Received Message",this.event_properties=e}}class j{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Reg: Profile Info Uploaded Successfully",this.event_properties=e}}class U{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Search Term Submitted",this.event_properties=e}}class q{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Sent Message",this.event_properties=e}}class B{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Sub Migration Stripe Checkout Page Viewed",this.event_properties=e}}class V{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Log In Failed",this.event_properties=e}}class z{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Logged In",this.event_properties=e}}class H{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="User Toggle NSFW Setting",this.event_properties=e}}class W{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Web Plus Sub Checkout Start",this.event_properties=e}}class G{event_properties;event_type;constructor(e){this.event_properties=e,this.event_type="Web Plus Sub Checkout Page Redirected",this.event_properties=e}}let J=()=>({promise:Promise.resolve()}),K=new class{disabled=!1;amplitude;get client(){return this.isInitializedAndEnabled(),this.amplitude}get isLoaded(){return null!=this.amplitude}isInitializedAndEnabled(){return!!this.amplitude&&!this.disabled}load(e){if(this.disabled=e.disabled??!1,this.amplitude)return J();let r=null;if(e.client&&"apiKey"in e.client?r=e.client.apiKey:"environment"in e&&(r=I[e.environment]),e.client&&"instance"in e.client)this.amplitude=e.client.instance;else if(r){this.amplitude=t.createInstance();let i=e.client&&"configuration"in e.client?e.client.configuration:{};return this.amplitude.init(r,void 0,{...A,...i})}return J()}identify(e,t){if((0,i.phIdentify)(e??t?.user_id,void 0,{brand:"cherry"}),!this.isInitializedAndEnabled())return J();e&&(t={...t,user_id:e});let n=new r.Identify;return this.amplitude.identify(n,t)}flush(){return this.isInitializedAndEnabled()?this.amplitude.flush():J()}track(e,t){return((0,i.phCapture)(e.event_type,e.event_properties,{userId:t?.user_id??this.amplitude?.getUserId(),brand:"cherry"}),this.isInitializedAndEnabled())?this.amplitude.track(e,void 0,t):J()}botClickedInSearchResults(e,t){return this.track(new O(e),t)}botDisplayedInSearchResults(e,t){return this.track(new C(e),t)}energyPurchaseSucceeded(e,t){return this.track(new R(e),t)}firstTimeVisit(e,t){return this.track(new F(e),t)}onboardingPageSignUpClicked(e,t){return this.track(new L(e),t)}onboardingPageViewed(e,t){return this.track(new M(e),t)}paywallShown(e,t){return this.track(new D(e),t)}purchaseSucceeded(e,t){return this.track(new N(e),t)}receivedMessage(e,t){return this.track(new $(e),t)}regProfileInfoUploadedSuccessfully(e,t){return this.track(new j(e),t)}searchTermSubmitted(e,t){return this.track(new U(e),t)}sentMessage(e,t){return this.track(new q(e),t)}subMigrationStripeCheckoutPageViewed(e,t){return this.track(new B(e),t)}userLogInFailed(e,t){return this.track(new V(e),t)}userLoggedIn(e,t){return this.track(new z(e),t)}userToggleNsfwSetting(e,t){return this.track(new H(e),t)}webPlusSubCheckoutStart(e,t){return this.track(new W(e),t)}webPlusSubCheckoutPageRedirected(e,t){return this.track(new G(e),t)}};var Y=e.i(819928);e.s(["getAmpli",0,function(){return"cherry"===(0,Y.getClientProductId)()?K:T}],83733);var Q=e.i(731947),X=e.i(689070),Z=e.i(990942),ee=e.i(615831);let et=["google.","bing.","yahoo.","duckduckgo.","baidu.","yandex.","ecosia.","naver.","seznam."],er=["gclid","gbraid","wbraid","fbclid","msclkid"],ei=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"];function en(){return`${(0,Y.getClientProductId)()}_seo_entry_context`}function es(e){let t=(e.split("#")[0]||"/").split("?")[0]||"/",r=t.startsWith("/")?t:`/${t}`;return""===r?"/":r.replace(/\/+$/,"")||"/"}function eo(){try{return window.sessionStorage}catch{return null}}function ea(e){let t=es(e),r=(0,X.parseLocalizedPathname)(t),i=(0,Y.getClientProductId)();if(r.isLocalized){let e=(0,Z.resolveLocalizedSeoRoute)({productId:i,pathname:t});return e?{locale:e.locale,routePath:e.routePath}:(0,Q.isSeoLocaleEnabledForProduct)({productId:i,locale:r.locale})&&("/blog"===r.routePath||r.routePath.startsWith("/blog/"))?{locale:r.locale,routePath:r.routePath}:null}return{locale:Q.DEFAULT_SEO_LOCALE,routePath:t}}function el(e){return"/"===e?"home":e.replace(/^\/+/,"").replace(/\//g,":")}function eu(e){let t=ea(e);if(!t)return null;let r=t.routePath;return"/"===r||"/image-generators"===r||"/visuals"===r||"/resources"===r?"category":"/ai-companion"===r||"/free-ai-companion"===r||"/ai-girlfriend"===r||"/ai-boyfriend"===r||"/ai-roleplay"===r||"/ai-image-generator"===r||"/ai-video-generator"===r||r.startsWith("/image-generators/")||r.startsWith("/visuals/")?"feature":r.startsWith("/guides/")?"guide":r.startsWith("/comparison/")||r.startsWith("/alternatives/")?"comparison":"/blog"===r||r.startsWith("/blog/")?"blog":"/about"===r||"/contact"===r||"/privacy-policy"===r||"/tos"===r||"/legal-information"===r||"/complaints"===r||"/complaints-and-appeals"===r||"/human-trafficking-policy"===r||"/usc-2257-exemption"===r?"trust":null}function ec(){let e=eo();if(!e)return null;try{let t=e.getItem(en());if(!t)return null;return JSON.parse(t)}catch(e){return null}}e.s(["captureSeoEntryContext",0,function(){let e,t=eo();if(!t)return null;let r=ec();if(r)return r;let i=es(window.location.pathname),n=new URLSearchParams(window.location.search),s="u"<typeof document?void 0:document.referrer;if(!function({pathname:e,params:t,referer:r}){return!!function(e){let t=ea(e);if(!t)return!1;let r=t.routePath;if(r.startsWith("/guides/")||r.startsWith("/comparison/")||r.startsWith("/alternatives/")||"/blog"===r||r.startsWith("/blog/"))return!0;let i=(0,ee.getSeoRouteMeta)(r);return!!i&&!1!==i.sitemap&&(!i.indexableProducts||!!i.indexableProducts.includes((0,Y.getClientProductId)()))&&(!i.sitemapProducts||!!i.sitemapProducts.includes((0,Y.getClientProductId)()))&&null!==eu(r)}(e)&&!er.some(e=>!!t.get(e))&&("organic"===t.get("utm_medium")||(function(e){if(e)try{let t=new URL(e).hostname.toLowerCase();et.some(e=>t.includes(e))}catch{return!1}}(r),!0))}({pathname:i,params:n,referer:s}))return null;let o=eu(i),a=(e=ea(i))&&eu(i)?el(e.routePath):null,l=function(e){let t=ea(e);if(!t)return null;let r=t.routePath;return"/visuals"===r||r.startsWith("/visuals/")?"Open Visuals":"/ai-video-generator"===r?"Start with an image":"/image-generators"===r||r.startsWith("/image-generators/")||"/ai-image-generator"===r?"Browse image generators":"/resources"===r?"Explore resources":"/pricing"===r?"Review pricing":(r.startsWith("/guides/")||r.startsWith("/comparison/")||r.startsWith("/alternatives/"),"Explore companions")}(i),u=ea(i);if(!o||!a||!l||!u)return null;
2let c={product:"cherry"===(0,Y.getClientProductId)()?"Cherry AI":"Channel AI",landing_page:i,seo_entry_path:i,seo_locale:u.locale,seo_route_key:u.routePath,seo_language_cluster:el(u.routePath),seo_page_family:"blog"===o||"guide"===o?"content":"trust"===o?"trust":"product",seo_page_type:o,seo_query_cluster:a,seo_primary_cta:l,...function(e){let t={};for(let r of ei){let i=e.get(r);i&&(t[r]=i)}return t}(n),...s?{referer:s}:{}};return t.setItem(en(),JSON.stringify(c)),c},"withSeoAttribution",0,function(e){let t=ec();return t?{...e,...t}:e}],133675)},866161,90476,e=>{"use strict";var t=e.i(819928),r=e.i(603024),i=e.i(636319),n=e.i(255734),s=e.i(83733),o=e.i(133675);let a="amp_tab_session_id",l="amp_tab_handoff",u={tabSessionId:void 0,appVisible:!0,visibleSince:void 0,hiddenSince:void 0,journeyStarted:!1,tabEnteredAt:void 0,view:{},bot:{},energy:{}};function c(){try{if("u">typeof crypto&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function d(){if(u.tabSessionId)return u.tabSessionId;try{let e=sessionStorage.getItem(a);e||(e=c(),sessionStorage.setItem(a,e)),u.tabSessionId=e}catch{u.tabSessionId=c()}return u.tabSessionId}function h(e,t={}){let r=u.view,i=!u.journeyStarted,n=r.currentView!==e,s=t.tab??r.currentTab,o=void 0!==s&&s!==r.currentTab,a=r.currentTab,l=Date.now(),c=o&&void 0!==u.tabEnteredAt?l-u.tabEnteredAt:void 0;return n&&(r.previousPreviousView=r.previousView,r.previousView=r.currentView,r.currentView=e),r.currentSubTab=t.subTab,void 0!==s&&(r.currentTab=s),o&&(u.tabEnteredAt=l),void 0===u.tabEnteredAt&&(u.tabEnteredAt=l),!1!==t.isRouteView&&(r.routeView=e,r.routeTab=s),u.journeyStarted=!0,{isFirstView:i,viewChanged:n,tabChanged:o,previousTab:a,timeOnPreviousTabMs:c}}function p(e){return{...e,...void 0!==e.botTags?{botTags:[...e.botTags]}:{}}}function f(e){if(e===u.appVisible)return{changed:!1};let t=Date.now();if(!e){let e=void 0!==u.visibleSince?t-u.visibleSince:void 0;return u.appVisible=!1,u.hiddenSince=t,{changed:!0,visibleDurationMs:e}}let r=void 0!==u.hiddenSince?t-u.hiddenSince:void 0;return u.appVisible=!0,u.visibleSince=t,{changed:!0,hiddenDurationMs:r}}function v(){u.visibleSince=Date.now()}function g(){try{let e={tabSessionId:d()??"unknown",view:u.view.currentView,ts:Date.now()};localStorage.setItem(l,JSON.stringify(e))}catch{}}let m="amp_bot_spm";function _(){try{let e=localStorage.getItem(l);if(!e)return;let t=JSON.parse(e);if(!t?.tabSessionId||"number"!=typeof t.ts||Date.now()-t.ts>18e5)return;return t}catch{return}}function y(){let e=u.view,r={client_product:(0,t.getClientProductId)(),tab_session_id:d(),app_visible:u.appVisible};return void 0!==e.currentView&&(r.currentView=e.currentView),void 0!==e.previousView&&(r.previousView=e.previousView),void 0!==e.previousPreviousView&&(r.previousPreviousView=e.previousPreviousView),void 0!==e.currentTab&&(r.tab=e.currentTab),void 0!==e.currentSubTab&&(r.sub_tab=e.currentSubTab),void 0!==u.bot.botJID&&(r.botJID=u.bot.botJID),void 0!==u.bot.botDisplayName&&(r.botDisplayName=u.bot.botDisplayName),void 0!==u.bot.chatBotConfigType&&(r.chatBotConfigType=u.bot.chatBotConfigType),void 0!==u.bot.botType&&(r.botType=u.bot.botType),void 0!==u.bot.isBotCreatedByUser&&(r.isBotCreatedByUser=u.bot.isBotCreatedByUser),void 0!==u.bot.botTags&&u.bot.botTags.length>0&&(r.botTags=u.bot.botTags),void 0!==u.bot.firstGeneratedSPM&&(r.firstGeneratedSPM=u.bot.firstGeneratedSPM),void 0!==u.bot.lastGeneratedSPM&&(r.lastGeneratedSPM=u.bot.lastGeneratedSPM),void 0!==u.energy.energyBalance&&(r.energyBalance=u.energy.energyBalance),void 0!==u.energy.maxEnergy&&(r.maxEnergy=u.energy.maxEnergy),r}function b(){return u.view.currentView}e.s(["clearBotContext",0,function(){u.bot={}},"getCurrentView",0,b,"getSnapshot",0,y,"getTabSessionId",0,d,"markVisibleNow",0,v,"mergeBotContext",0,function(e){void 0!==u.bot.botJID&&(u.bot={...u.bot,...p(e)})},"popOverlayView",0,function(){let{routeView:e,routeTab:t}=u.view;if(e&&u.view.currentView!==e)return h(e,{tab:t,isRouteView:!1})},"pushOverlayView",0,function(e,t){return h(e,{subTab:t,isRouteView:!1})},"pushView",0,h,"readTabHandoff",0,_,"recordBotDiscoverySPM",0,function(e){if(!e)return;let t=u.view,r=t.currentTab??"unknown",i=t.previousView??"direct",n=["native",r,i,t.currentSubTab??t.currentTab??"unknown",i,"native",t.currentSubTab??t.currentTab??"","0"].join("$##$");try{let t=JSON.parse(localStorage.getItem(m)??"{}"),r={first:t[e]?.first??n,last:n};return t[e]=r,localStorage.setItem(m,JSON.stringify(t)),r}catch{return{first:n,last:n}}},"setAppVisible",0,f,"setBotContext",0,function(e){u.bot=p(e)},"setEnergy",0,function(e){u.energy={...e}},"writeTabHandoff",0,g],90476);let w={"/":{view:"Explore",tab:"companions"},"/chat":{view:"Chat List",tab:"chats"},"/chat/[id]":{view:"Chat View"},"/visuals":{view:"Images Tab",tab:"images"},"/visuals/saved":{view:"Saved Visuals",tab:"images"},"/visuals/c/[username]":{view:"Companion Image Detail",tab:"images"},"/images/[id]":{view:"Image Detail"},"/image-generators":{view:"Image Generators Tab",tab:"image-generators"},"/creations":{view:"Creations Tab",tab:"creations"},"/create-companion":{view:"Companion Creation"},"/create":{view:"Companion Creation"},"/referrals":{view:"Referral Rewards"},"/bot/[id]":{view:"Bot Profile"},"/profiles/[slug]":{view:"Bot Profile"}}
2,S=[[/^\/chat\/[^/]+$/,"/chat/[id]"],[/^\/images\/[^/]+$/,"/images/[id]"],[/^\/visuals\/c\/[^/]+$/,"/visuals/c/[username]"],[/^\/bot\/[^/]+$/,"/bot/[id]"],[/^\/profiles\/[^/]+$/,"/profiles/[slug]"],[/^\/share\/[^/]+$/,"/share/[shortid]"]];function E(e,t){let r={},i=[];for(let[t,n]of Object.entries(e)){if(void 0===n)continue;let e=typeof n;"string"===e||"number"===e||"boolean"===e||Array.isArray(n)||function(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(n)?r[t]=n:n instanceof Date?r[t]=n.getTime():n instanceof URL?r[t]=n.href:i.push(t)}return i.length>0&&function(e,t){if(!k){k=!0;try{x("[ALERT] Dropped Event Properties",{event_name:e??"unknown",dropped_keys:t,dropped_count:t.length})}finally{k=!1}}}(t,i),r}let k=!1;function x(e,t={},r){try{let i=E((0,o.withSeoAttribution)(t),e),a=r?.user_id?{user_id:r.user_id}:r?.forceAnonymousUserId?{user_id:void 0}:{},l=r?.user_id?r.user_id:r?.forceAnonymousUserId?void 0:function(){try{let e=(0,s.getAmpli)();return e.isLoaded?e.client.getUserId():void 0}catch{return}}();r?.forceAnonymousUserId||(0,n.phCapture)(e,i,{userId:l}),(0,s.getAmpli)().client.track({event_type:e,event_properties:i,...a,...r?.device_id?{device_id:r.device_id}:{}})}catch{}}function P(e){let t=w[e]??{view:`web:${e}`},r=h(t.view,{tab:t.tab});(r.viewChanged||r.isFirstView)&&(r.isFirstView&&function(){if("u"<typeof document||"hidden"===document.visibilityState)return;let e=_();e&&e.tabSessionId!==d()&&x("Browser Tab Continued",{switch_type:"browser",opened_new_tab:!0,from_tab_session_id:e.tabSessionId,to_tab_session_id:d(),from_view:e.view,to_view:b(),gap_ms:Date.now()-e.ts})}(),r.tabChanged&&!r.isFirstView&&x("Nav Tab Switched",{switch_type:"in_app",from_tab:r.previousTab,to_tab:t.tab,time_on_from_tab_ms:r.timeOnPreviousTabMs}),x("Viewed Screen",{...r.isFirstView?{journey_start:!0}:{}}))}function T(){let{changed:e,visibleDurationMs:t}=f(!1);e&&(g(),x("App Backgrounded",{"Session Length":void 0!==t?Math.round(t/1e3):void 0,visible_duration_ms:t}))}function I(){let{changed:e,hiddenDurationMs:t}=f(!0);if(!e)return;let r=_(),i=d();r&&r.tabSessionId!==i&&x("Browser Tab Continued",{switch_type:"browser",from_tab_session_id:r.tabSessionId,to_tab_session_id:i,from_view:r.view,to_view:b(),gap_ms:Date.now()-r.ts}),x("App Foregrounded",{hidden_duration_ms:t})}let A=!1;e.s(["installAnalyticsChassis",0,function(){if(A)return;A=!0,d(),v();try{(0,s.getAmpli)().client.add({name:"analytics-context-enrichment",type:"enrichment",setup:async()=>void 0,execute:async e=>{var r;let n=void 0!==e.revenue?{revenue:e.revenue,quantity:e.quantity,productId:e.productId,revenueType:e.revenueType,currency:e.currency}:void 0;return!(r=e.event_type)||r.startsWith("$")?(0,i.logAnalyticsEvent)(e.event_type,e.event_properties,!1,n):(e.event_properties=E({client_product:(0,t.getClientProductId)(),...y(),...e.event_properties??{}},e.event_type),(0,i.logAnalyticsEvent)(e.event_type,e.event_properties,!0,n)),e}})}catch{}let e=()=>P(function(e){let t=e.split("?")[0].split("#")[0]||"/";for(let[e,r]of S)if(e.test(t))return r;return t}((0,r.stripAppLocale)(window.location.pathname))),n=history.pushState.bind(history);history.pushState=(...t)=>{n(...t),e()};let o=history.replaceState.bind(history);history.replaceState=(...t)=>{o(...t),e()},window.addEventListener("popstate",e),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?T():I()}),window.addEventListener("pagehide",T),window.addEventListener("pageshow",e=>{e.persisted&&I()}),"hidden"===document.visibilityState&&f(!1)},"onRouteViewChange",0,P,"trackEvent",0,x],866161)}]); 3 4//# debugId=0d0ad255-1293-b592-24ef-1fbe06b5e3dd
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.