PageSourceSearch

https://www.coindesk.com/_next/static/immutable/chunks/2kqk82oquep7h.js

js coindesk.com collected 2026-10-09 22:12:10 UTC 373,851 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,466234,e=>{"use strict";var t=e.i(166300);function r(e,r){t.track(e,r)}e.s(["createTracker",0,function(e){return t=>{r(e,t)}},"setGA4UserProperties",0,function(e){"function"==typeof window.gtag&&window.gtag("set","user_properties",e)},"trackEvent",0,r,"trackGA4Event",0,function(e,t){window.dataLayer&&window.dataLayer.push({event:e,...t})}])},482999,(e,t,r)=>{!function(e){"use strict";var n="function",i="undefined",o="object",s="string",a="model",u="name",l="type",c="vendor",d="version",f="architecture",h="console",p="mobile",g="tablet",v="smarttv",m="wearable",y="embedded",b="Amazon",_="Apple",w="ASUS",S="BlackBerry",E="Browser",k="Chrome",I="Firefox",x="Google",C="Huawei",T="Microsoft",P="Motorola",O="Opera",A="Samsung",R="Sharp",D="Sony",M="Xiaomi",N="Zebra",L="Facebook",U=function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},q=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},j=function(e,t){return typeof e===s&&-1!==F(t).indexOf(F(e))},F=function(e){return e.toLowerCase()},B=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===i?e:e.substring(0,350)},V=function(e,t){for(var r,i,s,a,u,l,c=0;c<t.length&&!u;){var d=t[c],f=t[c+1];for(r=i=0;r<d.length&&!u;)if(u=d[r++].exec(e))for(s=0;s<f.length;s++)l=u[++i],typeof(a=f[s])===o&&a.length>0?2===a.length?typeof a[1]==n?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==n||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):void 0:this[a[0]]=l?a[1].call(this,l,a[2]):void 0:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):void 0):this[a]=l||void 0;c+=2}},K=function(e,t){for(var r in t)if(typeof t[r]===o&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(j(t[r][n],e))return"?"===r?void 0:r}else if(j(t[r],e))return"?"===r?void 0:r;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},W={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[d,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[d,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,d],[/opios[\/ ]+([\w\.]+)/i],[d,[u,O+" Mini"]],[/\bopr\/([\w\.]+)/i],[d,[u,O]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,d],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[d,[u,"UC"+E]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[d,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[d,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[d,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[d,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[d,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+E],d],[/\bfocus\/([\w\.]+)/i],[d,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[d,[u,O+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[d,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[d,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[d,[u,O+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[d,[u,"MIUI "+E]],[/fxios\/([-\w\.]+)/i],[d,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+E]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+E],d],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],d],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,d],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,L],d],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,d],[/\bgsa\/([\w\.]+) .*safari\//i],[d,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[d,[u,k+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,k+" WebView"],d],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[d,[u,"Android "+E]],[/(chrome|omniweb|arora|[t
vendor: 4,850 bytes, line 1
1izenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,d],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[d,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[d,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[d,K,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,d],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],d],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[d,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,d],[/(cobalt)\/([\w\.]+)/i],[u,[d,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,F]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",F]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,F]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[c,A],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[c,A],[l,p]],[/((ipod|iphone)\d+,\d+)/i],[a,[c,_],[l,p]],[/(ipad\d+,\d+)/i],[a,[c,_],[l,g]],[/\((ip(?:hone|od)[\w ]*);/i],[a,[c,_],[l,p]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[c,_],[l,g]],[/(macintosh);/i],[a,[c,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[c,C],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[c,C],[l,p]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[c,M],[l,p]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[c,M],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[c,"OPPO"],[l,p]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[c,"Vivo"],[l,p]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[c,"Realme"],[l,p]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[c,P],[l,p]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[c,P],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[c,"LG"],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[c,"LG"],[l,p]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[c,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[c,"Nokia"],[l,p]],[/(pixel c)\b/i],[a,[c,x],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[c,x],[l,p]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[c,D],[l,p]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[c,D],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[c,"OnePlus"],[l,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[c,b],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[c,b],[l,p]],[/(playbook);[-\w\),; ]+(rim)/i],[a,c,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[c,S],[l,p]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[c,w],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[c,w],[l,p]],[/(nexus 9)/i],[a,[c,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[a,/_/g," "],[l,p]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[c,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[c,"Meizu"],[l,p]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[c,R],[l,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asu
vendor: 6,922 bytes, line 1
1s)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[c,a,[l,p]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,a,[l,g]],[/(surface duo)/i],[a,[c,T],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[c,"Fairphone"],[l,p]],[/(u304aa)/i],[a,[c,"AT&T"],[l,p]],[/\bsie-(\w*)/i],[a,[c,"Siemens"],[l,p]],[/\b(rct\w+) b/i],[a,[c,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[a,[c,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[a,[c,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[c,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[a,[c,"NuVision"],[l,g]],[/\b(k88) b/i],[a,[c,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[a,[c,"ZTE"],[l,p]],[/\b(gen\d{3}) b.+49h/i],[a,[c,"Swiss"],[l,p]],[/\b(zur\d{3}) b/i],[a,[c,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[a,[c,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],a,[l,g]],[/\b(ns-?\w{0,9}) b/i],[a,[c,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[c,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],a,[l,p]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],a,[l,p]],[/\b(ph-1) /i],[a,[c,"Essential"],[l,p]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[c,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[a,[c,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[a,[c,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[a,[c,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[c,a,[l,p]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[c,T],[l,p]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[c,N],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[c,N],[l,p]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,a,[l,h]],[/droid.+; (shield) bui/i],[a,[c,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[a,[c,D],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[c,T],[l,h]],[/smart-tv.+(samsung)/i],[c,[l,v]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[c,A],[l,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,"LG"],[l,v]],[/(apple) ?tv/i],[c,[a,_+" TV"],[l,v]],[/crkey/i],[[a,k+"cast"],[c,x],[l,v]],[/droid.+aft(\w)( bui|\))/i],[a,[c,b],[l,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[a,[c,R],[l,v]],[/(bravia[\w ]+)( bui|\))/i],[a,[c,D],[l,v]],[/(mitv-\w{5}) bui/i],[a,[c,M],[l,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[c,B],[a,B],[l,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,v]],[/((pebble))app/i],[c,a,[l,m]],[/droid.+; (glass) \d/i],[a,[c,x],[l,m]],[/droid.+; (wt63?0{2,3})\)/i],[a,[c,N],[l,m]],[/(quest( 2)?)/i],[a,[c,L],[l,m]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[l,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[l,p]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,p]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[d,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[d,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[d,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,d],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[d,K,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[d,K,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[d,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[d,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[d,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,d],[/\(bb(10);/i],[d,[u,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[d,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[d,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[d,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[d,[u,k+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,d],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],d],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,d]]},H=function(t,r){if(typeof t===o&&(r=t,t=void 0),!(this instanceof H))return new H(t,r).getResult();var n=t||(typeof e!==i&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:""),h=r?U(W,r):W;return this.getBrowser=function(){var e,t={};return t[u]=void 0,t[d]=void 0,V.call(t,n,h.browser),t.major=typeof(e=t.version)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,t},this.getCPU=function(){var e={};return e[f]=void 0,V.call(e,n,h.cpu),e},this.getDevice=function(){var e={};return e[c]=void 0,e[a]=void 0,e[l]=void 0,V.call(e,n,h.device),e},this.getEngine=function(){var e={};return e[u]=void 0,e[d]=void 0,V.call(e,n,h.engine),e},this.getOS=function(){var e={};return e[u]=void 0,e[d]=void 0,V.call(e,n,h.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===s&&e.length>350?B(e,350):e,this},this.setUA(n),this};H.VERSION="0.7.33",H.BROWSER=q([u,d,"major"]),H.CPU=q([f]),H.DEVICE=q([a,c,l,h,p,v,g,m,y]),H.ENGINE=H.OS=q([u,d]),t.exports&&(r=t.exports=H),r.UAParser=H;var G=typeof e!==i&&(e.jQuery||e.Zepto);if(G&&!G.ua){var $=new H;G.ua=$.getResult(),G.ua.get=function(){return $.getUA()},G.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var r in t)G.ua[r]=t[r]}}}("object"==typeof window?window:e.e)},166300,606184,946864,495365,518321,792688,11058,600049,596787,513999,e=>{"use strict";let t,r,n,i,o,s;
1var a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,x,C,T,P,O,A,R,D,M,N,L,U,q,j,F,B,V,K,z,W,H,G,$,J,X,Q,Y,Z,ee,et,er,en,ei,eo,es,ea,eu,el,ec,ed,ef,eh,ep,eg,ev,em,ey=e.i(824627);(a=H||(H={})).SET="$set",a.SET_ONCE="$setOnce",a.ADD="$add",a.APPEND="$append",a.PREPEND="$prepend",a.REMOVE="$remove",a.PREINSERT="$preInsert",a.POSTINSERT="$postInsert",a.UNSET="$unset",a.CLEAR_ALL="$clearAll",(u=G||(G={})).IDENTIFY="$identify",u.GROUP_IDENTIFY="$groupidentify",u.REVENUE="revenue_amount",e.s(["IdentifyOperation",0,H,"SpecialEventType",0,G],606184);var eb="".concat("AMP","_unsent"),e_="$default_instance",ew="https://api2.amplitude.com/2/httpapi",eS="https://api.eu.amplitude.com/2/httpapi",eE="https://api2.amplitude.com/batch",ek="https://api.eu.amplitude.com/batch",eI="dclid",ex="fbclid",eC="gbraid",eT="gclid",eP="ko_click_id",eO="li_fat_id",eA="msclkid",eR="rdt_cid",eD="ttclid",eM="twclid",eN="wbraid",eL={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},eU=["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"],eq=["authorization","cookie","set-cookie"],ej=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var r=e[t];if(!eF(t,r))return!1}return!0},eF=function(e,t){var r,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,ey.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&ej(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else if(null==t)return!1;else if("object"==typeof t)return ej(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},eB=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,ey.__assign)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet($.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet($.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet($.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet($.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet($.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet($.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet($.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet($.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet($.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[$.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,r){if(this._validate(e,t,r)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=r,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,r){return!(void 0!==this._properties[$.CLEAR_ALL]||this._propertySet.has(t))&&(e===$.ADD?"number"==typeof r:e===$.UNSET||e===$.REMOVE||eF(t,r))},e}();(l=$||($={})).SET="$set",l.SET_ONCE="$setOnce",l.ADD="$add",l.APPEND="$append",l.PREPEND="$prepend",l.REMOVE="$remove",l.PREINSERT="$preInsert",l.POSTINSERT="$postInsert",l.UNSET="$unset",l.CLEAR_ALL="$clearAll";var eV=[$.CLEAR_ALL,$.UNSET,$.SET,$.SET_ONCE,$.ADD,$.APPEND,$.PREPEND,$.PREINSERT,$.POSTINSERT,$.REMOVE];e.s(["Identify",0,eB,"OrderedIdentifyOperations",0,eV],946864),(c=J||(J={})).Unknown="unknown",c.Skipped="skipped",c.Success="success",c.RateLimit="rate_limit",c.PayloadTooLarge="payload_too_large",c.Invalid="invalid",c.Failed="failed",c.Timeout="Timeout",c.SystemError="SystemError";var eK=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=J.Unknown),{event:e,code:t,message:r}},ez=e.i(574345),eW=(0,ey.__spreadArray)([],(0,ey.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eH=function(e){var t,r=(0,ez.getGlobalScope)();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,eH);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,(0,ey.__spreadArray)([],(0,ey.__read)(n.entries()),!1).map(function(e){var t=(0,ey.__read)(e,2),r=t[0],n=t[1];return[4,6,8,10].includes(r)?"-".concat(eW[n]):eW[n]}).join("")},eG=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this._optOutListeners=[]}return e.prototype.register=function(e,t){var r,n;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=eH(),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."))),e.type=null!=(r=e.type)?r:"enrichment",[4,null==(n=e.setup)?void 0:n.call(e,t,this.client)];case 1:return i.sent(),this.plugins.push(e),[2]}})})},e.prototype.deregister=function(e,t){var r;return(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(-1===(n=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 i=this.plugins[n],this.plugins.splice(n,1),[4,null==(r=i.teardown)?void 0:r.call(i)];case 1:return o.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.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(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s,a,u,l,c,d,f,h,p,g;return(0,ey.__generator)(this,function(v){switch(v.label){case 0:if(!e)return[2];t=(0,ey.__read)(e,1)[0],r=(0,ey.__read)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),n=this.plugins.filter(function(e){return"before"===e.type}),v.label=1;case 1:v.trys.push([1,6,7,8]),o=(i=(0,ey.__values)(n)).next(),v.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,ey.__assign)({},t))];case 3:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(s.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(s.name),"', event: ").concat(JSON.stringify(t))),v.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:v.sent()},[3,8];case 7:try{o&&!o.done&&(h=i.return)&&h.call(i)}finally{if(f)throw f.error}
1return[7];case 8:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),v.label=9;case 9:v.trys.push([9,14,15,16]),c=(l=(0,ey.__values)(u)).next(),v.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,ey.__assign)({},t))];case 11:if(null===(a=v.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(s.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(s.name),"', event: ").concat(JSON.stringify(t))),v.label=12;case 12:return c=l.next(),[3,10];case 13:return[3,16];case 14:return p={error:v.sent()},[3,16];case 15:try{c&&!c.done&&(g=l.return)&&g.call(l)}finally{if(p)throw p.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=(0,ey.__assign)({},t);return e.execute(r).catch(function(e){return eK(r,0,String(e))})})).then(function(e){var n=(0,ey.__read)(e,1)[0]||eK(t,100,"Event not tracked, no destination plugins on the instance");r(n)}),[2]}})})},e.prototype.flush=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),r=(t=(0,ey.__values)(this._optOutListeners)).next(),a.label=1;case 1:if(r.done)return[3,6];n=r.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,n(e)];case 3:return a.sent(),[3,5];case 4:return i=a.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return r=t.next(),[3,1];case 6:return[3,9];case 7:return o={error:a.sent()},[3,9];case 8:try{r&&!r.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.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}(),e$=function(e,t){return(0,ey.__assign)((0,ey.__assign)({},t),{event_type:G.IDENTIFY,user_properties:e.getUserProperties()})},eJ=function(e,t,r,n){var i;return(0,ey.__assign)((0,ey.__assign)({},n),{event_type:G.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:((i={})[e]=t,i)})},eX=function(e,t,r){var n,i=new eB;return i.set(e,t),(0,ey.__assign)((0,ey.__assign)({},r),{event_type:G.IDENTIFY,user_properties:i.getUserProperties(),groups:((n={})[e]=t,n)})},eQ=function(e){return{promise:e||Promise.resolve()}},eY=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 eG(this),this.name=e}return e.prototype._init=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,ey.__generator)(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]),n=(r=(0,ey.__values)(t)).next(),a.label=2;case 2:if(n.done)return[3,7];if(!((i=(0,n.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return n=r.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}
1return[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 n=(0,ey.__assign)((0,ey.__assign)((0,ey.__assign)({},"string"==typeof e?{event_type:e}:e),r),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),eQ(this.dispatch(n))},e.prototype.identify=function(e,t){var r=e$(e,t);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),eQ(this.dispatch(r))},e.prototype.groupIdentify=function(e,t,r,n){var i=eJ(e,t,r,n);return eQ(this.dispatch(i))},e.prototype.setGroup=function(e,t,r){var n=eX(e,t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),eQ(this.dispatch(n))},e.prototype.revenue=function(e,t){var r=(0,ey.__assign)((0,ey.__assign)({},t),{event_type:G.REVENUE,event_properties:e.getEventProperties()});return eQ(this.dispatch(r))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),eQ())},e.prototype._addPlugin=function(e){return eQ(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)),eQ())},e.prototype._removePlugin=function(e){return eQ(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(eK(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,ey.__generator)(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:{},n=(0,ey.__assign)({},r);if(void 0===e)return n;var i={};return Object.keys(e).forEach(function(t){Object.values(H).includes(t)||(i[t]=e[t])}),eV.forEach(function(t){if(Object.keys(e).includes(t)){var r=e[t];switch(t){case H.CLEAR_ALL:Object.keys(n).forEach(function(e){delete n[e]});break;case H.UNSET:Object.keys(r).forEach(function(e){delete n[e]});break;case H.SET:Object.assign(n,r)}}}),Object.assign(n,i),n},e.prototype.process=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,ey.__generator)(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),this.config.optOut)return[2,eK(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=n.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(n.sent()),this.config.loggerProvider.error(r),[2,t=eK(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 eQ(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}(),eZ=function(e,t){var r=Math.max(t,1);return e.reduce(function(e,t,n){var i=Math.floor(n/r);return e[i]||(e[i]=[]),e[i].push(t),e},[])};(d=X||(X={}))[d.None=0]="None",d[d.Error=1]="Error",d[d.Warn=2]="Warn",d[d.Verbose=3]="Verbose",d[d.Debug=4]="Debug",e.s(["LogLevel",0,X],495365);var e0="Amplitude Logger ",e1=function(){function e(){this.logLevel=X.None}return e.prototype.disable=function(){this.logLevel=X.None},e.prototype.enable=function(e){void 0===e&&(e=X.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<X.Verbose||console.log("".concat(e0,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<X.Warn||console.warn("".concat(e0,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<X.Error||console.error("".concat(e0,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<X.Debug||console.log("".concat(e0,"[Debug]: ").concat(e.join(" ")))},e}(),e2=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:e_,logLevel:X.Warn,loggerProvider:new e1,offline:!1,optOut:!1,serverUrl:ew,serverZone:"US",useBatch:!1}},e3=function(){function e(e){this._optOut=!1;var t,r,n,i,o=e2();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!=(r=e.logLevel)?r:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!=(n=e.optOut)?n:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!=(i=e.useBatch)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=e4(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e}
1,enumerable:!1,configurable:!0}),e}(),e4=function(e,t,r){if(void 0===e&&(e=""),void 0===t&&(t=e2().serverZone),void 0===r&&(r=e2().useBatch),e)return{serverUrl:e,serverZone:void 0};var n,i=["US","EU"].includes(t)?t:e2().serverZone;return{serverZone:i,serverUrl:(n=r,"EU"===i?n?ek:eS:n?eE:ew)}},e5=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function e6(e){return e>=200&&e<300}var e8=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},e7=function(e){return function(){var t=(0,ey.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},e9=function(e,t){var r,n;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,ey.__values)(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},te=function(e,t){return function(){var r,n,i={};try{for(var o=(0,ey.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=e9(e,a)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},tt=function(e,t,r,n,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=r(),u=a.logger,l=a.logLevel;if(l&&l<X.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:e8(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),d}},tr=new Set([ew,eS,eE,ek]);function tn(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var ti=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(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n=this;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(eb,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?void 0:t.get(this.storageKey)];case 1:return(r=i.sent())&&r.length>0&&Promise.all(r.map(function(e){return n.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=eH()),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()})},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),(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n=this;return(0,ey.__generator)(this,function(i){switch(i.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,eZ(t,this.config.flushQueueSize).reduce(function(t,r){return(0,ey.__awaiter)(n,void 0,void 0,function(){return(0,ey.__generator)(this,function(n){switch(n.label){case 0:return[4,t];case 1:return n.sent(),[4,this.send(r,e)];case 2:return[2,n.sent()]}})})},Promise.resolve())];case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(e,t){var r;return void 0===t&&(t=!0),(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a;return(0,ey.__generator)(this,function(u){var l,c,d;switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,ey.__rest)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new e5,u.label=1;case 1:return u.trys.push([1,3,,4]),l=i=e4(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),o=!!tr.has(l)||c,[4,this.config.transportProvider.send(i,n,this.config._enableRequestBodyCompressionExperimental&&o)];case 2:if(null===(s=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(tn(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return a=(d=u.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:e8()}),this.handleResponse({status:J.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){e6(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:tn(e),stack_trace:e8()});var r,n=e.status;switch(n){case J.Success:this.handleSuccessResponse(e,t);break;case J.Invalid:this.handleInvalidResponse(e,t);break;case J.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case J.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' 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 n=new Set((0,ey.__spreadArray)((0,ey.__spreadArray)((0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,ey.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,ey.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,ey.__read)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!n.has(i)||void r.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(tn(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(tn(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(r)},e.prototype.handleRateLimitResponse=function(e,t){var r=this,n=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),a=new Set(i),u=new Set(o),l=t.filter(function(t,n){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void r.fulfillRequest([t],e.statusCode,e.body.error):(u.has(n)&&(t.timeout=r.throttleTimeout),!0)});l.length>0&&this.config.loggerProvider.warn(tn(e));var c=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,r=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.fulfillRequest=function(e,t,r){var n,i,o;e6(t)?null==(o=this.diagnosticsClient)||o.increment("analytics.events.sent",e.length):(null==(n=this.diagnosticsClient)||n.increment("analytics.events.dropped",e.length),null==(i=this.diagnosticsClient)||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:r,stack_trace:e8()})),this.removeEvents(e),e.forEach(function(e){return e.callback(eK(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}(),to=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));ej(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?(0,ey.__assign)({},this.properties):{};return e[Q.REVENUE_PRODUCT_ID]=this.productId,e[Q.REVENUE_QUANTITY]=this.quantity,e[Q.REVENUE_PRICE]=this.price,e[Q.REVENUE_TYPE]=this.revenueType,e[Q.REVENUE_CURRENCY]=this.currency,e[Q.REVENUE]=this.revenue,e[Q.RECEIPT]=this.receipt,e[Q.RECEIPT_SIG]=this.receiptSig,e},e}();(f=Q||(Q={})).REVENUE_PRODUCT_ID="$productId",f.REVENUE_QUANTITY="$quantity",f.REVENUE_PRICE="$price",f.REVENUE_TYPE="$revenueType",f.REVENUE_CURRENCY="$currency",f.REVENUE="$revenue",f.RECEIPT="$receipt",f.RECEIPT_SIG="$receiptSig",e.s(["Revenue",0,to,"RevenueProperty",0,Q],518321);var ts=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ta(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ta=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},tu=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),tl=function(){return(tl=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function tc(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function td(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var tf=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=tc(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),u=Array.isArray(t);if(a!==u)return!1;if(a&&u){for(var l=0;l<e.length;l++)if(!tf(e[l],t[l]))return!1}else{if(!tf(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){tf(e[r],t[r])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var th=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=tl({},this.identity.userProperties),r=tl(tl({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,u=r.userProperties||{};try{for(var l=tc(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=td(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,tc(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=td(g.value,2),m=v[0],y=v[1];u[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,tc(Object.keys(h))),_=b.next();!_.done;_=b.next()){var m=_.value;delete u[m]}}catch(e){s={error:e}}finally{try{_&&!_.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return r.userProperties=u,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return tl({},this.identity)},e.prototype.setIdentity=function(e){var t=tl({},this.identity);this.identity=tl({},e),tf(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),tp="u">typeof globalThis?globalThis:e.g,tg=function(){function e(){this.identityStore=new th,this.eventBridge=new tu,this.applicationContextProvider=new ts}return e.getInstance=function(t){return tp.analyticsConnectorInstances||(tp.analyticsConnectorInstances={}),tp.analyticsConnectorInstances[t]||(tp.analyticsConnectorInstances[t]=new e),tp.analyticsConnectorInstances[t]},e}(),tv=function(e){return void 0===e&&(e=e_),tg.getInstance(e)},tm=function(e,t){tv(t).identityStore.editIdentity().setUserId(e).commit()},ty=function(e,t){tv(t).identityStore.editIdentity().setDeviceId(e).commit()},tb=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},t_=function(){function e(){this.name="identity",this.type="before",this.identityStore=tv().identityStore}return e.prototype.execute=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return e.instanceName&&(this.identityStore=tv(e.instanceName).identityStore),[2]})})},e}(),tw=function(){var e,t=(0,ez.getGlobalScope)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(
1Boolean).reduce(function(e,t){var r=t.split("=",2),n=tS(r[0]),i=tS(r[1]);return i&&(e[n]=i),e},{}):{}},tS=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}};e.s(["OfflineDisabled",0,null],792688);var tE=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}(),tk=function(){function e(e,t,r,n){void 0===r&&(r="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=n||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new tE(e,t)}return e.prototype.subscribe=function(e,t,r){var n=eH(),i={id:n,key:e,deliveryMode:t,callback:r};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),n},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(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),r=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,r])];case 1:return void 0!==(n=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(n))),null!==n.remoteConfig?this.sendCallback(e,n,"cache"):this.logger.debug("Remote config client skips sending c
1allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:r=new Promise(function(e,r){setTimeout(function(){r("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),r])];case 2:return n=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,n,"remote"),this.storage.setConfig(n),[3,5];case 3:return i.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!==(n=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,n,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,n,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,r){var n;e.lastCallback=new Date,n=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(n,r,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n,i,o,s,a,u=this;return(0,ey.__generator)(this,function(l){switch(l.label){case 0:r=t/e,n={remoteConfig:null,lastFetch:new Date},i=function(n){var i,s,a,l,c,d;return(0,ey.__generator)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),401===l.status||403===l.status?(o.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&429!==l.status&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.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(!i)return[2,"break"];if(!(n<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(r))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.label=3;case 3:return s++,[3,1];case 4:return[2,n]}})})},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}(),tI="tags",tx="counters",tC="histograms",tT="events",tP="internal",tO="last_flush_timestamp",tA=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=(0,ez.getGlobalScope)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(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 n=indexedDB.open(e.dbName,1);n.onerror=function(){e.dbPromise=null,r(Error("Failed to open IndexedDB"))},n.onsuccess=function(){var r=n.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)},n.onupgradeneeded=function(t){var r=t.target.result;e.createTables(r)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(tI)||e.createObjectStore(tI,{keyPath:"key"}),e.objectStoreNames.contains(tx)||e.createObjectStore(tx,{keyPath:"key"}),e.objectStoreNames.contains(tC)||e.createObjectStore(tC,{keyPath:"key"}),e.objectStoreNames.contains(tT)||e.createObjectStore(tT,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(tP)||e.createObjectStore(tP,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(o.tr
1ys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tI],"readwrite")).objectStore(tI),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tags",e),n()},o.forEach(function(e){var t=(0,ey.__read)(e,2),n=t[0],o=t[1];r.put({key:n,value:o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tag",n,o,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",n),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tx],"readwrite")).objectStore(tx),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to increment counters",e),n()},o.forEach(function(e){var t=(0,ey.__read)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e=s.result,t=e?e.value:0;r.put({key:n,value:t+o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",n),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tC],"readwrite")).objectStore(tC),[2,new Promise(function(n){var o=Object.entries(e);t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),n()},o.forEach(function(e){var t=(0,ey.__read)(e,2),n=t[0],o=t[1],s=r.get(n);s.onsuccess=function(){var e,t=s.result;e=t?{key:n,count:t.count+o.count,min:Math.min(t.min,o.min),max:Math.max(t.max,o.max),sum:t.sum+o.sum}:{key:n,count:o.count,min:o.min,max:o.max,sum:o.sum},r.put(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return r=(t=o.sent().transaction([tT],"readwrite")).objectStore(tT),[2,new Promise(function(n){t.oncomplete=function(){n()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event records",e),n()};var o=r.count();o.onsuccess=function(){var t=Math.max(0,10-o.result);t<e.length&&i.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){i.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},o.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return n=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",n),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=(r=o.sent().transaction([tP],"readwrite")).objectStore(tP),[2,new Promise(function(i,o){r.onabort=function(){return o(Error("Failed to set internal value"))};var s=n.put({key:e,value:t});s.onsuccess=function(){return i()},s.onerror=function(){return o(Error("Failed to set internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",i),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(t=i.sent().transaction([tP],"readonly")).objectStore(tP),[2,new Promise(function(n,i){t.onabort=function(){return i(Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return n(o.result)},o.onerror=function(){return i(Error("Failed to get internal value"))}})];case 2:return n=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",n),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getInternal(tO)];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(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.setInternal(tO,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,n){var i=e.objectStore(t).clear();i.onsuccess=function(){return r()},i.onerror=function(){return n(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,ey.__generator)(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([tI,tx,tC,tT],"readwrite"),[4,Promise.all([this.getAllFromStore(e,tI),this.getAllFromStore(e,tx),this.getAllFromStore(e,tC),this.getAllFromStore(e,tT)])];case 2:return r=(t=ey.__read.apply(void 0,[a.sent(),4]))[0],n=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,tx),this.clearTable(e,tC),this.clearTable(e,tT)])];case 3:return a.sent(),[2,{tags:r,counters:n,histogramStats:i,events:o}];case 4:return s=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(r,n){var i=e.objectStore(t).getAll();i.onsuccess=function(){return r(i.result)},i.onerror=function(){return n(Error("Failed to get all from ".concat(t)))}})},e}(),tR=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}
1,tD=function(e,t){return 31*Math.abs(tR(e.toString()))%1e5/1e5<t},tM=function(){var e=(0,ez.getGlobalScope)();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},tN=function(e){var t=(0,ez.getGlobalScope)();if(t&&"function"==typeof t.addEventListener){var r=function(t){e.recordEvent("sdk.error.uncaught",(0,ey.__assign)({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,n=null==t?void 0:t.stack,i=tL({filename:e.filename,stack:n});i&&r({type:"error",message:e.message,stack:n,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,n=e.reason instanceof Error?e.reason:void 0,i=null==n?void 0:n.stack,o=tU(i),s=tL({filename:o,stack:i});s&&r({type:"unhandledrejection",message:null!=(t=null==n?void 0:n.message)?t:tq(e.reason),stack:i,filename:o,errorName:null==n?void 0:n.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},tL=function(e){var t,r,n=tM();if(0!==n.length)try{for(var i=(0,ey.__values)(n),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},tU=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},tq=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},tj=function(){function e(e,t,r,n){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(n,null,2)),this.config=(0,ey.__assign)({enabled:!0,sampleRate:0},n),this.startTimestamp=Date.now(),this.shouldTrack=tD(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,tA.isSupported()?this.storage=new tA(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(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,ey.__assign)({},this.inMemoryTags),t=(0,ey.__assign)({},this.inMemoryCounters),r=(0,ey.__assign)({},this.inMemoryHistograms),n=(0,ey.__spreadArray)([],(0,ey.__read)(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(n)])];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l;return(0,ey.__generator)(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,n=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]=e.value}),a={}
1,n.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),u=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===u.length)return[2];return l={tags:o,histogram:a,counters:s,events:u},this.fetch(l),[2]}})})},e.prototype.fetch=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),!(0,ez.getGlobalScope)())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(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t,r;return(0,ey.__generator)(this,function(n){switch(n.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=n.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=tD(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),tF=e.i(427968),tB=tF.default||tF,tV=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},tK=function(e){return tV(e,"attribution")},tz=function(e){return tV(e,"formInteractions")},tW=function(e){return tV(e,"pageViews")},tH=function(e){return tV(e,"sessions")},tG=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},t$=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tJ=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tX=function(e){if(t$(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},tQ=function(e){if(tJ(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tY=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),(0,ey.__assign)((0,ey.__assign)({},r),{captureRules:null==(t=null==r?void 0:r.captureRules)?void 0:t.map(function(t){var r,n,i;if((null==(r=t.urls)?void 0:r.length)&&(null==(n=t.hosts)?void 0:n.length)){var o=JSON.stringify(t.hosts),s=JSON.stringify(t.urls);return null==(i=e.loggerProvider)||i.warn("Found network capture rule with both urls='".concat(s,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,ey.__assign)((0,ey.__assign)({},t),{hosts:void 0})}return t})})}},tZ=function(e){var t,r=function(){return!1},n=void 0,i=e.pageCounter;return tW(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&&(n=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:r,trackHistoryChanges:n,eventType:t,pageCounter:i}},t0=function(e){return tK(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?(0,ey.__assign)({},e.defaultTracking.attribution):{}},t1=function(e){if(tz(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}
1,t2=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,s=n.resolve,a=e&&e[i];if("function"==typeof a){var u=a.apply(e,o);"function"==typeof s&&s(null==u?void 0:u.promise)}}return e},t3=function(e){return e&&void 0!==e._q},t4=function(){if("u"<typeof navigator)return"";var e,t,r,n,i=navigator.userLanguage;return null!=(n=null!=(r=null!=(t=null==(e=navigator.languages)?void 0:e[0])?t:navigator.language)?r:i)?n:""},t5="2.38.1",t6="amplitude-ts",t8=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(t6,"/").concat(t5),"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(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i,o;return(0,ey.__generator)(this,function(s){return n=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(r=e.event_id)?r:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=n),[2,(0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:n},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:t4()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:eH(),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:o,library:this.library,user_agent:this.userAgent})]})})},e}(),t7=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),t9=function(){var e,t=(0,ez.getGlobalScope)();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},re=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,ey.__assign)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",r=new e((0,ey.__assign)({},this.options)),n=String(Date.now()),[4,r.transaction(t,function(e){var r,o;try{e.set(n);var s=e.get()===n;return!s&&i.config.diagnosticsClient&&(null==(r=i.config.diagnosticsClient)||r.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:n,sync:!0})),s}catch(e){if(i.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null==(o=i.config.diagnosticsClient)||o.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:n,error:a,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(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=rn(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(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l,c;return(0,ey.__generator)(this,function(d){switch(d.label){case 0:n=(0,ez.getGlobalScope)(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(i=null==n?void 0:n.cookieStore))return[3,3];return[4,i.getAll(e)];case 2:if(o=d.sent()){o.length>1&&(null==(t=this.config.diagnosticsClient)||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null==(r=this.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,ey.__values)(o)).next();!a.done;a=s.next())if(u=a.value,ri(u.domain,this.options.domain))return[2,u.value]}catch(e){l={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(l)throw l.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,n=this,i=(0,ez.getGlobalScope)(),o=(null!=(r=null==(t=null==i?void 0:i.document)?void 0:t.cookie.split("; "))?r:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;
1if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var r;try{var i=a(t.substring(e.length+1));return i||null==(r=n.config.diagnosticsClient)||r.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var r;try{var n=null!=(r=this.options.expirationDays)?r:0,i=null!==t?n:-1,o=void 0;if(i){var s=new Date;s.setTime(s.getTime()+24*i*36e5),o=s}var a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t))));o&&(a+="; expires=".concat(o.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 u=(0,ez.getGlobalScope)();(null==u?void 0:u.document)&&(u.document.cookie=a)}catch(t){var l=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}},e.prototype.remove=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];r="AMP_TLDTEST",n=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.transaction(r,function(r){if(e.cachedTlds[t])return!0;try{r.set(1);var n=!!r.get();return n&&(e.cachedTlds[t]=!0),n}finally{r.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n,i=this;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(r=t9(),n=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!r)return[2,n()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.request("com.amplitude:cookie-lock:".concat(e),n)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,n()];case 4:return[2]}})})},e.cachedTlds={},e}(),rt=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},rr=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},rn=function(e){var t;return null!=(t=rt(e))?t:rr(e)},ri=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()},ro=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(Boolean).join("_")},rs=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return i.sent(),[4,r.get(n)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(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(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(n){try{null==(r=this.storage)||r.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),ra=function(e){function t(t){var r,n,i,o=this;try{i=null==(r=(0,ez.getGlobalScope)())?void 0:r.localStorage}catch(e){null==(n=null==t?void 0:t.loggerProvider)||n.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,ey.__extends)(t,e),t.prototype.set=function(t,r){var n;return(0,ey.__awaiter)(this,void 0,void 0,function(){var i;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(r)&&r.length>1e3))return[3,2];return i=r.length-1e3,[4,e.prototype.set.call(this,t,r.slice(0,1e3))];case 1:return o.sent(),null==(n=this.loggerProvider)||n.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},t}(rs),ru=function(e){function t(){var t;return e.call(this,null==(t=(0,ez.getGlobalScope)())?void 0:t.sessionStorage)||this}return(0,ey.__extends)(t,e),t}(rs),rl=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,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E=e.code||0,k=this.buildStatus(E);switch(k){case J.Success:return{status:k,statusCode:E,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(r=e.payload_size_bytes)?r:0,serverUploadTime:null!=(n=e.server_upload_time)?n:0}};case J.Invalid:return{status:k,statusCode:E,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invali
1d_fields)?s:{},eventsWithMissingFields:null!=(a=e.events_with_missing_fields)?a:{},eventsWithInvalidIdLengths:null!=(u=e.events_with_invalid_id_lengths)?u:{},epsThreshold:null!=(l=e.eps_threshold)?l:0,exceededDailyQuotaDevices:null!=(c=e.exceeded_daily_quota_devices)?c:{},silencedDevices:null!=(d=e.silenced_devices)?d:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(h=e.throttled_devices)?h:{},throttledEvents:null!=(p=e.throttled_events)?p:[]}};case J.PayloadTooLarge:return{status:k,statusCode:E,body:{error:null!=(g=e.error)?g:""}};case J.RateLimit:return{status:k,statusCode:E,body:{error:null!=(v=e.error)?v:"",epsThreshold:null!=(m=e.eps_threshold)?m:0,throttledDevices:null!=(y=e.throttled_devices)?y:{},throttledUsers:null!=(b=e.throttled_users)?b:{},exceededDailyQuotaDevices:null!=(_=e.exceeded_daily_quota_devices)?_:{},exceededDailyQuotaUsers:null!=(w=e.exceeded_daily_quota_users)?w:{},throttledEvents:null!=(S=e.throttled_events)?S:[]}};case J.Timeout:default:return{status:k,statusCode:E}}},e.prototype.buildStatus=function(e){return e6(e)?J.Success:429===e?J.RateLimit:413===e?J.PayloadTooLarge:408===e?J.Timeout:e>=400&&e<500?J.Invalid:e>=500?J.Failed:J.Unknown},e}();function rc(){return"u">typeof CompressionStream}function rd(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(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 rf=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(0,ey.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,ey.__generator)(this,function(i){return[2,new Promise(function(i,o){"u"<typeof XMLHttpRequest&&o(Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===n.state.done){var e=s.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:s.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},u=JSON.stringify(t),l=r&&u.length>=2048&&rc(),c=function(e){var t,r;a=(0,ey.__assign)((0,ey.__assign)({},n.customHeaders),a);try{for(var i=(0,ey.__values)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var u=(0,ey.__read)(o.value,2),l=u[0],c=u[1];s.setRequestHeader(l,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}s.send(e)};(0,ey.__awaiter)(n,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(t){switch(t.label){case 0:if(!l)return[3,2];return[4,rd(u)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(u),[3,3];case 2:c(u),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(rl),rh=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,ey.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return(0,ey.__generator)(this,function(c){switch(c.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");if(n=JSON.stringify(t),i=r&&n.length>=2048&&rc(),o=n,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,rd(n)];case 1:(a=c.sent())&&(s["Content-Encoding"]="gzip",o=a),c.label=2;case 2:return[4,fetch(e,{headers:s=(0,ey.__assign)((0,ey.__assign)({},this.customHeaders),s),body:o,method:"POST"})];case 3:return[4,(u=c.sent()).text()];case 4:l=c.sent();try{return[2,this.buildResponse(JSON.parse(l))]}catch(e){return[2,this.buildResponse({code:u.status})]}}})})},t}(rl),rp=function(e){function t(){return e.call(this)||this}return(0,ey.__extends)(t,e),t.prototype.send=function(e,t,r){return void 0===r&&(r=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){var r=this;return(0,ey.__generator)(this,function(n){return[2,new Promise(function(n,i){var o=(0,ez.getGlobalScope)();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,s))return n(r.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return n(r.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(rl),rg=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},rv=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},rm="[Amplitude]",ry="".concat(rm," Form Started"),rb="".concat(rm," Form Submitted"),r_="".concat(rm," File Downloaded"),rw="session_start",rS="session_end",rE="".concat(rm," File Extension"),rk="".concat(rm," File Name"),rI="".concat(rm," Link ID"),rx="".concat(rm," Link Text"),rC="".concat(rm," Link URL"),rT="".concat(rm," Form ID"),rP="".concat(rm," Form Name"),rO="".concat(rm," Form Destination"),rA="cookie",rR={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};e.s(["EXCLUDE_INTERNAL_REFERRERS_CONDITIONS",0,rR],11058);var rD=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},rM=function(e,t,r,n,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,ey.__rest)(e,["referrer","referring_domain"]),u=t||{},l=(u.referrer,u.referring_domain),c=(0,ey.__rest)(u,["referrer","referring_domain"]),d=r.excludeInternalReferrers;if(d){var f=rq(d,n);if(!(f instanceof TypeError)&&e.referring_domain&&rV(e.referring_domain,o)){if
1("always"===f)return rj(f,e.referring_domain,n),!1;else if("ifEmptyCampaign"===f&&Object.values((0,ey.__assign)((0,ey.__assign)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return rj(f,e.referring_domain,n),!1}}if(rN(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&Object.values(e).every(function(e){return!e})&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var h=JSON.stringify(a)!==JSON.stringify(c),p=rD(s||"")!==rD(l||""),g=!t||h||p;return g?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),g},rN=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})},rL=function(e,t){var r=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(r)},rU=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},rq=function(e,t){if(!0===e)return rR.always;if("object"==typeof e){var r=e.condition;if("string"==typeof r&&Object.keys(rR).includes(r))return r;if(void 0===r)return rR.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),TypeError(n)};function rj(e,t,r){var n="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(n):"ifEmptyCampaign"===e&&r.debug("".concat(n," with empty campaign parameters"))}var rF=["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"],rB=function(e){var t,r,n=e||(null==(r=null==(t=(0,ez.getGlobalScope)())?void 0:t.location)?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],s=i[i.length-2];return(rF.find(function(e){return n.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s)?"".concat(s,".").concat(o):o},rV=function(e,t){var r=(0,ez.getGlobalScope)();return!!r&&rL(e,(t||"").trim()||rB(r.location.hostname))},rK=function(e){function t(t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,x,C,T,P,O,A,R,D,M,N,L,U,q,j,F,B,V,K,z,W){void 0===n&&(n=new t7),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===l&&(l=5),void 0===c&&(c=30),void 0===d&&(d=rA),void 0===v&&(v=new e1),void 0===m&&(m=X.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===E&&(E=""),void 0===k&&(k="US"),void 0===C&&(C=18e5),void 0===T&&(T=new ra({loggerProvider:v})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0),void 0===q&&(q=!0),void 0===j&&(j=0),void 0===K&&(K=!1),void 0===z&&(z=!1);var H,G=this;(G=e.call(this,{apiKey:t,storageProvider:T,transportProvider:rH(O)})||this).apiKey=t,G.appVersion=r,G.cookieOptions=i,G.defaultTracking=o,G.autocapture=s,G.flushIntervalMillis=u,G.flushMaxRetries=l,G.flushQueueSize=c,G.identityStorage=d,G.ingestionMetadata=f,G.instanceName=h,G.loggerProvider=v,G.logLevel=m,G.minIdLength=y,G.offline=b,G.partnerId=w,G.plan=S,G.serverUrl=E,G.serverZone=k,G.sessionTimeout=C,G.storageProvider=T,G.trackingOptions=P,G.transport=O,G.useBatch=A,G.fetchRemoteConfig=R,G.networkTrackingOptions=L,G.identify=U,G.enableDiagnostics=q,G.diagnosticsSampleRate=j,G.diagnosticsClient=F,G.remoteConfig=B,G.topLevelDomain=V,G.enableRequestBodyCompression=K,G._enableRequestBodyCompressionExperimental=z,G.customEnrichment=W,G.version=t5,G._optOut=!1,G._cookieStorage=n,G.deviceId=a,G.lastEventId=p,G.lastEventTime=g,G.optOut=_,G.deferredSessionId=x,G.sessionId=I,G.pageCounter=M,G.userId=D,G.debugLogsEnabled=N,G.loggerProvider.enable(N?X.Debug:G.logLevel),G.networkTrackingOptions=L,G.identify=U,G.enableDiagnostics=q,G.diagnosticsSampleRate=j,G.diagnosticsClient=F;var $=null!=(H=null==B?void 0:B.fetchRemoteConfig)?H:R;return G.remoteConfig=G.remoteConfig||{},G.remoteConfig.fetchRemoteConfig=$,G.fetchRemoteConfig=$,G.topLevelDomain=V||rB(),G}return(0,ey.__extends)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
1,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 re&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(ro(this.apiKey),e)},t}(e3),rz=function(e,t,r){switch(void 0===e&&(e=rA),void 0===t&&(t={}),e){case"localStorage":return new ra;case"sessionStorage":return new ru;case"none":return new t7;default:return new re((0,ey.__assign)((0,ey.__assign)({},t),{expirationDays:t.expiration}),r)}},rW=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},rH=function(e){var t="object"==typeof e?e.type:e,r="object"==typeof e?e.headers:void 0;return"xhr"===t?new rf(r):"beacon"===t?new rp:new rh(r)},rG="data-amp-mask",r$="*****",rJ=/\b(?:\d[ -]*?){13,16}\b/,rX=/(\d{3}-?\d{2}-?\d{4})/g,rQ=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,rY=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var r,n,i=e;i=(i=(i=i.replace(rJ,r$)).replace(rX,r$)).replace(rQ,r$);try{for(var o=(0,ey.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,r$)}catch(e){}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},rZ=function(e){if("u"<typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(rG)?r$:e?e(document.title):document.title},r0=function(){function e(){}return e.prototype.parse=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return[2,(0,ey.__assign)((0,ey.__assign)((0,ey.__assign)((0,ey.__assign)({},eL),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=tw();return{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=tw();return(e={})[eI]=t[eI],e[ex]=t[ex],e[eC]=t[eC],e[eT]=t[eT],e[eP]=t[eP],e[eO]=t[eO],e[eA]=t[eA],e[eR]=t[eR],e[eD]=t[eD],e[eM]=t[eM],e[eN]=t[eN],e},e}(),r1=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},r2="AMP_PAGE_VIEW",r3=function(e){void 0===e&&(e={});var t,r,n,i=(0,ez.getGlobalScope)(),o=void 0,s=!1,a=e.trackOn,u=e.trackHistoryChanges,l=e.eventType,c=void 0===l?"[Amplitude] Page Viewed":l,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},f=function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:return t=d("u">typeof location&&location.href||""),n={event_type:c},r=[{}],[4,r4()];case 1:return[2,(n.event_properties=ey.__assign.apply(void 0,[ey.__assign.apply(void 0,r.concat([i.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":rZ(rY),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),n)]}})})},h=function(){return void 0===a||"function"==typeof a&&a()},p="u">typeof location?location.href:null,g=function(){(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,r,i,s,a;return(0,ey.__generator)(this,function(l){switch(l.label){case 0:if(r=r6(u,e=location.href,p||"")&&h(),p=e,!r)return[3,4];if(i=void 0,n&&(i=eH(),n.set(r2,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(s=t).track,[4,f(i)];case 2:a.apply(s,[l.sent()]),l.label=3;case 3:l.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var u,l,c;return(0,ey.__generator)(this,function(d){switch(d.label){case 0:if(t=a,r=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,i){try{n=new rs(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",g),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,r){var n=(0,ey.__read)(r,3),i=n[0],o=n[1],a=n[2];e.apply(t,[i,o,a]),s&&g()}})}if(!h())return[3,2];return o.log("Tracking page view event"),u=void 0,n&&(u=eH(),n.set(r2,{pageViewId:u})),c=(l=t).track,[4,f(u)];case 1:c.apply(l,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var t,i,s;return(0,ey.__generator)(this,function(u){switch(u.label){case 0:if(!("attribution"===a&&r5(e)))return[3,4];
1if(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!n)return[3,2];return[4,n.get(r2)];case 1:t=null==(i=u.sent())?void 0:i.pageViewId,u.label=2;case 2:return[4,f(t)];case 3:e.event_type=(s=u.sent()).event_type,e.event_properties=(0,ey.__assign)((0,ey.__assign)({},e.event_properties),s.event_properties),u.label=4;case 4:return r&&e.event_type===c&&(r.pageCounter=r.pageCounter?r.pageCounter+1:1,e.event_properties=(0,ey.__assign)((0,ey.__assign)({},e.event_properties),{"[Amplitude] Page Counter":r.pageCounter})),[2,e]}})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return i&&(i.removeEventListener("popstate",g),s=!1),[2]})})}}},r4=function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(t){switch(t.label){case 0:return e=r1,[4,new r0().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},r5=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,r=t[H.SET]||{},n=t[H.UNSET]||{},i=(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(Object.keys(r)),!1),(0,ey.__read)(Object.keys(n)),!1);return Object.keys(eL).every(function(e){return i.includes(e)})}return!1},r6=function(e,t,r){if("pathOnly"!==e)return t!==r;if(""==r)return!0;var n=new URL(t),i=new URL(r);return n.origin+n.pathname!==i.origin+i.pathname},r8=function(){var e,t,r=[],n=function(e,t,n){e.addEventListener(t,n),r.push({element:e,type:t,handler:n})},i=function(){r.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),r=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(r,i){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,ey.__generator)(this,function(a){return t=t1(r),o=function(){if(!i)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 o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;n(e,"change",function(){var t,r=r9(e);s||i.track(ry,((t={})[rT]=r7(e.id),t[rP]=r7(e.name),t[rO]=r,t)),s=!0}),n(e,"submit",function(n){var o,a,u=r9(e);if(s||i.track(ry,((o={})[rT]=r7(e.id),o[rP]=r7(e.name),o[rO]=u,o)),s=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0)if("function"==typeof t.shouldTrackSubmit&&"u">typeof SubmitEvent&&n instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(n))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.");i.track(rb,((a={})[rT]=r7(e.id),a[rP]=r7(e.name),a[rO]=u,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(s)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=(0,ez.getGlobalScope)())?s.addEventListener("load",o):r.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},r7=function(e){if("string"==typeof e)return e},r9=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},ne=function(){var e,t=[],r=function(e,r,n){e.addEventListener(r,n),t.push({element:e,type:r,handler:n})},n=function(){t.forEach(function(e){var t=e.element,r=e.type,n=e.handler;null==t||t.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,n){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,ey.__generator)(this,function(s){return i=function(){if(!n)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 i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&r(e,"click",function(){var r;s&&n.track(r_,((r={})[rE]=s,r[rk]=t.pathname,r[rI]=e.id,r[rx]=e.text,r[rC]=e.href,r))})},o=/\.(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)(\?.+)?$/;
1Array.from(document.getElementsByTagName("a")).forEach(i),"u">typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,ez.getGlobalScope)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return null==e||e.disconnect(),n(),[2]})})}}},nt=!1,nr=function(e){nt||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."),nt=!0)},nn=function(){var e=(0,ez.getGlobalScope)(),t=[],r=function(r,n){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(r,n),t.push({type:r,handler:n}))},n=function(){t.forEach(function(t){var r=t.type,n=t.handler;null==e||e.removeEventListener(r,n)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(n){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(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return n(),[2]})})}}};function ni(e,t,r){var n,i,o=[];try{for(var s=(0,ey.__values)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var u=a.value;try{o.push(new RegExp(u))}catch(e){r.loggerProvider.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return e.concat(o)}var no=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],ns="data-amp-track-",na=["div","span","h1","h2","h3","h4","h5","h6"];e.s(["DEFAULT_ACTION_CLICK_ALLOWLIST",0,na,"DEFAULT_CSS_SELECTOR_ALLOWLIST",0,no,"DEFAULT_DATA_ATTRIBUTE_PREFIX",0,ns,"DEFAULT_EXPOSURE_DURATION",0,150],600049);var nu="https://app.amplitude.com",nl={US:nu,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},nc="__AMPLITUDE_MESSENGER_INSTANCE__",nd="__AMPLITUDE_MESSENGER__",nf=function(){function e(e){var t=(void 0===e?{}:e).origin;this[Y]=!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?nu:t}return e.prototype.notify=function(e){var t,r,n,i;null==(r=null==(t=this.logger)?void 0:t.debug)||r.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(n=window.opener)?void 0:n.postMessage)||i.call(n,e,this.endpoint)},e.prototype.sendRequest=function(e,t,r){var n=this;void 0===r&&(r={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise(function(t,s){n.requestCallbacks[i]={resolve:t,reject:s},n.notify(o),r.timeout>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete n.requestCallbacks[i]},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==(o=null==(i=this.logger)?void 0:i.warn)||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var r,n,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,ey.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}}},e.prototype.loadScriptOnce=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n;return(0,ey.__generator)(this,function(i){switch(i.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 n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(e)})}),null==(n=document.head)||n.appendChild(i)}catch(e){r(e)}})).then(function(){}),this.scriptLoadPromises.set(e,r),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r];case 2:return i.sent(),[3,4];case 3:throw n=i.sent(),this.scriptLoadPromises.delete(e),n;case 4:return[2]}})})},e.prototype.setup=function(e){var t,r,n=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===nu&&(this.endpoint=s),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=n.logger)?void 0:t.debug)||r.call(t,"Message received: ",JSON.stringify(e)),n.endpoint===e.origin){var t,r,i,o,s,a=e.data,u=null==a?void 0:a.action;if(u)if("id"in a&&a.id)null==(o=null==(i=n.logger)?void 0:i.debug)||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),n.handleResponse(a
1);else{if("ping"===u)return void n.notify({action:"pong"});var l=n.actionHandlers.get(u);if(l)l(a.data);else{var c=null!=(s=n.pendingMessages.get(u))?s:[];c.push(a.data),n.pendingMessages.set(u,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=(0,ez.getGlobalScope)();(null==e?void 0:e[nd])===this&&delete e[nd]},e}();function nh(e){var t=(0,ez.getGlobalScope)(),r=null==t?void 0:t[nd];if("object"==typeof r&&null!==r&&nc in r&&!0===r[nc])return r;var n=new nf(e);return t&&(t[nd]=n),n}Y=nc;var np="__AMPLITUDE_BACKGROUND_CAPTURE__";function ng(e,t){var r;if(!0!==e[np]){e[np]=!0;var n=null!=(r=null==t?void 0:t.scriptUrl)?r:"https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",i=null,o=function(t,r){var n,i;"background-capture-complete"===t&&(null==(i=null==(n=e.logger)?void 0:n.debug)||i.call(n,"Background capture complete"),e.notify({action:"background-capture-complete",data:r}))};e.registerActionHandler("initialize-background-capture",function(){null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Initializing background capture (external script)");var t,r,s=new URL(n,e.endpoint).toString();e.loadScriptOnce(s).then(function(){var t,r,n;null==(r=null==(t=e.logger)?void 0:t.debug)||r.call(t,"Background capture script loaded (external)"),i=null==(n=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:n.call(window,{messenger:e,onBackgroundCapture:o}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null==(e=null==i?void 0:i.close)||e.call(i),i=null})}}var nv=e.i(523072);function nm(e,t){return new nv.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 ny(e,t){return new nv.default(function(r){var n=!1,i=new Set,o=function(){var e,t;n=!0;try{for(var r=(0,ey.__values)(i),o=r.next();!o.done;o=r.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){n||r.next(e)},error:function(e){n||(n=!0,r.error(e),o())},complete:function(){i.delete(t),n||0!==i.size||(r.complete(),o(),n=!0)}});i.add(t)};return s(e),s(t),o})}function nb(e){var t=new Set,r=null;function n(){null==r||r.unsubscribe(),r=null,t.clear()}return new nv.default(function(i){return t.add(i),null===r&&(r=e.subscribe({next:function(e){try{for(var r,n,i,o=(0,ey.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.next)||i.call(a,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},error:function(e){try{for(var r,i,o,s=(0,ey.__values)(t),a=s.next();!a.done;a=s.next()){var u=a.value;null==(o=u.error)||o.call(u,e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}n()},complete:function(){try{for(var e,r,i,o=(0,ey.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.complete)||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}n()}})),function(){t.delete(i),0===t.size&&r&&(r.unsubscribe(),r=null)}})}var n_="1.25.1",nw="[Amplitude] Element Clicked",nS="[Amplitude] Element Tag",nE="[Amplitude] Element Text",nk="[Amplitude] Page URL",nI="[Amplitude] Viewport Height",nx="[Amplitude] Viewport Width",nC="[Amplitude] Page View ID",nT="data-amp-mask-attributes",nP=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},nO=function(e,t){var r=e;try{r=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return r},nA=["input","select","textarea"],nR=function(e,t){var r,n=null==(r=null==window?void 0:window.getComputedStyle)?void 0:r.call(window,e);return(null==n?void 0:n.getPropertyValue("cursor"))==="pointer"&&"click"===t},nD=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&nP(window.location.href,r))&&!!nP(window.location.href,t)},nM=function(e,t,r){return void 0===r&&(r=!1),function(n,i){var o,s,a=e.shouldTrackEventResolver,u=null==(s=null==(o=null==i?void 0:i.tagName)?void 0:o.toLowerCase)?void 0:s.call(o);if(!u)return!1;if(a)return a(n,i);if(!nD(e))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var c=nR(i,n);if(r&&c)return!0;
1if(t&&!t.some(function(e){var t;return!!(null==(t=null==i?void 0:i.matches)?void 0:t.call(i,e))}))return!1;switch(u){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:if(c)return!0;return"click"===n}}},nN=function(e){var t,r,n,i=null==(r=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:r.call(t),o=e instanceof HTMLElement&&(null==(n=e.getAttribute("contenteditable"))?void 0:n.toLowerCase())==="true";return!nA.includes(i)&&!o},nL=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return null!=n&&("object"!=typeof n||0!==Object.keys(n).length)&&("string"!=typeof n||0!==n.trim().length)&&(t[r]=n),t},{})},nU=function(){var e;try{var t=(0,ez.getGlobalScope)(),r=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!r)return;var n=JSON.parse(r);if("string"==typeof n.pageViewId)return n.pageViewId}catch(e){}},nq=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:nq(null==e?void 0:e.parentElement,t):null},nj=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};(h=Z||(Z={}))[h.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",h[h.MIDDLE=1]="MIDDLE",h[h.RIGHT=2]="RIGHT";var nF="__AMPLITUDE_VISUAL_TAGGING__",nB=nv,nV=(0,ez.getGlobalScope)(),nK=null==nV?void 0:nV.console,nz={},nW={},nH=!1,nG=function(e,t){if(!nK||"function"!=typeof nK[e]||!nW[e]&&(nW[e]=nK[e],nK[e]=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{if(nz[e]&&!nH){nH=!0;var n=nz[e];n&&n.forEach(function(r){try{r(e,t)}catch(e){}})}}catch(e){}return nH=!1,nW[e].apply(nK,t)},0))return Error("Console override failed");nz[e]?nz[e].push(t):nz[e]=[t]},n$=function(e){var t,r;try{for(var n=(0,ey.__values)(Object.values(nz)),i=n.next();!i.done;i=n.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},nJ=(0,ez.getGlobalScope)(),nX=function(){return new nB.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()}})},nQ=function(e){return void 0===e&&(e="click"),new nB.default(function(t){var r,n=function(e){t.next(e)};return null==(r=(0,ez.getGlobalScope)())||r.document.addEventListener(e,n,{capture:!0}),function(){var t;null==(t=(0,ez.getGlobalScope)())||t.document.removeEventListener(e,n,{capture:!0})}})},nY=function(){var e=ny(new nB.default(function(e){var t=function(t){if(t instanceof ErrorEvent){var r={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?r=(0,ey.__assign)((0,ey.__assign)({},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 nJ.addEventListener("error",t),function(){nJ.removeEventListener("error",t)}}),new nB.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 nJ.addEventListener("unhandledrejection",t),function(){nJ.removeEventListener("unhandledrejection",t)}}));return ny(e,new nB.default(function(e){var t=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=void 0;Array.isArray(r[0])&&"string"==typeof r[0][0]&&(i=r[0][0]),e.next({kind:"console",message:i})};return nG("error",t),function(){n$(t)}}))},nZ=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},n0=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){}},n1=function(e,t,r){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=r.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}})},n2={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},n3=function(e){var t,r,n,i,o=Object.values(n2).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,ey.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(n=void 0,(0,ey.__values)(u.definition)),c=l.next();!c.done;c=l.next()){var d=n2[c.value.event_type];d&&o[d].add(u.id)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},n4=function(e){var t,r,n,i,o=new Map;try{for(var s=(0,ey.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(n=void 0,(0,ey.__values)(u.conditions)),c=l.next();!c.done;c=l.next()){var d=c.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,h=o.get(f);h||(h=[],o.set(f,h)),h.push(u)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return o},n5=function(e,t){var r,n,i,o,s=new Set;try{for(var a=(0,ey.__values)(e),u=a.next();!u.done;u=a.next()){var l=u.value,c=t.get(l.id);if(c)try{for(var d=(i=void 0,(0,ey.__values)(c)),f=d.next();!f.done;f=d.next()){var h=f.value;s.add(h)}}catch(e){i={error:e}}
1finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Array.from(s)},n6=function(){function e(e,t,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=r,this.options=n}return e.prototype.evaluate=function(e){var t,r,n=this.options.pageActions;if(!n)return e;var i=n5(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return n.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return n2[t.event_type]===e.type&&t.filters.every(function(t){return nZ(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,ey.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;n1(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}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}(),n8=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",nT,rG]),n7=["type"],n9=["svg","path","g"],ie=["password","hidden"],it=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),ir=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=ii(n,!!t,n===e);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},ii=function(e,t,r){if(e.nodeType!==Node.ELEMENT_NODE)return null;var n,i,o=e.getAttribute("id");if(t){if(o)return new it(c(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new it(s,!0)}var a=e.tagName.toLowerCase();if(o)return new it(a+c(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new it(a,!0);function l(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=l(e),f=!1,h=!1,p=-1,g=-1,v=u.children,m=0;v&&(-1===p||!h)&&m<v.length;++m){var y=v[m];if(y.nodeType===Node.ELEMENT_NODE){if(g+=1,y===e){p=g;continue}if(!h&&y.tagName.toLowerCase()===a){f=!0;var b=new Set(d);if(!b.size){h=!0;continue}for(var _=l(y),w=0;w<_.length;++w){var S=_[w];if(b.has(S)&&(b.delete(S),!b.size)){h=!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")||"")+"]"),h)E+=":nth-child("+String(p+1)+")";else if(f)try{for(var k=(0,ey.__values)(d),I=k.next();!I.done;I=k.next()){var x=I.value;E+="."+CSS.escape(x.slice(1))}}catch(e){n={error:e}}finally{try{I&&!I.done&&(i=k.return)&&i.call(k)}finally{if(n)throw n.error}}return new it(E,!1)},io=function(e,t){var r,n,i,o=this;this.replaceSensitiveString=function(e){return rY(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,r,n,i,s=performance.now(),a=[];if(!e)return[];for(var u=function(e){var t=[];if(!e)return t;
1t.push(e);for(var r=e.parentElement;r&&"HTML"!==r.tagName;)t.push(r),r=r.parentElement;return t}(e),l=new Map,c=u.length-1;c>=0;c--){var d=u[c];if(d){var f,h=(f=d.getAttribute(nT))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],p=c===u.length-1?[]:null!=(n=l.get(u[c+1]))?n:new Set,g=new Set((0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(p),!1),(0,ey.__read)(h),!1));l.set(d,g)}}a=u.map(function(e){var t;return function(e,t){if(null===e)return null;var r,n,i,o,s,a,u=String(e.tagName).toLowerCase(),l={tag:u},c=Array.from(null!=(o=null==(i=e.parentElement)?void 0:i.children)?o:[]);c.length&&(l.index=c.indexOf(e),l.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(s=e.previousElementSibling)?void 0:s.tagName)?void 0:a.toLowerCase();d&&(l.prevSib=String(d));var f=e.getAttribute("id");f&&(l.id=String(f));var h=Array.from(e.classList);h.length&&(l.classes=h);var p={},g=Array.from(e.attributes).filter(function(e){return!n8.has(e.name)}),v=!nN(e);if(!ie.includes(String(e.getAttribute("type")))&&!n9.includes(u))try{for(var m=(0,ey.__values)(g),y=m.next();!y.done;y=m.next()){var b=y.value;if(!v||n7.includes(b.name)){if(t.has(b.name)){p[b.name]=r$;continue}p[b.name]=String(b.value).substring(0,128)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}return Object.keys(p).length&&(l.attrs=p),l}(e,null!=(t=l.get(e))?t:new Set)});var v=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var r=(0,ey.__read)(t,2),n=r[0],i=r[1];e.attrs&&(e.attrs[n]=o.replaceSensitiveString(i))})};try{for(var m=(0,ey.__values)(a),y=m.next();!y.done;y=m.next()){var b=y.value;v(b)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(t)throw t.error}}var _=performance.now();return null==(i=o.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",_-s),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?o.getText(t):o.getNearestLabel(r)},this.getElementPath=function(e){if(!e)return"";var t,r=performance.now(),n=ir(e),i=performance.now();return null==(t=o.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",i-r),n},this.getEventProperties=function(e,t,r){var n,i,s,a,u=null==(s=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:s.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),d=null==(a=c[0])?void 0:a.attrs,f=o.getNearestLabel(t),h=Object.entries(null!=d?d:{}).reduce(function(e,t){var n=(0,ey.__read)(t,2),i=n[0],o=n[1];if(i.startsWith(r)){var s=i.replace(r,"");s&&(e[s]=o||"")}return e},{}),p=((n={})["[Amplitude] Element Hierarchy"]=c,n[nS]=u,n[nE]=o.getText(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Attributes"]=h,n["[Amplitude] Element Path"]=o.getElementPath(t),n["[Amplitude] Element Parent Label"]=f,n[nk]=nO(window.location.href.split("?")[0]),n["[Amplitude] Page Title"]=rZ(o.replaceSensitiveString),n[nI]=window.innerHeight,n[nx]=window.innerWidth,n),g=nU();if(g&&(p[nC]=g),p["[Amplitude] Element ID"]=t.getAttribute("id")||"",p["[Amplitude] Element Class"]=t.getAttribute("class"),p["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===u&&"click"===e&&t instanceof HTMLAnchorElement){var v=t.href.substring(0,128);p["[Amplitude] Element Href"]=o.replaceSensitiveString(v)}return nL(p)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,r,n,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&nR(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,n),s;var a=nq(s.event.target,r);a&&(s.closestTrackedAncestor=a,s.targetElementProperties=o.getEventProperties(s.type,a,n))}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var r=n0(e,t);if(r){if("TEXT"===e.elementExtractType)return o.getText(r);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return r.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,r,n="[".concat(rG,"], [contenteditable]");if(!e.querySelector(n))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=(0,ey.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(rG)||l.hasAttribute("contenteditable")){i+=r$;continue}i+=o.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},this.getText=function(e){if(null!==e.closest("[".concat(rG,"]")))return r$;var t="";return t=e.querySelector("[".concat(rG,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveStr
1ing(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,r,n,i=null==(n=null==(r=null==e?void 0:e.tagName)?void 0:r.toLowerCase)?void 0:n.call(r);return nL(((t={})[nS]=i,t[nE]=o.getText(e),t[nk]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var s=null!=(i=e.maskTextRegex)?i:[],a=[];try{for(var u=(0,ey.__values)(s),l=u.next();!l.done;l=u.next()){var c=l.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{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}this.additionalMaskTextPatterns=a},nB=nv;(p=ee||(ee={})).ClickObservable="clickObservable",p.ChangeObservable="changeObservable",p.NavigateObservable="navigateObservable",p.MutationObservable="mutationObservable",p.ScrollObservable="scrollObservable",p.ExposureObservable="exposureObservable",p.BrowserErrorObservable="browserErrorObservable",p.SelectionObservable="selectionObservable",p.MouseMoveObservable="mouseMoveObservable";var is=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",n_);var r,n,i,o,s,a,u,l,c,d,f,h,p,g=e.dataAttributePrefix,v=void 0===g?ns:g,m=e.visualTaggingOptions,y=void 0===m?{enabled:!0}:m;e.cssSelectorAllowlist=null!=(r=e.cssSelectorAllowlist)?r:no,e.actionClickAllowlist=null!=(n=e.actionClickAllowlist)?n:na,e.debounceTime=null!=(i=e.debounceTime)?i:0;var b=(null==(o=e.viewportContentUpdated)?void 0:o.enabled)!==!1,_=null!=(u=null!=(a=null==(s=e.viewportContentUpdated)?void 0:s.exposureDuration)?a:e.exposureDuration)?u:150;e.viewportContentUpdated=(0,ey.__assign)((0,ey.__assign)({},e.viewportContentUpdated),{exposureDuration:_}),e.pageUrlExcludelist=null==(l=e.pageUrlExcludelist)?void 0:l.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 io(e,t),k=new Set,I=new Set,x=function(){var t,r,n,i=nb(nQ().map(function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,v)})),o=nb(new nB.default(function(t){var r,n=function(r){var n=E.addAdditionalEventProperties(r,"change",e.cssSelectorAllowlist,v);t.next(n)};return null==(r=(0,ez.getGlobalScope)())||r.document.addEventListener("change",n,{capture:!0}),function(){var e;return null==(e=(0,ez.getGlobalScope)())?void 0:e.document.removeEventListener("change",n)}}));window.navigation&&(n=nb(new nB.default(function(t){var r=function(r){var n=E.addAdditionalEventProperties(r,"navigate",e.cssSelectorAllowlist,v);t.next(n)};return window.navigation.addEventListener("navigate",r),function(){window.navigation.removeEventListener("navigate",r)}})));var s=nb(nX().map(function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,v)})),a=new nB.default(function(e){var t,r=function(t){e.next(t)};return null==(t=(0,ez.getGlobalScope)())||t.addEventListener("scroll",r),function(){var e;null==(e=(0,ez.getGlobalScope)())||e.removeEventListener("scroll",r)}}),u=(t=e.cssSelectorAllowlist,new nB.default(function(e){var r,n=(0,ez.getGlobalScope)();if(!(null==n?void 0:n.IntersectionObserver))return function(){};var i=new IntersectionObserver(function(t){t.forEach(function(t){e.next(t)})},{root:null,rootMargin:"0px",threshold:1}),o=t.join(",");(null!=(r=null==n?void 0:n.document.querySelectorAll(o))?r:[]).forEach(function(e){i.observe(e)});var a=s.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){e instanceof Element&&(e.matches(o)&&i.observe(e),e.querySelectorAll(o).forEach(function(e){i.observe(e)}))})})});return function(){a.unsubscribe(),i.disconnect()}}));return(r={})[ee.ChangeObservable]=o,r[ee.ClickObservable]=i,r[ee.MutationObservable]=s,r[ee.NavigateObservable]=n,r[ee.ScrollObservable]=a,r[ee.ExposureObservable]=u,r},C=n3(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),T=n4(null!=(h=null==(f=e.pageActions)?void 0:f.triggers)?h:[]),P=new n6(C,T,E,e),O=function(t){var r,n;t&&(e.pageActions=(0,ey.__assign)((0,ey.__assign)({},e.pageActions),t),C=n3(Object.values(null!=(r=e.pageActions.labeledEvents)?r:{})),T=n4(null!=(n=e.pageActions.triggers)?n:[]),P.update(C,T,e))};return{name:w,type:"enrichment",setup:function(t,r){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var n,i,o,s,a,u,l,c,d,f,h,g,m,C,T,A,R,D,M,N,L;return(0,ey.__generator)(this,function(U){var q,j,F,B,V,K,z,W,H,G,$,J,X,Q,Y,Z,et,er,en,ei,eo,es,ea,eu,el,ec,ed,ef,eh,ep,eg,ev,em,eb,e_,ew,eS,eE,ek;return"u"<typeof document?[2]:(n=!1,i={maxX:void 0,maxY:void 0},t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){O(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),o=nM(e,e.cssSelectorAllowlist),s=nM(e,e.actionClickAllowlist),j=(q={allObservables:a=x(),amplitude:r,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,F=q.allObservables,B=q.shouldTrackEvent,V=q.evaluateTriggers,u=F.clickObservable.filter(nj).filter(function(e){return B("click",e.closestTrackedAncestor)}).map(function(e){return V(e)}).subscribe(function(e){null==j||j.track(nw,e.targetElementProperties)}),S.push(u),z=(K={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(e),!1),[v],!1))},amplitude:r,shouldTrackEvent:o,evaluateTriggers:P.evaluate.bind(P)}).amplitude,W=K.allObservables,H=K.getEventProperties,G=K.shouldTrackEvent,$=K.evaluateTriggers,l=W.changeObservable.filter(nj).filter(function(e){return G("change",e.closestTrackedAncestor)}).map(function(e){return $(e)}).subscribe(function(e){null==z||z.track("[Amplitude] Element Changed",H("change",e.closestTrackedAncestor))}),S.push(l),X=(J={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(e),!1),[v],!1))},amplitude:r,shouldTrackEvent:o,shouldTrackActionClick:s}).amplitude,Q=J.allObservables,Y=J.options,Z=J.getEventProperties,et=J.shouldTrackEvent,er=J.shouldTrackActionClick,en=Q.clickObservable,ei=Q.mutationObservable,eo=Q.navigateObservable,es=en.filter(function(e){return!et("click",e.closestTrackedAncestor)}).map(function(e){var t=nq(e.event.target,Y.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=Z(e.type,e.closestTrackedAncestor)),e}).filter(nj).filter(function(e){return er("click",e.closestTrackedAncestor)}),ea=eo?ny(ei,eo):ei,eu=ny(es,ea),el=null,ec=null,(c=nm(eu,function(e){if(el&&(clearTimeout(el),el=null),"click"===e.type)ec=e,el=setTimeout(function(){el=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==X||X.track(nw,Z("click",e.closestTrackedAncestor)))}))&&S.push(c),(ed={allObservables:a,amplitude:r}).amplitude,ef=ed.allObservables.scrollObservable,eh={maxX:0,maxY:0},ep=ef.subscribe(function(){var e,t,r,n,i=(0,ez.getGlobalScope)(),o=Math.floor(null!=(t=null!=(e=null==i?void 0:i.scrollX)?e:null==i?void 0:i.pageXOffset)?t:0),s=Math.floor(null!=(n=null!=(r=null==i?void 0:i.scrollY)?r:null==i?void 0:i.pageYOffset)?
1n:0);eh.maxX=Math.max(eh.maxX,o),eh.maxY=Math.max(eh.maxY,s)}),d={unsubscribe:function(){ep.unsubscribe()},getState:function(){return eh},reset:function(){eh.maxX=0,eh.maxY=0}},S.push(d),f={},h=(0,ez.getGlobalScope)(),g=function(e){e&&n||(setTimeout(function(){n=!1},100),n=!0,function(e){var t,r,n,i,o=e.amplitude,s=e.scrollTracker,a=e.currentElementExposed,u=e.elementExposedForPage,l=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=s.getState(),h=(0,ez.getGlobalScope)(),p=null!=(r=null==h?void 0:h.innerWidth)?r:0,g=null!=(n=null==h?void 0:h.innerHeight)?n:0,v=((t={})[nk]=null==(i=null==h?void 0:h.location)?void 0:i.href,t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+g,t[nI]=g,t[nx]=p,t["[Amplitude] Element Exposed"]=Array.from(a),t),m=nU();if(m&&(v[nC]=m),0===a.size&&f.maxX===d.maxX&&f.maxY===d.maxY){c&&(s.reset(),u.clear(),null==l||l.reset());return}null==o||o.track("[Amplitude] Viewport Content Updated",v),d.maxX=f.maxX,d.maxY=f.maxY,a.clear(),c&&(s.reset(),u.clear(),null==l||l.reset())}({amplitude:r,scrollTracker:d,currentElementExposed:I,elementExposedForPage:k,exposureTracker:f.exposure,isPageEnd:e,lastScroll:i}))},m=function(e){!k.has(e)&&(k.add(e),I.add(e),JSON.stringify(Array.from(I)).length>=18e3&&g(!1))},b&&(ev=(eg={allObservables:a,onExposure:m,dataExtractor:E,exposureDuration:_}).allObservables,em=eg.onExposure,eb=eg.dataExtractor,ew=void 0===(e_=eg.exposureDuration)?150:e_,eS=new Map,eE=new Map,ek=ev.exposureObservable.subscribe(function(e){var t=e.target;if(e.isIntersecting){if(!eS.get(t)){var r=setTimeout(function(){eS.set(t,!0),em(eb.getElementPath(t)),eE.set(t,null)},ew);eE.set(t,r)}}else if(!e.isIntersecting&&e.intersectionRatio<1){var r=eE.get(t);r&&(clearTimeout(r),eE.set(t,null))}}),f.exposure={unsubscribe:function(){ek.unsubscribe()},reset:function(){eE.forEach(function(e){e&&clearTimeout(e)}),eE.clear(),eS.clear()}},f.exposure&&S.push(f.exposure),C=function(){g(!0)},null==h||h.addEventListener("beforeunload",C),p=function(){null==h||h.removeEventListener("beforeunload",C)},S.push({unsubscribe:function(){return p()}}),(T=a[ee.NavigateObservable])?S.push(T.subscribe(function(){g(!0)})):h&&(A=function(){g(!0)},h.addEventListener("popstate",A),R=h.history.pushState,h.history&&R&&(h.history.pushState=new Proxy(R,{apply:function(e,t,r){var n=(0,ey.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),g(!0)}})),S.push({unsubscribe:function(){h.removeEventListener("popstate",A),h.history&&R&&(h.history.pushState=R)}}))),null==(L=null==t?void 0:t.loggerProvider)||L.log("".concat(w," has been successfully added.")),window.opener&&y.enabled&&(D=e.cssSelectorAllowlist,M=e.actionClickAllowlist,!function(e,t){if(!0!==e[nF]){e[nF]=!0;var r=t.dataExtractor,n=t.isElementSelectable,i=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,a=function(t){e.notify({action:"element-selected",data:t})},u=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 l;s=null==(l=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:l.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!n||n((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:n_}}}),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==s?void 0:s.close)||e.call(s)})}}(N=nh(),{dataExtractor:E,isElementSelectable:nM(e,(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(D),!1),(0,ey.__read)(M),!1)),cssSelectorAllowlist:D,actionClickAllowlist:M}),ng(N),N.setup((0,ey.__assign)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:nl[t.serverZone]}))),[2])})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,ey.__generator)(this,function(i){try{for(t=(e=(0,ey.__values)(S)).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]})})}}},nB=nv,ia=(0,ey.__spreadArray)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,ey.__read)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),iu=["*"],il=["mutation","navigate"];function ic(e,t){var r,n,i,o,s=t.event,a=s.pageX,u=s.pageY;e.yMin=Math.min(null!=(r=e.yMin)?r:u,u),e.yMax=Math.max(null!=(n=e.yMax)?n:u,u),e.xMin=Math.min(null!=(i=e.xMin)?i:a,a),e.xMax=Math.max(null!=(o=e.xMax)?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function id(e){if(0===e.length)return null;var t=e[0],r=e[e.length-1];return{rageClickEvent:(0,ey.__assign)({"[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 nB=nv;(g=et||(et={})).INCREASING="increasing",g.DECREASING="decreasing",(v=er||(er={})).X="x",v.Y="y";var ih=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new nB.default(function(e){var r=null,n=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};if(null===r){r=o;return}o.x>r.x?(n===et.DECREASING&&e.next(er.X),n=et.INCREASING):o.x<r.x&&(n===et.INCREASING&&e.next(er.X),n=et.DECREASING),o.y>r.y?(i===et.DECREASING&&e.next(er.Y),i=et.INCREASING):o.y<r.y&&(i===et.INCREASING&&e.next(er.Y),i=et.DECREASING),r=o})})};function ip(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;return!(t.length<r)&&t[t.length-1]-t[0]<n}function ig(e){e.changes=[],e.startTime=void 0}function iv(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length&&!(i-t[n]<r);n++);0!==n&&(e.startTime=t[n],e.changes.splice(0,n))}var im=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=void 0===r?20:r,i=e.thresholdMs,o=void 0===i?2e3:i;return new nB.default(function(e){var r={changes:[],changesThreshold:n,thresholdMs:o},i={changes:[],changesThreshold:n,thresholdMs:o},s=void 0,a=null;function u(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),ig(r),ig(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===er.X?r:i,n=+Date.now(),t.startTime=t.startTime||n,l=t.changes,c=t.changesThreshold,l.push(n),l.length>c&&l.shift();var t,n,l,c,d=function(e,t){var r=void 0;if(ip(e)&&(r=e.startTime),ip(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}(r,i);return d?(s=s||d,a=setTimeout(function(){u(),a=null},o)):u(),iv(r),iv(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},iy=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return im({mouseDirectionChangeObservable:ih({allWindowObservables:n}),directionChanges:void 0===i?20:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){nD(r)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function ib(e,t,r,n){if(!n)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var i_=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-frustration-browser",n=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,s=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var u=ib(e,"rageClicks",iu,s),l=ib(e,"deadClicks",ia,o),c=ib(e,"errorClicks",ia,i),d=null!=(t=e.dataAttributePrefix)?t:ns,f=new io(e),h=(0,ey.__spreadArray)([],(0,ey.__read)(new Set((0,ey.__spreadArray)((0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(u),!1),(0,ey.__read)(l),!1),(0,ey.__read)(c),!1))),!1),p=function(){var e,t,r=nb(n
1Q("pointerdown").map(function(e){return f.addAdditionalEventProperties(e,"click",h,d,!0)})),n=nb(nY().map(function(e){return f.addTypeAndTimestamp(e,"error")})),i=nb(nX().map(function(e){return f.addAdditionalEventProperties(e,"mutation",h,d)}));window.navigation&&(t=nb(new nB.default(function(e){var t=function(t){e.next((0,ey.__assign)((0,ey.__assign)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return f.addAdditionalEventProperties(e,"navigate",h,d)})));var o=nb(new nB.default(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var r=void 0,n=void 0;try{if(r=t.selectionStart,n=t.selectionEnd,r===n)return}catch(e){return}return e.next()}var i=window.getSelection();if(i&&!i.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),s=nb(new nB.default(function(e){var t=function(t){e.next(t)},r={capture:!0};return nJ.document.addEventListener("mousemove",t,r),function(){nJ.document.removeEventListener("mousemove",t,r)}}));return(e={})[ee.ClickObservable]=r,e[ee.MutationObservable]=i,e[ee.NavigateObservable]=t,e[ee.BrowserErrorObservable]=n,e[ee.SelectionObservable]=o,e[ee.MouseMoveObservable]=s,e};return{name:r,type:"enrichment",setup:function(t,h){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var g,v,m,y,b,_,w,S;return(0,ey.__generator)(this,function(E){var k,I,x,C,T,P,O,A,R,D,M,N,L,U,q,j,F,B,V,K,z,W;return"u"<typeof document?[2]:(g=p(),s&&(v=function(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.clickObservable,s=n.selectionObservable,a=[],u={},l=null;function c(e){a=[],u={},e&&(ic(u,e),a.push(e))}var d=nm(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,ey.__awaiter)(t,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){var n,i,o,s;return(ic(u,e),t=null,0===a.length||(n=a).length>0&&n[n.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=a).length-4+1),s=i[o],e.timestamp-s.timestamp>=1e3)||u.isOutOfBounds)?(l&&(t=id(a)),c(e)):a.push(e),(l&&(clearTimeout(l.timerId),l.resolve(t),l=null),a.length>=4)?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(id(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){c()}),h=d.subscribe(function(e){null!==e&&r.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==f||f.unsubscribe()}}}({allObservables:g,amplitude:h,shouldTrackRageClick:nM(e,u)}),n.push(v)),o&&(I=(k={amplitude:h,allObservables:g,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:nM(e,l)}).amplitude,x=k.allObservables,C=k.getEventProperties,T=k.shouldTrackDeadClick,P=x.clickObservable,O=x.mutationObservable,A=x.navigateObservable,R=P.filter(function(e){return nj(e)&&T("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Z.LEFT_OR_TOUCH_CONTACT}),D=A?ny(O,A):O,M=ny(R,D),N=null,m=nm(M,function(e){if(N&&il.includes(e.type))clearTimeout(N),N=null;else if("click"===e.type)return N?Promise.resolve(null):new Promise(function(t){N=setTimeout(function(){t(e),N=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};I.track("[Amplitude] Dead Click",(0,ey.__assign)((0,ey.__assign)({},C("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),n.push(m)),i&&(U=(L={amplitude:h,allObservables:g,shouldTrackErrorClick:nM(e,c)}).amplitude,q=L.allObservables,j=L.shouldTrackErrorClick,F=q.clickObservable,B=q.browserErrorObservable,V=F.filter(function(e){return nj(e)&&j("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Z.LEFT_OR_TOUCH_CONTACT}),K=null,z=null,W=function(){null!==K&&(clearTimeout(K),K=null),z=null},y=ny(V,B).subscribe(function(e){var t;if("click"===e.type){W(),z=e,K=setTimeout(W,2e3);return}"error"===e.type&&z&&(U.track("[Amplitude] Error Click",(0,ey.__assign)(((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),z.targetElementProperties)),W())}),n.push(y)),a&&(b=void 0,_=void 0,"object"==typeof e.thrashedCursor&&(b=e.thrashedCursor.directionChanges,_=e.thrashedCursor.threshold,b&&b<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(b," is below the minimum of ").concat(5,", setting to ").concat(5)),b=5),_&&_>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(_," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),_=4e3)),w=iy({amplitude:h,options:e,allObservables:g,directionChanges:b,thresholdMs:_}),n.push(w)),null==(S=null==t?void 0:t.loggerProvider)||S.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,ey.__generator)(this,function(o){try{for(t=(e=(0,ey.__values)(n)).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]})})}}};function iw(e,t,r){e&&function e(t){var r,n,i=t.json,o=t.targetObject,s=t.allowlist,a=t.excludelist,u=t.ancestors,l=t.parentObject,c=t.targetKey;o||(o=i);var d=Object.keys(o);try{for(var f=(0,ey.__values)(d),h=f.next();!h.done;h=f.next()){var p,g=h.value,v=(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(u),!1),[g],!1);(p=o[g],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!iE(v,s)||iE(v,a))&&delete o[g]:e({json:i,targetObject:o[g],allowlist:s,excludelist:a,ancestors:v,parentObject:o,targetKey:g})}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}0===Object.keys(o).length&&l&&c&&delete l[c]}({json:e,allowlist:t.map(iS),excludelist:r.map(iS),ancestors:[]})}function iS(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function iE(e,t){return t.some(function(t){return function e(t,r,n,i){if(void 0===n&&(n=0),void 0===i&&(i=0),i===r.length)return n===t.length;if(n===t.length){for(;i<r.length&&"**"===r[i];)i++;return i===r.length}var o=r[i];if("**"===o){if(i+1===r.length)return!0;for(var s=n;s<=t.length;s++)if(e(t,r,s,i+1))return!0;return!1}return("*"===o||o===t[n])&&e(t,r,n+1,i+1)}(e,t)})}var ik=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,r,n=this.request.headers,i={};if(Array.isArray(n))n.forEach(function(e){var t=(0,ey.__read)(e,2),r=t[0],n=t[1];i[r]=n});else if(n instanceof Headers)n.forEach(function(e,t){i[t]=e});else if("object"==typeof n&&null!==n)try{for(var o=(0,ey.__values)(Object.entries(n)),s=o.next();!s.done;s=o.next()){var a=(0,ey.__read)(s.value,2),u=a[0],l=a[1];i[u]=l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return iA(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,ez.getGlobalScope)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=ix(t,100),this._bodySize}}
1,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=[]),(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return 0===e.length?[2,null]:[2,iP(this.body,e,t)]})})},e}(),iI=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),iA(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return ix(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=[]),(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return 0===e.length?[2,null]:[2,iP(this.body,e,t)]})})},e}();function ix(e,t){var r,n,i,o,s=(0,ez.getGlobalScope)(),a=null==s?void 0:s.TextEncoder;if(a){if("string"==typeof e)o=e,i=new a().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if(e instanceof FormData){var u=0,l=0;try{for(var c=(0,ey.__values)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,ey.__read)(d.value,2),h=f[0],p=f[1];if(u+=h.length,"string"==typeof p)u+=new a().encode(p).length;else{if(!(p instanceof Blob))return;u+=p.size}if(++l>=t)return}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i=u}else if(e instanceof ReadableStream){o=e;return}return i}}var iC=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,n={};return null==(t=null==r?void 0:r.forEach)||t.call(r,function(e,t){n[t]=e}),iA(n,{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"),n=r?parseInt(r,10):void 0;return this._bodySize=n,n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(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=[]),(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,iP(r.sent(),e,t)]}})})},e}(),iT=function(){function e(e,t,r,n){this.statusCode=e,this.headersString=t,this.size=r,this.getJson=n}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,n={},i=this.headersString.split("\r\n");try{for(var o=(0,ey.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,ey.__read)(a.split(": "),2),l=u[0],c=u[1];l&&c&&(n[l]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return iA(n,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,ey.__awaiter)(this,void 0,void 0,function(){var r;return(0,ey.__generator)(this,function(n){return 0===e.length?[2,null]:(r=this.getJson())?(iw(r,e,t),[2,r]):[2,null]})})},e}();function iP(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return iw(n,t,r),n}catch(e){return null}}(m=en||(en={})).REDACT="redact",m.REMOVE="remove";var iO="[REDACTED]",iA=function(e,t){var r,n,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?en.REMOVE:s,u=(0,ey.__spreadArray)([],(0,ey.__read)(eq),!1),l={};try{for(var c=(0,ey.__values)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var f=d.value;!function(t){var r=t.toLowerCase();u.find(function(e){return e.toLowerCase()===r})?a===en.REDACT&&(l[t]=iO):o.find(function(e){return e.toLowerCase()===r})?l[t]=e[t]:a===en.REDACT&&(l[t]=iO)}(f)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return l},iR=function(){function e(e,t,r,n,i,o,s,a,u,l,c){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=r,this.startTime=n,this.url=i,this.requestWrapper=o,this.status=s,this.duration=a,this.responseWrapper=u,this.error=l,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,r,n;
1return 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((0,ey.__spreadArray)([],(0,ey.__read)(eU),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(r=this.responseWrapper)?void 0:r.headers((0,ey.__spreadArray)([],(0,ey.__read)(eU),!1)),responseBodySize:null==(n=this.responseWrapper)?void 0:n.bodySize}).filter(function(e){var t=(0,ey.__read)(e,2);return void 0!==(t[0],t[1])}))},e}(),iD=function(e,t){void 0===t&&(t=eH()),this.callback=e,this.id=t};function iM(e){try{e()}catch(e){}}var iN=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=(0,ez.getGlobalScope)();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var e=(0,ez.getGlobalScope)();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var r,n,i,o,s,a,u,l,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null==(i=null==(n=null==(r=this.globalScope)?void 0:r.XMLHttpRequest)?void 0:n.prototype)?void 0:i.open,h=null==(a=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:a.send,p=null==(c=null==(l=null==(u=this.globalScope)?void 0:u.XMLHttpRequest)?void 0:l.prototype)?void 0:c.setRequestHeader;f&&h&&p&&this.observeXhr(f,h,p);var g=null==(d=this.globalScope)?void 0:d.fetch;g&&this.observeFetch(g),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){iM(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,n,i,o,s){if(void 0!==o&&void 0!==s){var a,u,l,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(u=t.url,d=t.method):u=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==r?void 0:r.method)||d,n&&(l=n.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var h=Math.floor(performance.now()-s),p=Math.floor(o+h),g=new iR(e,d,o,o,u,r,l,h,n,c,p);this.triggerEventCallbacks(g)}},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,n){return(0,ey.__awaiter)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){iM(function(){var t;return null==(t=s.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,n)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",r,n?new ik(n):void 0,i?new iC(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){iM(function(){var t;return null==(t=s.logger)?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},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&&iM(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,n){if(this.globalScope&&t&&r){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=(0,ey.__read)(r,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,ey.__assign)({method:s,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){iM(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,r)},i.send=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),r=new iT(i.status,e,t?parseInt(t,10):void 0,s),n=i.$$AmplitudeAnalyticsEvent.headers,l=new iI(a,n);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,r,void 0,u.startTime,u.durationStart)}catch(e){iM(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),r.apply(i,t)},i.setRequestHeader=function(e,t){try{var r=this.$$AmplitudeAnalyticsEvent;r&&(r.headers[e]=t)}catch(e){iM(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}n.apply(this,[e,t])}}},e}()),iL="[Amplitude] Network Request",nB=nv,iU="500-599";function iq(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function ij(e,t){var r,n,i=t.split(",");try{for(var o=(0,ey.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,ey.__read)(a.split("-").map(Number),2),l=u[0],c=u[1];if(e===l&&void 0===c||e>=l&&e<=c)return!0}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function iF(e){var t;if(e)try{var r=null==(t=(0,ez.getGlobalScope)())?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),s=n.href,a=n.host;n.hash="",n.search="";var u=n.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:u,host:a}}catch(e){return}}function iB(e){return"object"!=typeof e||null===e?e?(0,ey.__spreadArray)([],(0,ey.__read)(eU),!1):void 0:0!==e.length?e:void 0}function iV(e){var t,r;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)}(ei||(ei={})).NetworkObservable="networkObservable";var iK=function(e){void 0===e&&(e={});var t,r="@amplitude/plugin-network-capture-browser",n=function(){var e,r=new nB.default(function(e){var r=new iD(function(t){var r={event:t,timestamp:Date.now(),type:"network"};e.next(r)});return iN.subscribe(r,t),function(){iN.unsubscribe(r)}});return(e={})[ei.NetworkObservable]=r,e};return{name:r,type:"enrichment",setup:function(i,o){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var s;return(0,ey.__generator)(this,function(a){var u,l,c,d,f;return"u"<typeof document?[2]:(s=n(),t=null==i?void 0:i.loggerProvider,l=(u={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,c=u.networkTrackingOptions,d=u.amplitude,f=u.loggerProvider,eo=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var r,n,i=iF(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(iq(o,"*.amplitude.com")||iq(o,"amplitude.com"))||(null==(r=t.ignoreHosts)?void 0:r.find(function(e){return iq(o,e)})))&&(!!t.captureRules||void 0===e.status||!!ij(e.status,iU))&&(!t.captureRules||((0,ey.__spreadArray)([],(0,ey.__read)(t.captureRules),!1).reverse().find(function(t){if(n=function(e,t,r,n,i){if((!e.hosts||e.hosts.find(function(e){return iq(t,e)}))&&(!n||!e.urls||nP(n,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!r&&0!==r||!!ij(r,e.statusCodeRange||iU))&&!0}(t,o,e.status,e.url,e.method)){var r=iB(t.responseHeaders);if(e.responseWrapper&&r){var i=e.responseWrapper.headers(r);i&&(e.responseHeaders=i)}var s=iB(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}e.responseWrapper&&t.responseBody&&!iV(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!iV(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==n}),!!n))&&!(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===iL}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,r,n,i=e.event,o=iF(i.url);if(o){var s=null==(r=i.responseWrapper)?void 0:r.bodySize,a=null==(n=i.requestWrapper)?void 0:n.bodySize;!function(e,t,r,n){(0,ey.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,ey.__generator)(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(o=(i=ey.__read.apply(void 0,[a.sent(),2]))[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==n||n.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==n||n.debug("Failed to stringify response body")}a.label=2;case 2:return null==r||r.track(iL,e),[2]}})})}(((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t["[Amplitude] Request Headers"]=i.requestHeaders,t["[Amplitude] Response Headers"]=i.responseHeaders,t),i,d,f)}}),null==t||t.log("".concat(r," has been successfully added.")),[2])})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return eo.unsubscribe(),[2]})})}}},iz=e.i(906334);let iW=-1,iH=e=>{addEventListener("pageshow",t=>{t.persisted&&(iW=t.timeStamp,e(t))},!0)},iG=(e,t,r,n)=>{let i,o;return s=>{let a;t.value>=0&&(s||n)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,a=t.value,t.rating=a>r[1]?"poor":a>r[0]?"needs-improvement":"good",e(t))}},i$=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},iJ=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},iX=()=>{let e=iJ();return(null==e?void 0:e.activationStart)??0},iQ=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=iJ(),n="navigate";return iW>=0?n="back-forward-cache":r&&(document.prerendering||iX()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(0x82f79cd8fff*Math.random())+1e12}`,navigationType:n}},iY=new WeakMap;function iZ(e,t){return iY.get(e)||iY.set(e,new t),iY.get(e)}class i0{h(e){var t;if(e.hadRecentInput)return;let r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&e.startTime-n.startTime<1e3&&e.startTime-r.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}constructor(){(0,iz._)(this,"t",void 0),(0,iz._)(this,"i",0),(0,iz._)(this,"o",[])}}let i1=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let n=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return n.observe({type:e,buffered:!0,...r}),n}}catch{}},i2=e=>{let t=!1;return()=>{t||(e(),t=!0)}},i3=-1,i4=new Set,i5=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,i6=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of i4)e();isFinite(i3)||(i3="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",i6,!0))}},i8=()=>{if(i3<0){var e;let t=iX();i3=(document.prerendering||null==(e=globalThis.performance.getEntriesByType("visibility-state").filter(e=>"hidden"===e.name&&e.startTime>t)[0])?void 0:e.startTime)??i5(),addEventListener("visibilitychange",i6,!0),addEventListener("prerenderingchange",i6,!0),iH(()=>{setTimeout(()=>{i3=i5()})})}return{get firstHiddenTime(){return i3},onHidden(e){i4.add(e)}}},i7=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},i9=[1800,3e3],oe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i7(()=>{let r=i8(),n,i=iQ("FCP"),o=i1("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<r.firstHiddenTime&&(i.value=Math.max(t.startTime-iX(),0),i.entries.push(t),n(!0)))});o&&(n=iG(e,i,i9,t.reportAllChanges),iH(r=>{n=iG(e,i=iQ("FCP"),i9,t.reportAllChanges),i$(()=>{i.value=performance.now()-r.timeStamp,n(!0)})}))})},ot=[.1,.25],or=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i8();oe(i2(()=>{let n,i=iQ("CLS",0),o=iZ(t,i0),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},a=i1("layout-shift",s);a&&(n=iG(e,i,ot,t.reportAllChanges),r.onHidden(()=>{s(a.takeRecords()),n(!0)}),iH(()=>{o.i=0,n=iG(e,i=iQ("CLS",0),ot,t.reportAllChanges),i$(()=>n())}),setTimeout(n))}))},on=0,oi=1/0,oo=0,os=e=>{for(let t of e)t.interactionId&&(oi=Math.min(oi,t.interactionId),on=(oo=Math.max(oo,t.interactionId))?(oo-oi)/7+1:0)},oa=()=>t?on:performance.interactionCount??0,ou=0;class ol{v(){ou=oa(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((oa()-ou)/50));return this.u[e]}h(e){var t,r;if(null==(t=this.m)||t.call(this,e),!e.interactionId&&"first-input"!==e.entryType)return;let n=this.u.at(-1),i=this.l.get(e.interactionId);if(i||this.u.length<10||e.duration>n.P){if(i?e.duration>i.P?(i.entries=[e],i.P=e.duration):e.duration===i.P&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(i={id:e.interactionId,entries:[e],P:e.duration},this.l.set(i.id,i),this.u.push(i)),this.u.sort((e,t)=>
1t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);null==(r=this.p)||r.call(this,i)}}constructor(){(0,iz._)(this,"u",[]),(0,iz._)(this,"l",new Map),(0,iz._)(this,"m",void 0),(0,iz._)(this,"p",void 0)}}let oc=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=i2(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},od=[200,500],of=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=i8();i7(()=>{"interactionCount"in performance||t||(t=i1("event",os,{type:"event",buffered:!0,durationThreshold:0}));let i,o=iQ("INP"),s=iZ(r,ol),a=e=>{oc(()=>{for(let t of e)s.h(t);let t=s.L();t&&t.P!==o.value&&(o.value=t.P,o.entries=t.entries,i())})},u=i1("event",a,{durationThreshold:r.durationThreshold??40});i=iG(e,o,od,r.reportAllChanges),u&&(u.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(u.takeRecords()),i(!0)}),iH(()=>{s.v(),i=iG(e,o=iQ("INP"),od,r.reportAllChanges)}))})};class oh{h(e){var t;null==(t=this.m)||t.call(this,e)}constructor(){(0,iz._)(this,"m",void 0)}}let op=[2500,4e3],og=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i7(()=>{let r=i8(),n,i=iQ("LCP"),o=iZ(t,oh),s=e=>{for(let s of(t.reportAllChanges||(e=e.slice(-1)),e))o.h(s),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-iX(),0),i.entries=[s],n())},a=i1("largest-contentful-paint",s);if(a){n=iG(e,i,op,t.reportAllChanges);let r=i2(()=>{s(a.takeRecords()),a.disconnect(),n(!0)}),o=e=>{e.isTrusted&&(oc(r),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});iH(r=>{n=iG(e,i=iQ("LCP"),op,t.reportAllChanges),i$(()=>{i.value=performance.now()-r.timeStamp,n(!0)})})}})},ov=[800,1800],om=e=>{document.prerendering?i7(()=>om(e)):"complete"!==document.readyState?addEventListener("load",()=>om(e),!0):setTimeout(e)},oy=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=iQ("TTFB"),n=iG(e,r,ov,t.reportAllChanges);om(()=>{let i=iJ();i&&(r.value=Math.max(i.responseStart-iX(),0),r.entries=[i],n(!0),iH(()=>{(n=iG(e,r=iQ("TTFB",0),ov,t.reportAllChanges))(!0)}))})};function ob(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 o_=function(){var e=null,t=(0,ez.getGlobalScope)(),r=null==t?void 0:t.document,n=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,ey.__generator)(this,function(a){return void 0===r||(o=nO((null==n?void 0:n.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==n?void 0:n.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":nO((null==n?void 0:n.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"u">typeof document&&document.title||"","[Amplitude] Page URL":nO(o.split("?")[0],t.loggerProvider)},og(function(e){s["[Amplitude] LCP"]=ob(e)}),oe(function(e){s["[Amplitude] FCP"]=ob(e)}),of(function(e){s["[Amplitude] INP"]=ob(e)}),or(function(e){s["[Amplitude] CLS"]=ob(e)}),oy(function(e){s["[Amplitude] TTFB"]=ob(e)}),e=function(){"hidden"===r.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",s),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return e&&(null==r||r.removeEventListener("visibilitychange",e)),[2]})})}}},ow=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=10),["AMP",t,e.substring(0,r)].filter(
1Boolean).join("_")},oS=function(){function e(e,t){var r;this.shouldTrackNewCampaign=!1,this.options=(0,ey.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:rU((null==(r=t.cookieOptions)?void 0:r.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=ow(t.apiKey,"MKTG"),this.webExpStorageKey=ow(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eL,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(0,ey.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=ey.__read.apply(void 0,[r.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||tb(this.sessionTimeout,this.lastEventTime),!rM(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(0,ey.__awaiter)(this,void 0,void 0,function(){var e;return(0,ey.__generator)(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 r0().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,r,n=(t=this.currentCampaign,r=this.options,e$(Object.entries((0,ey.__assign)((0,ey.__assign)({},eL),t)).reduce(function(e,t){var n,i=(0,ey.__read)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(n=null!=s?s:r.initialEmptyValue)?n:"EMPTY"),s)?e.set(o,s):e.unset(o)},new eB)));return e&&(n.event_id=e),n},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),oE="AMP_CURRENT_PAGE",ok="AMP_PREVIOUS_PAGE",oI="AMP_URL_INFO";(y=es||(es={})).Direct="direct",y.Internal="internal",y.External="external";var ox=new Set([G.IDENTIFY,G.GROUP_IDENTIFY,G.REVENUE]),oC=function(e){var t=(void 0===e?{}:e).internalDomains,r=void 0===t?[]:t,n=(0,ez.getGlobalScope)(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var r=nO(e,s);t=new URL(r).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="u">typeof location&&location.hostname||"",n=e?l(e):void 0;if(!n)return es.Direct;var i=r.some(function(e){return -1!==t.indexOf(e)}),o=r.some(function(e){return -1!==n.indexOf(e)});return t===n||o&&i?es.Internal:es.External},d=function(){(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(oI)];case 1:return e=a.sent(),t=nO("u">typeof location&&location.href||""),r=(null==e?void 0:e[oE])||"",n=void 0,n=t===r?(null==e?void 0:e[ok])||"":r||document.referrer||"",[4,i.set(oI,((s={})[oE]=t,s[ok]=n,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!n)return[3,2];try{i=new rs(n.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:o=null!=(t=r.sent())&&t,n.addEventListener("popstate",d),a||(n.history.pushState=new Proxy(n.history.pushState,{apply:function(e,t,r){var n=(0,ey.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),n.history.replaceState=new Proxy(n.history.replaceState,{apply:function(e,t,r){var n=(0,ey.__read)(r,3),i=n[0],o=n[1],s=n[2];e.apply(t,[i,o,s]),u&&d()}}),a=!0),r.label=2;case 2:return[2]}})})},execute:function(e){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var t,r,n,s,a;return(0,ey.__generator)(this,function(u){switch(u.label){case 0:if(t=nO("u">typeof location&&location.href||""),!(i&&o))return[3,5];return[4,i.get(oI)];case 1:if(null==(r=u.sent())?void 0:r[oE])return[3,3];return[4,i.set(oI,((a={})[oE]=t,a[ok]=document.referrer||"",a))];case 2:u.sent(),u.label=3;case 3:return[4,i.get(oI)];case 4:if(n=u.sent(),s="",n&&(s=n[ok]||""),ox.has(e.event_type))return[2,e];e.event_properties=(0,ey.__assign)((0,ey.__assign)({},e.event_properties||{}),{"[Amplitude] Page Domain":oT(e,"[Amplitude] Page Domain","u">typeof location&&location.hostname||""),"[Amplitude] Page Location":oT(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":oT(e,"[Amplitude] Page Path","u">typeof location&&nO(location.pathname)||""),"[Amplitude] Page Title":oT(e,"[Amplitude] Page Title",rZ(rY)),"[Amplitude] Page URL":oT(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":s,"[Amplitude] Previous Page Type":c(s)}),u.label=5;case 5:return[2,e]}})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){switch(e.label){case 0:if(n&&(n.removeEventListener("popstate",d),u=!1),!(i&&o))return[3,2];return[4,i.set(oI,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function oT(e,t,r){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?r:e.event_properties[t]}var oP=function(){var e,t,r;function n(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(i,o){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,ey.__generator)(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(s=i.remoteConfig)?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){r=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?n(e.body||""):n("")}),t=function(){var e;return null==(e=i.remoteConfigClient)?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var n;return(0,ey.__generator)(this,function(i){if(r)try{return[2,null!=(n=r(t))?n:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return t&&t(),[2]})})}}},oO=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t._enableRequestBodyCompressionExperimentalValue=!1,t}return(0,ey.__extends)(t,e),t.prototype.init=function(e,t,r){var n,i;return void 0===e&&(e=""),arguments.length>2?(n=t,i=r):"string"==typeof t?(n=t,i=void 0):(n=null==t?void 0:t.userId,i=t),eQ(this._init((0,ey.__assign)((0,ey.__assign)({},i),{userId:n,apiKey:e})))},t.prototype._init=function(t){var r,n,i,o,s,a,u,l;return(0,ey.__awaiter)(this,void 0,void 0,function(){var c,d,f,h,p,g,v,m,y,b,_,w,S,E,
1k=this;return(0,ey.__generator)(this,function(I){var x,C,T,P,O,A,R;switch(I.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=rW(t),d=null!=(r=t.loggerProvider)?r:new e1,t.loggerProvider||d.enable(null!=(n=t.logLevel)?n:X.Warn),f=null!=(i=t.serverZone)?i:"US",p=this._diagnosticsSampleRate,g=null==(o=t.enableDiagnostics)||o,!c)return[3,2];return h=new tk(t.apiKey,d,f,null==(s=t.remoteConfig)?void 0:s.serverUrl),[4,new Promise(function(e){null==h||h.subscribe("configs.diagnostics.browserSDK","all",function(t,r,n){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(p=i);var o=t.enabled;"boolean"==typeof o&&(g=o)}e()})})];case 1:I.sent(),I.label=2;case 2:return(v=new tj(t.apiKey,d,f,{enabled:g,sampleRate:p})).setTag("library","".concat(t6,"/").concat(t5)),"u">typeof navigator&&v.setTag("user_agent",navigator.userAgent),[4,(x=t.apiKey,C=t,T=this,P=v,O={loggerProvider:d,serverZone:f,enableDiagnostics:g,diagnosticsSampleRate:p},void 0===C&&(C={}),(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,k,I,A,R,D,M,N,L,U,q,j,F,B,V,K,z,W,H,G,$,J,X,Q,Y,Z,ee,et;return(0,ey.__generator)(this,function(er){var en,ei,eo,es;switch(er.label){case 0:if(e=C.identityStorage||rA,t="",!(e===rA&&!(null==(w=C.cookieOptions)?void 0:w.domain)&&(null==(S=C.cookieOptions)?void 0:S.domain)!==""))return[3,2];return[4,(en=void 0,ei=P,(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:return[4,new re(void 0,{diagnosticsClient:ei}).isEnabled()];case 1:if(!a.sent()||!en&&("u"<typeof location||!location.hostname)||1===(t=(e=null!=en?en:location.hostname).split(".")).length)return[2,""];for(r=[],n=1,rF.find(function(t){return e.endsWith(".".concat(t))})&&(n=2),i=t.length-n-1;i>=0;--i)r.push(t.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<r.length))return[3,7];o=r[i],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,re.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),ei&&ei.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(o),error:s instanceof Error?s.message:String(s)}),[3,6];case 6:return i++,[3,2];case 7:return ei&&ei.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=er.sent(),er.label=2;case 2:return r=(0,ey.__assign)({domain:null!=(k=null==(E=C.cookieOptions)?void 0:E.domain)?k:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},C.cookieOptions),n={duplicateResolverFn:function(e){var t=rn(e);return!!t&&ri(JSON.parse(t).cookieDomain,r.domain)},diagnosticsClient:P},[4,(eo=i=rz(C.identityStorage,r,n),void 0===(es=null==(A=null==(I=C.cookieOptions)?void 0:I.upgrade)||A)&&(es=!0),(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n,i,o,s,a,u;return(0,ey.__generator)(this,function(l){switch(l.label){case 0:return e="".concat("amp","_").concat(x.substring(0,6)),[4,eo.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!es)return[3,3];return[4,eo.remove(e)];case 2:l.sent(),l.label=3;case 3:return n=(r=(0,ey.__read)(t.split("."),6))[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],[2,{deviceId:n,userId:rv(i),sessionId:rg(s),lastEventId:rg(u),lastEventTime:rg(a),optOut:!!o}]}})}))];case 3:return o=er.sent(),[4,i.get(ro(x))];case 4:return s=er.sent(),l=!(u=(a=tw()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<u,c=null!=(L=null!=(N=null!=(M=null!=(R=C.deviceId)?R:l?null!=(D=a.ampDeviceId)?D:a.deviceId:void 0)?M:null==s?void 0:s.deviceId)?N:o.deviceId)?L:eH(),d=null!=(U=null==s?void 0:s.lastEventId)?U:o.lastEventId,f=null!=(q=null==s?void 0:s.lastEventTime)?q:o.lastEventTime,h=null!=(F=null!=(j=C.optOut)?j:null==s?void 0:s.optOut)?F:o.optOut,p=null!=(B=null==s?void 0:s.sessionId)?B:o.sessionId,g=null==s?void 0:s.deferredSessionId,v=null!=(K=null!=(V=C.userId)?V:null==s?void 0:s.userId)?K:o.userId,T.previousSessionDeviceId=null!=(z=null==s?void 0:s.deviceId)?z:o.deviceId,T.previousSessionUserId=null!=(W=null==s?void 0:s.userId)?W:o.userId,m={ipAddress:null==(G=null==(H=C.trackingOptions)?void 0:H.ipAddress)||G,language:null==(J=null==($=C.trackingOptions)?void 0:$.language)||J,platform:null==(Q=null==(X=C.trackingOptions)?void 0:X.platform)||Q},y=null==s?void 0:s.pageCounter,b=null==s?void 0:s.debugLogsEnabled,void 0!==C.autocapture&&(C.defaultTracking=C.autocapture),[4,(_=new rK(x,C.appVersion,i,r,C.defaultTracking,C.autocapture,c,C.flushIntervalMillis,C.flushMaxRetries,C.flushQueueSize,e,C.ingestionMetadata,C.instanceName,d,f,null!=(Y=null==O?void 0:O.loggerProvider)?Y:C.loggerProvider,C.logLevel,C.minIdLength,C.offline,h,C.partnerId,C.plan,C.serverUrl,null!=(Z=null==O?void 0:O.serverZone)?Z:C.serverZone,p,g,C.sessionTimeout,C.storageProvider,m,C.transport,C.useBatch,C.fetchRemoteConfig,v,y,b,C.networkTrackingOptions,C.identify,null!=(ee=null==O?void 0:O.enableDiagnostics)?ee:C.enableDiagnostics,null!=(et=null==O?void 0:O.diagnosticsSampleRate)?et:T._diagnosticsSampleRate,P,C.remoteConfig,t,C.enableRequestBodyCompression,T._enableRequestBodyCompressionExperimentalValue,C.customEnrichment)).storageProvider.isEnabled()];case 5:return er.sent()||(_.loggerProvider.warn("Storage provider ".concat(_.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),_.storageProvider=new t7),[2,_]}})}))];case 3:if(m=I.sent(),!(c&&h))return[3,5];return[4,new Promise(function(e){null==h||h.subscribe("configs.analyticsSDK.browserSDK","all",function(t,r,n){m.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:r,lastFetch:n},null,2)),t&&function(e,t){if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var r,n,i,o,s,a,u,l,c,d,f,h,p=Object.keys(t);try{for(var g=(0,ey.__values)(p),v=g.next();!v.done;v=g.next()){var m=v.value;try{var y=t[m];"boolean"==typeof(null==y?void 0:y.enabled)&&(y.enabled?(delete y.enabled,0===Object.keys(y).length&&(t[m]=!0)):t[m]=!1),e(y)}catch(e){}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}
1try{if(null==(c=null==(l=null==(u=t.autocapture)?void 0:u.networkTracking)?void 0:l.captureRules)?void 0:c.length)try{for(var b=(0,ey.__values)(t.autocapture.networkTracking.captureRules),_=b.next();!_.done;_=b.next()){var w=_.value;try{for(var S=(s=void 0,(0,ey.__values)(["responseHeaders","requestHeaders"])),E=S.next();!E.done;E=S.next()){var k=E.value,I=null!=(d=w[k])?d:{},x=I.captureSafeHeaders,C=I.allowlist;if(x||C){if(void 0!==C&&!Array.isArray(C)){delete w[k];continue}w[k]=(0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(x?eU:[]),!1),(0,ey.__read)(null!=C?C:[]),!1)}}}catch(e){s={error:e}}finally{try{E&&!E.done&&(a=S.return)&&a.call(S)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}catch(e){}var T=null==(f=t.autocapture)?void 0:f.frustrationInteractions;T&&(T.rageClick&&(T.rageClicks=T.rageClick,delete T.rageClick),T.deadClick&&(T.deadClicks=T.deadClick,delete T.deadClick));try{var P=null==(h=t.autocapture)?void 0:h.elementInteractions;if(P&&"object"==typeof P&&(!0===P.viewportContentUpdated&&(P.viewportContentUpdated={}),!1===P.viewportContentUpdated&&(P.viewportContentUpdated={enabled:!1}),void 0!==P.exposureDuration)){var O=P.viewportContentUpdated;void 0===O?P.viewportContentUpdated={exposureDuration:P.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=P.exposureDuration),delete P.exposureDuration}}catch(e){}}}(e);try{var r,n,i,o,s,a,u;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 l=(0,ey.__assign)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(i=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:i.length)){l.elementInteractions=(0,ey.__assign)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!=(o=c.pageUrlAllowlist)?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=ni(d,f,t),delete c.pageUrlAllowlistRegex}if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null==(s=e.autocapture.networkTracking.captureRules)?void 0:s.length)){l.networkTracking=(0,ey.__assign)({},e.autocapture.networkTracking);var h=null!=(a=l.networkTracking.captureRules)?a:[];try{for(var p=(0,ey.__values)(h),g=p.next();!g.done;g=p.next()){var v=g.value;v.urls=ni(null!=(u=v.urls)?u:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=(0,ey.__assign)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},l)),"object"==typeof t.autocapture&&(t.autocapture=(0,ey.__assign)((0,ey.__assign)({},t.autocapture),l))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.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:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,m)];case 6:if(I.sent(),this.logBrowserOptions(m),this.config.remoteConfigClient=h,!tK(this.config.defaultTracking))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,ey.__awaiter)(k,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(e)return[3,2];return t=t0(this.config),this.webAttribution=new oS(t,this.config),[4,this.webAttribution.init()];case 1:r.sent(),r.label=2;case 2:return[2]}})})}),y=t0(this.config),this.webAttribution=new oS(y,this.config),[4,this.webAttribution.init()];case 7:I.sent(),I.label=8;case 8:if(w=!(!(_=(b=tw()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<_)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(S=this.config.deferredSessionId)||this.config.optOut||(S=Date.now()),this.setSessionId(null!=(l=null!=(u=null!=(a=t.sessionId)?a:w)?u:S)?l:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,ey.__awaiter)(k,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(E=tv(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(nn()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new ti({diagnosticsClient:v})).promise];case 11:return I.sent(),[4,this.add(new t8).promise];case 12:return I.sent(),[4,this.add(new t_).promise];case 13:if(I.sent(),nr(this.config),!tV(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ne()).promise];case 14:I.sent(),I.label=15;case 15:if(!tz(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(r8()).promise];case 16:I.sent(),I.label=17;case 17:if(!tW(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(r3(tZ(this.config))).promise];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,ey.__awaiter)(k,void 0,void 0,function(){return(0,ey.__generator)(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(r3(tZ(this.config))).promise];case 1:return t.sent(),[2]}})})}),I.label=20;case 20:if(!t$(this.config.autocapture))return[3,22];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(is(tX(this.config),{diagnosticsClient:v})).promise];case 21:I.sent(),I.label=22;case 22:if(!tJ(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(i_(tQ(this.config))).promise];case 23:I.sent(),I.label=24;case 24:if(!tG(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(iK(tY(this.config))).promise];
1case 25:I.sent(),I.label=26;case 26:if(!("boolean"==typeof(A=this.config.autocapture)?A:"object"==typeof A&&!0===A.webVitals))return[3,28];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(o_()).promise];case 27:I.sent(),I.label=28;case 28:if(!tV(this.config.autocapture,"pageUrlEnrichment"))return[3,30];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(oC()).promise];case 29:I.sent(),I.label=30;case 30:if(!("boolean"==typeof(R=this.config.customEnrichment)?R:"object"==typeof R&&null!==R&&!1!==R.enabled))return[3,32];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(oP()).promise];case 31:I.sent(),I.label=32;case 32:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 33:return I.sent(),E.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},r=t.time,n=(0,ey.__rest)(t,["time"]);k.track(e.eventType,n,"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}),tm(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}),ty(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(eH()),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,n,i=new eB,o=null!=(n=e.userProperties)?n:{};try{for(var s=(0,ey.__values)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var u=(0,ey.__read)(a.value,2),l=u[0],c=u[1];i.set(l,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}this.identify(i)}},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)),eQ(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,eQ(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return eQ(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var n=this.getSessionId();n!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!=(t=this.config.lastEventId)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,tH(this.config.defaultTracking)&&(n&&i&&r.push(this.track(rS,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:n,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,r);return this.config.identify&&r.push(this.track(e$(this.config.identify)).promise),tH(this.config.defaultTracking)&&r.push(this.track(rw,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,eQ(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=rH(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,r){if(t3(t)){var n=t._q;t._q=[],t=t2(new eB,n)}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,n,i){if(t3(n)){var o=n._q;n._q=[],n=t2(new eB,o)}return e.prototype.groupIdentify.call(this,t,r,n,i)},t.prototype.revenue=function(t,r){if(t3(t)){var n=t._q;t._q=[],t=t2(new to,n)}return e.prototype.revenue.call(this,t,r)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var r=this.webAttribution.generateCampaignEvent(e);
1return t?t.push(this.track(r).promise):this.track(r),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n,i;return(0,ey.__generator)(this,function(o){return r=Date.now(),n=tb(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==rw&&t.event_type!==rS&&(!t.session_id||t.session_id===this.getSessionId())&&(n||i?(this.setSessionId(r),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):n||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,ey.__assign)((0,ey.__assign)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",tB(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.prototype._enableRequestBodyCompressionExperimental=function(e){if(!this.config){this._enableRequestBodyCompressionExperimentalValue=e;return}},t}(eY),oA=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this;return r.customHeaders=t,r}return(0,ey.__extends)(t,e),t.prototype.send=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if("u"<typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,ey.__assign)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(r=i.sent()).text()];case 2:n=i.sent();try{return[2,this.buildResponse(JSON.parse(n))]}catch(e){return[2,this.buildResponse({code:r.status})]}}})})},t}(rl);(b=ea||(ea={})).US="US",b.EU="EU",b.STAGING="STAGING",e.s(["ServerZone",0,ea],596787);var oR="[Amplitude]",oD="".concat(oR," Session Replay ID"),oM=ea.US,oN={enabled:!0},oL="".concat(oR," Session Replay Debug"),oU="amp-mask",oq="https://api-sr.amplitude.com/sessions/v2/track",oj="https://api-sr.eu.amplitude.com/sessions/v2/track",oF="https://api-sr.stag2.amplitude.com/sessions/v2/track";(_=eu||(eu={})).GET_SR_PROPS="get-sr-props",_.DEBUG_INFO="debug-info",_.FETCH_REQUEST="fetch-request",_.METADATA="metadata",_.TARGETING_DECISION="targeting-decision";var oB=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,r=this.logger[e];return"function"==typeof r?(null!=(t=r.__rrweb_original__)?t:r).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),oV="medium",oK=function(e,t,r){switch(t){case"light":if("input"!==e)return!0;var n,i,o=r?(i=(n=r).type,n.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!o)return!1;if(["password","hidden","email","tel"].includes(o)||r.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":case"conservative":return!0;default:return oK(e,oV,r)}},oz=function(e,t,r){var n,i,o;if(void 0===t&&(t={defaultMaskLevel:oV}),r){if(r.closest("."+oU)||(null!=(n=t.maskSelector)?n:[]).some(function(e){return r.closest(e)}))return!0;if(r.closest(".amp-unmask")||(null!=(i=t.unmaskSelector)?i:[]).some(function(e){return r.closest(e)}))return!1}return oK(e,null!=(o=t.defaultMaskLevel)?o:oV,r)},oW=function(e,t){return function(r,n){return oz(e,t,n)?r.replace(/[^\s]/g,"*"):r}},oH=function(){var e=(0,ez.getGlobalScope)();return(null==e?void 0:e.location)?e.location.href:""},oG=function(e,t){return t||(e===ea.STAGING?oF:e===ea.EU?oj:oq)},o$=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(t,"$"))},oJ=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},oX=function(e,t){var r,n;try{for(var i=(0,ey.__values)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=o$(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},oQ=function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,ez.getGlobalScope)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return r=(t=i.sent()).usage,n=t.quota,[2,{totalStorageSize:r?Math.round(r/1024):0,percentOfQuota:r&&n?Math.round((r/n+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},oY=function(e){var t=(0,ey.__assign)({},e),r=t.apiKey;return t.apiKey="****".concat(r.substring(r.length-4)),t},oZ=function(){return{flushMaxRetries:2,logLevel:X.Warn,loggerProvider:new e1,transportProvider:new oA}},o0=function(e){function t(t,r){var n,i,o,s,a,u,l=this,c=oZ();return(l=e.call(this,(0,ey.__assign)((0,ey.__assign)({transportProvider:c.transportProvider,loggerProvider:new oB(r.loggerProvider||c.loggerProvider)},r),{apiKey:t}))||this).flushMaxRetries=void 0!==r.flushMaxRetries&&r.flushMaxRetries<=c.flushMaxRetries?r.flushMaxRetries:c.flushMaxRetries,l.apiKey=t,l.sampleRate=r.sampleRate||0,l.serverZone=r.serverZone||oM,l.configServerUrl=r.configServerUrl,l.trackServerUrl=r.trackServerUrl,l.shouldInlineStylesheet=r.shouldInlineStylesheet,l.version=r.version,l.performanceConfig=r.performanceConfig||oN,l.storeType=null!=(n=r.storeType)?n:"idb",l.applyBackgroun
1dColorToBlockedElements=null!=(i=r.applyBackgroundColorToBlockedElements)&&i,l.enableUrlChangePolling=null!=(o=r.enableUrlChangePolling)&&o,l.urlChangePollingInterval=null!=(s=r.urlChangePollingInterval)?s:1e3,l.captureDocumentTitle=null!=(a=r.captureDocumentTitle)&&a,r.privacyConfig&&(l.privacyConfig=r.privacyConfig),r.interactionConfig&&(l.interactionConfig=r.interactionConfig,l.interactionConfig.ugcFilterRules&&oJ(l.interactionConfig.ugcFilterRules)),r.debugMode&&(l.debugMode=r.debugMode),void 0!==r.useWebWorker?l.useWebWorker=r.useWebWorker:(null==(u=r.experimental)?void 0:u.useWebWorker)!==void 0&&(l.useWebWorker=r.experimental.useWebWorker),r.omitElementTags&&(l.omitElementTags=r.omitElementTags),l}return(0,ey.__extends)(t,e),t}(e3),o1=((w=o1||{})[w.DomContentLoaded=0]="DomContentLoaded",w[w.Load=1]="Load",w[w.FullSnapshot=2]="FullSnapshot",w[w.IncrementalSnapshot=3]="IncrementalSnapshot",w[w.Meta=4]="Meta",w[w.Custom=5]="Custom",w[w.Plugin=6]="Plugin",w),o2=((S=o2||{})[S.Mutation=0]="Mutation",S[S.MouseMove=1]="MouseMove",S[S.MouseInteraction=2]="MouseInteraction",S[S.Scroll=3]="Scroll",S[S.ViewportResize=4]="ViewportResize",S[S.Input=5]="Input",S[S.TouchMove=6]="TouchMove",S[S.MediaInteraction=7]="MediaInteraction",S[S.StyleSheetRule=8]="StyleSheetRule",S[S.CanvasMutation=9]="CanvasMutation",S[S.Font=10]="Font",S[S.Log=11]="Log",S[S.Drag=12]="Drag",S[S.StyleDeclaration=13]="StyleDeclaration",S[S.Selection=14]="Selection",S[S.AdoptedStyleSheet=15]="AdoptedStyleSheet",S[S.CustomElement=16]="CustomElement",S),o3=((E=o3||{})[E.MouseUp=0]="MouseUp",E[E.MouseDown=1]="MouseDown",E[E.Click=2]="Click",E[E.ContextMenu=3]="ContextMenu",E[E.DblClick=4]="DblClick",E[E.Focus=5]="Focus",E[E.Blur=6]="Blur",E[E.TouchStart=7]="TouchStart",E[E.TouchMove_Departed=8]="TouchMove_Departed",E[E.TouchEnd=9]="TouchEnd",E[E.TouchCancel=10]="TouchCancel",E),o4=((k=o4||{})[k.Mouse=0]="Mouse",k[k.Pen=1]="Pen",k[k.Touch=2]="Touch",k),o5=((I=o5||{})[I["2D"]=0]="2D",I[I.WebGL=1]="WebGL",I[I.WebGL2=2]="WebGL2",I),o6=((x=o6||{})[x.Play=0]="Play",x[x.Pause=1]="Pause",x[x.Seeked=2]="Seeked",x[x.VolumeChange=3]="VolumeChange",x[x.RateChange=4]="RateChange",x),o8=((C=o8||{}).Start="start",C.Pause="pause",C.Resume="resume",C.Resize="resize",C.Finish="finish",C.FullsnapshotRebuilded="fullsnapshot-rebuilded",C.LoadStylesheetStart="load-stylesheet-start",C.LoadStylesheetEnd="load-stylesheet-end",C.SkipStart="skip-start",C.SkipEnd="skip-end",C.MouseInteraction="mouse-interaction",C.EventCast="event-cast",C.CustomEvent="custom-event",C.Flush="flush",C.StateChange="state-change",C.PlayBack="play-back",C.Destroy="destroy",C),o7=((T=o7||{})[T.Document=0]="Document",T[T.DocumentType=1]="DocumentType",T[T.Element=2]="Element",T[T.Text=3]="Text",T[T.CDATA=4]="CDATA",T[T.Comment=5]="Comment",T),o9=function(e,t){var r=document.createDocumentFragment(),n=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{r.querySelector(e)}catch(r){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=n(e.blockSelector),e.maskSelector=n(e.maskSelector),e.unmaskSelector=n(e.unmaskSelector),e},se=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,r,n,i;return(0,ey.__awaiter)(this,void 0,void 0,function(){var o,s,a,u,l,c,d,f,h,p,g,v,m,y,b,_,w,S=this;return(0,ey.__generator)(this,function(E){switch(E.label){case 0:(o=(0,ey.__assign)({},this.localConfig)).optOut=this.localConfig.optOut,o.captureEnabled=!0,E.label=1;case 1:return E.trys.push([1,3,,4]),[4,new Promise(function(e,t){S.remoteConfigClient.subscribe("configs.sessionReplay","all",function(r,n){if(S.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(n,":"),JSON.stringify(r,null,2)),!r)return void t(Error("No remote config received"));var i,a=r.sr_sampling_config,u=r.sr_privacy_config,l=r.sr_targeting_config,c=null==(i=o.interactionConfig)?void 0:i.ugcFilterRules;o.interactionConfig=r.sr_interaction_config,o.interactionConfig&&c&&(o.interactionConfig.ugcFilterRules=c),o.loggingConfig=r.sr_logging_config,(a||u||l)&&(s={},a&&(s.sr_sampling_config=a),u&&(s.sr_privacy_config=u),l&&(s.sr_targeting_config=l)),e()})})];case 2:return E.sent(),[3,4];case 3:return a=E.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",a),o.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:void 0}];case 4:if(!s)return[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}];if(u=s.sr_sampling_config,l=s.sr_privacy_config,c=s.sr_targeting_config,u&&Object.keys(u).length>0?(Object.prototype.hasOwnProperty.call(u,"capture_enabled")?o.captureEnabled=u.capture_enabled:o.captureEnabled=!1,Object.prototype.hasOwnProperty.call(u,"sample_rate")&&(o.sampleRate=u.sample_rate)):(o.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),l){d=null!=(e=o.privacyConfig)?e:{},f={defaultMaskLevel:null!=(r=null!=(t=l.defaultMaskLevel)?t:d.defaultMaskLevel)?r:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,ey.__spreadArray)([],(0,ey.__read)(new Set((0,ey.__spreadArray)((0,ey.__spreadArray)([],(0,ey.__read)(null!=(n=d.maskAttributes)?n:[]),!1),(0,ey.__read)(null!=(i=l.maskAttributes)?i:[]),!1))),!1)},h=function(e){var t,r,n,i,o,s,a,u,l,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,ey.__values)(null!=(a=e.blockSelector)?a:[]),f=d.next();!f.done;f=d.next()){var h=f.value;c[h]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}try{for(var p=(0,ey.__values)(null!=(u=e.maskSelector)?u:[]),g=p.next();!g.done;g=p.next()){var h=g.value;c[h]="mask"}}catch(e){n={error:e}}finally{try{g&&!g.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}try{for(var v=(0,ey.__values)(null!=(l=e.unmaskSelector)?l:[]),m=v.next();!m.done;m=v.next()){var h=m.value;c[h]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(o)throw o.error}}return c},p=(0,ey.__assign)((0,ey.__assign)({},h(d)),h(l));try{for(v=(g=(0,ey.__values)(Object.entries(p))).next();!v.done;v=g.next())y=(m=(0,ey.__read)(v.value,2))[0],b=m[1],"mask"===b?f.maskSelector.push(y):"block"===b?f.blockSelector.push(y):"unmask"===b&&f.unmaskSelector.push(y)}catch(e){_={error:e}}finally{try{v&&!v.done&&(w=g.return)&&w.call(g)}finally{if(_)throw _.error}}o.privacyConfig=o9(f,this.localConfig.loggerProvider)}return c&&Object.keys(c).length>0&&(o.targetingConfig=c),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:oY(o)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}]}})})},e}(),st=Uint8Array,sr=Uint16Array,sn=Uint32Array,si=new st([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]),so=new st([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]),ss=new st([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sa=function(e,t){for(var r=new sr(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];
1for(var i=new sn(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},su=sa(si,2),sl=su[0],sc=su[1];sl[28]=258,sc[258]=28;for(var sd=sa(so,0),sf=(sd[0],sd[1]),sh=new sr(32768),sp=0;sp<32768;++sp){var sg=(43690&sp)>>>1|(21845&sp)<<1;sg=(61680&(sg=(52428&sg)>>>2|(13107&sg)<<2))>>>4|(3855&sg)<<4,sh[sp]=((65280&sg)>>>8|(255&sg)<<8)>>>1}for(var sv=function(e,t,r){for(var n,i=e.length,o=0,s=new sr(t);o<i;++o)++s[e[o]-1];var a=new sr(t);for(o=0;o<t;++o)a[o]=a[o-1]+s[o-1]<<1;if(r){n=new sr(1<<t);var u=15-t;for(o=0;o<i;++o)if(e[o])for(var l=o<<4|e[o],c=t-e[o],d=a[e[o]-1]++<<c,f=d|(1<<c)-1;d<=f;++d)n[sh[d]>>>u]=l}else for(n=new sr(i),o=0;o<i;++o)n[o]=sh[a[e[o]-1]++]>>>15-e[o];return n},sm=new st(288),sp=0;sp<144;++sp)sm[sp]=8;for(var sp=144;sp<256;++sp)sm[sp]=9;for(var sp=256;sp<280;++sp)sm[sp]=7;for(var sp=280;sp<288;++sp)sm[sp]=8;for(var sy=new st(32),sp=0;sp<32;++sp)sy[sp]=5;var sb=sv(sm,9,0),s_=sv(sy,5,0),sw=function(e){return(e/8|0)+(7&e&&1)},sS=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof sr?sr:e instanceof sn?sn:st)(r-t);return n.set(e.subarray(t,r)),n},sE=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8},sk=function(e,t,r){r<<=7&t;var n=t/8|0;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},sI=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[new st(0),0];if(1==i){var s=new st(r[0].s+1);return s[r[0].s]=1,[s,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],u=r[1],l=0,c=1,d=2;for(r[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=i-1;)a=r[r[l].f<r[d].f?l++:d++],u=r[l!=c&&r[l].f<r[d].f?l++:d++],r[c++]={s:-1,f:a.f+u.f,l:a,r:u};for(var f=o[0].s,n=1;n<i;++n)o[n].s>f&&(f=o[n].s);var h=new sr(f+1),p=sx(r[c-1],h,0);if(p>t){var n=0,g=0,v=p-t,m=1<<v;for(o.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});n<i;++n){var y=o[n].s;if(h[y]>t)g+=m-(1<<p-h[y]),h[y]=t;else break}for(g>>>=v;g>0;){var b=o[n].s;h[b]<t?g-=1<<t-h[b]++-1:++n}for(;n>=0&&g;--n){var _=o[n].s;h[_]==t&&(--h[_],++g)}p=t}return[new st(h),p]},sx=function(e,t,r){return -1==e.s?Math.max(sx(e.l,t,r+1),sx(e.r,t,r+1)):t[e.s]=r},sC=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new sr(++t),n=0,i=e[0],o=1,s=function(e){r[n++]=e},a=1;a<=t;++a)if(e[a]==i&&a!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[a]}return[r.subarray(0,n),t]},sT=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},sP=function(e,t,r){var n=r.length,i=sw(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return(i+4+n)*8},sO=function(e,t,r,n,i,o,s,a,u,l,c){sE(t,c++,r),++i[256];for(var d,f,h,p,g=sI(i,15),v=g[0],m=g[1],y=sI(o,15),b=y[0],_=y[1],w=sC(v),S=w[0],E=w[1],k=sC(b),I=k[0],x=k[1],C=new sr(19),T=0;T<S.length;++T)C[31&S[T]]++;for(var T=0;T<I.length;++T)C[31&I[T]]++;for(var P=sI(C,7),O=P[0],A=P[1],R=19;R>4&&!O[ss[R-1]];--R);var D=l+5<<3,M=sT(i,sm)+sT(o,sy)+s,N=sT(i,v)+sT(o,b)+s+14+3*R+sT(C,O)+(2*C[16]+3*C[17]+7*C[18]);if(D<=M&&D<=N)return sP(t,c,e.subarray(u,u+l));if(sE(t,c,1+(N<M)),c+=2,N<M){d=sv(v,m,0),f=v,h=sv(b,_,0),p=b;var L=sv(O,A,0);sE(t,c,E-257),sE(t,c+5,x-1),sE(t,c+10,R-4),c+=14;for(var T=0;T<R;++T)sE(t,c+3*T,O[ss[T]]);c+=3*R;for(var U=[S,I],q=0;q<2;++q)for(var j=U[q],T=0;T<j.length;++T){var F=31&j[T];sE(t,c,L[F]),c+=O[F],F>15&&(sE(t,c,j[T]>>>5&127),c+=j[T]>>>12)}}else d=sb,f=sm,h=s_,p=sy;for(var T=0;T<a;++T)if(n[T]>255){var F=n[T]>>>18&31;sk(t,c,d[F+257]),c+=f[F+257],F>7&&(sE(t,c,n[T]>>>23&31),c+=si[F]);var B=31&n[T];sk(t,c,h[B]),c+=p[B],B>3&&(sk(t,c,n[T]>>>5&8191),c+=so[B])}else sk(t,c,d[n[T]]),c+=f[n[T]];return sk(t,c,d[256]),c+f[256]},sA=new sn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sR=function(e,t,r,n,i,o){var s=e.length,a=new st(n+s+5*(1+Math.floor(s/7e3))+i),u=a.subarray(n,a.length-i),l=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var d=c+65535;d<s?l=sP(u,l,e.subarray(c,d)):(u[c]=o,l=sP(u,l,e.subarray(c,s)))}else{for(var f=sA[t-1],h=f>>>13,p=8191&f,g=(1<<r)-1,v=new sr(32768),m=new sr(g+1),y=Math.ceil(r/3),b=2*y,_=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&g},w=new sn(25e3),S=new sr(288),E=new sr(32),k=0,I=0,c=0,x=0,C=0,T=0;c<s;++c){var P=_(c),O=32767&c,A=m[P];if(v[O]=A,m[P]=O,C<=c){var R=s-c;if((k>7e3||x>24576)&&R>423){l=sO(e,u,0,w,S,E,I,x,T,c-T,l),x=k=I=0,T=c;for(var D=0;D<286;++D)S[D]=0;for(var D=0;D<30;++D)E[D]=0}var M=2,N=0,L=p,U=O-A&32767;if(R>2&&P==_(c-U))for(var q=Math.min(h,R)-1,j=Math.min(32767,c),F=Math.min(258,R);U<=j&&--L&&O!=A;){if(e[c+M]==e[c+M-U]){for(var B=0;B<F&&e[c+B]==e[c+B-U];++B);if(B>M){if(M=B,N=U,B>q)break;for(var V=Math.min(U,B-2),K=0,D=0;D<V;++D){var z=c-U+D+32768&32767,W=v[z],H=z-W+32768&32767;H>K&&(K=H,A=z)}
1}}A=v[O=A],U+=O-A+32768&32767}if(N){w[x++]=0x10000000|sc[M]<<18|sf[N];var G=31&sc[M],$=31&sf[N];I+=si[G]+so[$],++S[257+G],++E[$],C=c+M,++k}else w[x++]=e[c],++S[e[c]]}}l=sO(e,u,o,w,S,E,I,x,T,c-T,l)}return sS(a,0,n+sw(l)+i)},sD=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)n+=r[s],i+=n;n%=65521,i%=65521}e=n,t=i},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+((255&e)<<23)*2}}},sM=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},sN=function(e,t){var r=t.level,n=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=n<<6|(n?32-2*n:1)},sL=function(){function e(e,t,r,n){var i,o=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t,r,n,i,o;return JSON.stringify(function(e,t){var r="";if(!t&&"u">typeof TextDecoder)return new TextDecoder().decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((31&i)<<6|63&e[n++]):i<240?r+=String.fromCharCode((15&i)<<12|(63&e[n++])<<6|63&e[n++]):r+=String.fromCharCode(55296|(i=((15&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536)>>10,56320|1023&i)}return r}((t=function(e){var t=e.length;if("u">typeof TextEncoder)return new TextEncoder().encode(e);for(var r=new st(e.length+(e.length>>>1)),n=0,i=function(e){r[n++]=e},o=0;o<t;++o){if(n+5>r.length){var s=new st(n+8+(t-o<<1));s.set(r),r=s}var a=e.charCodeAt(o);a<128?i(a):(a<2048?i(192|a>>>6):(a>55295&&a<57344?(i(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++o))>>>18),i(128|a>>>12&63)):i(224|a>>>12),i(128|a>>>6&63)),i(128|63&a))}return sS(r,0,n)}(JSON.stringify({...e,v:"v1"})),void 0===r&&(r={}),(n=sD()).p(t),sN(o=sR(t,null==(i=r).level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,2,4,!0),r),sM(o,o.length-4,n.d()),o),!0))},this.addCompressedEventToManager=function(e,t){o.eventsManager&&o.deviceId&&o.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:o.deviceId})},this.addCompressedEvent=function(e,t){if(o.worker)try{o.worker.postMessage({event:e,sessionId:t})}catch(r){"DataCloneError"===r.name?o.worker.postMessage(JSON.stringify({event:e,sessionId:t})):o.config.loggerProvider.warn("Unexpected error while posting message to worker:",r)}else{var r=o.compressEvent(e);o.addCompressedEventToManager(r,t)}},this.terminate=function(){var e;null==(e=o.worker)||e.terminate()};var s=(0,ez.getGlobalScope)();if(this.canUseIdleCallback=s&&"requestIdleCallback"in s,this.eventsManager=e,this.config=t,this.deviceId=r,this.timeout=(null==(i=t.performanceConfig)?void 0:i.timeout)||2e3,n){t.loggerProvider.log("Enabling web worker for compression");try{var a=new Blob([n],{type:"application/javascript"}),u=URL.createObjectURL(a),l=new Worker(u);l.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression:",e),l.terminate(),o.worker=void 0},l.onmessage=function(e){var t=e.data,r=t.compressedEvent,n=t.sessionId;o.addCompressedEventToManager(r,n)},this.worker=l}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){var r;this.canUseIdleCallback&&(null==(r=this.config.performanceConfig)?void 0:r.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var r=this.taskQueue.shift();if(r){var n=r.event,i=r.sessionId;this.addCompressedEvent(n,i)}}this.taskQueue.length>0?requestIdleCallback(function(e){t.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e}(),sU="Session replay event batch rejected due to exceeded retry count",sq="Failed to store session replay events in IndexedDB",sj="1.35.1",sF=function(){function e(e){var t=e.trackServerUrl,r=e.loggerProvider,n=e.payloadBatcher;this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.loggerProvider=r,this.payloadBatcher=n||function(e){return e},this.trackServerUrl=t}return e.prototype.sendEventsList=function(e){this.addToQueue((0,ey.__assign)((0,ey.__assign)({},e),{attempts:0,timeout:0}))},e.prototype.addToQueue=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];t.filter(function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:sU}),!1)}
1).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),a.label=1;case 1:a.trys.push([1,6,7,8]),n=(r=(0,ey.__values)(t)).next(),a.label=2;case 2:if(n.done)return[3,5];return i=n.value,[4,this.send(i,e)];case 3:a.sent(),a.label=4;case 4:return n=r.next(),[3,2];case 5:return[3,8];case 6:return o={error:a.sent()},[3,8];case 7:try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.send=function(e,t){var r,n;return void 0===t&&(t=!0),(0,ey.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u,l,c,d,f,h,p,g;return(0,ey.__generator)(this,function(v){switch(v.label){case 0:if(!(i=e.apiKey))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})];if(!(o=e.deviceId))return[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})];if(s=oH(),a=sj,u=e.sampleRate,l=new URLSearchParams({device_id:o,session_id:"".concat(e.sessionId),type:"".concat(e.type)}),c="".concat((null==(r=e.version)?void 0:r.type)||"standalone","/").concat((null==(n=e.version)?void 0:n.version)||a),0===(d=this.payloadBatcher({version:1,events:e.events})).events.length)return this.completeRequest({context:e}),[2];v.label=1;case 1:return v.trys.push([1,6,,7]),f={headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(i),"X-Client-Version":a,"X-Client-Library":c,"X-Client-Url":s.substring(0,1e3),"X-Client-Sample-Rate":"".concat(u),"X-Sampling-Hash-Alg":"xxhash32"},body:JSON.stringify(d),method:"POST"},[4,fetch("".concat(oG(e.serverZone,this.trackServerUrl),"?").concat(l.toString()),f)];case 2:if(null===(h=v.sent()))return this.completeRequest({context:e,err:"Unexpected error occurred"}),[2];if(t)return[3,3];p="";try{p=JSON.stringify(h.body,null,2)}catch(e){}return this.completeRequest({context:e,success:"".concat(h.status,": ").concat(p)}),[3,5];case 3:return[4,this.handleReponse(h.status,e)];case 4:v.sent(),v.label=5;case 5:return[3,7];case 6:return g=v.sent(),this.completeRequest({context:e,err:g}),[3,7];case 7:return[2]}})})},e.prototype.handleReponse=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){switch(r.label){case 0:switch(new rl().buildStatus(e)){case J.Success:return[3,1];case J.Failed:return[3,2]}return[3,4];case 1:return this.handleSuccessResponse(t),[3,5];case 2:return[4,this.handleOtherResponse(t)];case 3:return r.sent(),[3,5];case 4:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),r.label=5;case 5:return[2]}})})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(t=e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0))return this.completeRequest({context:e,err:sU}),[2];return[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return r.sent(),[4,this.send(e,!0)];case 2:return r.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,r=e.err,n=e.success;t.onComplete(),r?this.loggerProvider.warn(r):n&&this.loggerProvider.log(n)},e}(),sB=e.i(601217),sV=function(){function e(e){var t,r,n,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=1e6,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var r=i.getStringSize(t);return i.getEventsArraySize(e)+r>
1=i.maxPersistedEventsSize||Date.now()-i.timeAtLastSplit>i.interval&&!!e.length&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!=(t=e.minInterval)?t:this.minInterval,this.maxInterval=null!=(r=e.maxInterval)?r:this.maxInterval,this.maxPersistedEventsSize=null!=(n=e.maxPersistedEventsSize)?n:this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){return e.length},e.prototype.getEventsArraySize=function(e){var t,r,n=0;try{for(var i=(0,ey.__values)(e),o=i.next();!o.done;o=i.next()){var s=o.value;n+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n+(2+Math.max(0,e.length-1)+2*e.length)},e}(),sK=function(e,t,r){"object"==typeof r&&null!==r&&"AbortError"===r.name?e.debug(t):e.warn(t)},sz="sessionCurrentSequence",sW="sequencesToSend",sH=function(e){var t,r;return e.objectStoreNames.contains(sz)||(r=e.createObjectStore(sz,{keyPath:"sessionId"})),e.objectStoreNames.contains(sW)||(t=e.createObjectStore(sW,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:r}},sG=function(e){function t(t){var r=e.call(this,t)||this;return r.getSequencesToSend=function(){return(0,ey.__awaiter)(r,void 0,void 0,function(){var e,t,r,n,i,o;return(0,ey.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),e=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:t=s.sent(),s.label=2;case 2:if(!t)return[3,4];return n=(r=t.value).sessionId,i=r.events,e.push({events:i,sequenceId:t.key,sessionId:n}),[4,t.continue()];case 3:return t=s.sent(),[3,2];case 4:return[2,e];case 5:return o=s.sent(),sK(this.loggerProvider,"".concat(sq,": ").concat(o),o),[3,6];case 6:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return(0,ey.__awaiter)(r,void 0,void 0,function(){var t,r,n;return(0,ey.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(sz,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(sW,{sessionId:e,events:t.events})];case 2:return r=i.sent(),[4,this.db.put(sz,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,ey.__assign)((0,ey.__assign)({},t),{sessionId:e,sequenceId:r})];case 4:return n=i.sent(),sK(this.loggerProvider,"".concat(sq,": ").concat(n),n),[3,5];case 5:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return(0,ey.__awaiter)(r,void 0,void 0,function(){var r,n,i,o,s,a;return(0,ey.__generator)(this,function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),[4,(r=this.db.transaction(sz,"readwrite")).store.get(e)];case 1:if(n=u.sent())return[3,3];return[4,r.store.put({sessionId:e,events:[t]})];case 2:return u.sent(),[2];case 3:if(i=void 0,!this.shouldSplitEventsList(n.events,t))return[3,5];return i=n.events,[4,r.store.put({sessionId:e,events:[t]})];case 4:return u.sent(),[3,7];case 5:return o=n.events.concat(t),[4,r.store.put({sessionId:e,events:o})];case 6:u.sent(),u.label=7;case 7:return[4,r.done];case 8:if(u.sent(),!i)return[2,void 0];return[4,this.storeSendingEvents(e,i)];case 9:if(!(s=u.sent()))return[2,void 0];return[2,{events:i,sessionId:e,sequenceId:s}];case 10:return a=u.sent(),sK(this.loggerProvider,"".concat(sq,": ").concat(a),a),[3,11];case 11:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return(0,ey.__awaiter)(r,void 0,void 0,function(){var r;return(0,ey.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.db.put(sW,{sessionId:e,events:t})];case 1:return[2,n.sent()];case 2:return r=n.sent(),sK(this.loggerProvider,"".concat(sq,": ").concat(r),r),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return(0,ey.__awaiter)(r,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(!t)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.db.delete(sW,t)];case 2:return r.sent(),[3,4];case 3:return e=r.sent(),sK(this.loggerProvider,"".concat(sq,": ").concat(e),e),[3,4];case 4:return[2]}})})},r.db=t.db,r}return(0,ey.__extends)(t,e),t.new=function(e,r){return(0,ey.__awaiter)(this,void 0,void 0,function(){var n,i,o;return(0,ey.__generator)(this,function(s){switch(s.label){case 0:var a;return s.trys.push([0,2,,3]),n="replay"===e?"":"_".concat(e),[4,(a="".concat(r.a
1piKey.substring(0,10),"_amp_session_replay_events").concat(n),(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,sB.openDB)(a,1,{upgrade:sH})];case 1:return[2,e.sent()]}})}))];case 1:return i=s.sent(),[2,new t((0,ey.__assign)((0,ey.__assign)({},r),{db:i}))];case 2:return o=s.sent(),sK(r.loggerProvider,"".concat(sq,": ").concat(o),o),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r,n,i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=a.sent()))return[2,void 0];return[2,[t]];case 2:r=[],a.label=3;case 3:return a.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=(n=ey.__values.apply(void 0,[a.sent()])).next(),a.label=5;case 5:if(i.done)return[3,7];t=i.value,r.push(t),a.label=6;case 6:return i=n.next(),[3,5];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{i&&!i.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 10:return[2,r]}})})},t}(sV),s$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return(0,ey.__extends)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,r=(0,ey.__spreadArray)([],(0,ey.__read)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:r},this.resetCurrentSequence(e),{sequenceId:t,events:r,sessionId:e}},t.prototype.getSequencesToSend=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=(0,ey.__read)(e,2),r=t[0],n=t[1],i=n.sessionId,o=n.events;return{sequenceId:Number(r),sessionId:i,events:o}})]})})},t.prototype.storeCurrentSequence=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){var r;return(0,ey.__generator)(this,function(n){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(r=this.addSequence(e)),this.sequences[e].push(t),[2,r]})})},t.prototype.storeSendingEvents=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(sV),sJ=function(e){var t=e.config,r=e.minInterval,n=e.maxInterval,i=e.type,o=e.payloadBatcher,s=e.storeType;return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e,a,u,l,c;function d(t){return void 0===t&&(t=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return[2,e.flush(t)]})})}return(0,ey.__generator)(this,function(f){switch(f.label){case 0:if(e=new sF((0,ey.__assign)((0,ey.__assign)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o})),a=function(){return new s$({loggerProvider:t.loggerProvider,maxInterval:n,minInterval:r})},"idb"!==s)return[3,2];return[4,(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:return[4,sG.new(i,{loggerProvider:t.loggerProvider,minInterval:r,maxInterval:n,apiKey:t.apiKey})];case 1:if(!(e=o.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,a()];return[2,e]}})})];case 1:return l=f.sent(),[3,3];case 2:l=a(),f.label=3;case 3:return u=l,c=function(r){var n=r.events,o=r.sessionId,s=r.deviceId,a=r.sequenceId;t.debugMode&&oQ().then(function(e){var r=e.totalStorageSize,n=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(r," KB, percentage of quota: ").concat(n,"%, usage details: ").concat(i))}).catch(function(){}),e.sendEventsList({events:n,sessionId:o,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,ey.__awaiter)(void 0,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){switch(e.label){case 0:return[4,u.cleanUpSessionEventsStore(o,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var r=e.sessionId,n=e.deviceId;u.storeCurrentSequence(r).then(function(e){e&&c({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})},addEvent:function(e){var r=e.event,n=e.sessionId,i=e.deviceId;u.addEventToCurrentSequence(n,r.data).then(function(e){return e&&c({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i})}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var t=e.deviceId;return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return[4,u.getSequencesToSend()];case 1:return(e=r.sent())&&e.forEach(function(e){c({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:d}]}})})},sX=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new Map;e.forEach(function(e){r.set(e.name,e.manager)}),this.managers=r}return e.prototype.sendStoredEvents=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEac
1h(function(r){t.push(r.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,r=e.sessionId,n=e.event,i=e.deviceId;null==(t=this.managers.get(n.type))||t.addEvent({sessionId:r,event:n,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,r=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:r})})},e.prototype.flush=function(e){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t;return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return t=[],this.managers.forEach(function(r){t.push(r.flush(e))}),[4,Promise.all(t)];case 1:return r.sent(),[2]}})})},e}();function sQ(e,t,r){for(var n=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-ed.getTime();if(void 0!==el.timeoutMs&&c>el.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=s5((e=o.getAttribute("id"))&&el.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||s5.apply(void 0,(0,ey.__spreadArray)([],(0,ey.__read)(Array.from(o.attributes).filter(function(e){return el.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||s5.apply(void 0,(0,ey.__spreadArray)([],(0,ey.__read)(Array.from(o.classList).filter(el.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||s5((a=o.tagName.toLowerCase(),el.tagName(a)?{name:a,penalty:2}:null))||[s2()],f=function(e){var t=e.parentNode;if(!t)return null;var r=t.firstChild;if(!r)return null;for(var n=0;r&&(r.nodeType===Node.ELEMENT_NODE&&n++,r!==e);)r=r.nextSibling;return n}(o);if("all"==t)f&&(d=d.concat(d.filter(s4).map(function(e){return s3(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(s4).map(function(e){return s3(e,f)})));else if("one"==t){var h=(0,ey.__read)(d=d.slice(0,1),1)[0];f&&s4(h)&&(d=[s3(h,f)])}else"none"==t&&(d=[s2()],f&&(d=[s3(d[0],f)]));try{for(var p=(u=void 0,(0,ey.__values)(d)),g=p.next();!g.done;g=p.next()){var h=g.value;h.level=s}}catch(e){u={error:e}}finally{try{g&&!g.done&&(l=p.return)&&l.call(p)}finally{if(u)throw u.error}}if(i.push(d),i.length>=el.seedMinLength&&(n=sY(i,r)))return"break";o=o.parentElement,s++}(););return(n||(n=sY(i,r)),!n&&r)?r():n}function sY(e,t){var r,n,i=s8(function e(t,r){var n,i,o,s,a;return void 0===r&&(r=[]),(0,ey.__generator)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(n=(0,ey.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,ey.__values)(e(t.slice(1,t.length),r.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,r];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>el.threshold)return t?t():null;try{for(var o=(0,ey.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(s1(a))return a}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null}function sZ(e){for(var t=e[0],r=t.name,n=1;n<e.length;n++){var i=e[n].level||0;r=t.level===i-1?"".concat(e[n].name," > ").concat(r):"".concat(e[n].name," ").concat(r),t=e[n]}return r}function s0(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function s1(e){var t=sZ(e);switch(ec.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function s2(){return{name:"*",penalty:3}}function s3(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function s4(e){return"html"!==e.name&&!e.name.startsWith("#")}function s5(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.filter(s6);return r.length>0?r:null}function s6(e){return null!=e}function s8(e){return(0,ey.__spreadArray)([],(0,ey.__read)(e),!1).sort(function(e,t){return s0(e)-s0(t)})}var s7=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&n.push(t)}),{version:t,events:n}},s9=function(e){var t=e.version,r=e.events,n=[];return r.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&n.push(t)}),{version:t,events:Object.values(n.reduce(function(e,t){var r=t.x,n=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(r,":").concat(n,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,ey.__assign)((0,ey.__assign)({},t),{timestamp:s,count:1}),e},{}))}},ae=function(e,t){var r=this;this.createHook=function(e){var t=e.eventsManager,n=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type!==o3.Click)return;var u,l=(0,ez.getGlobalScope)();
1if(l){var c=l.location,d=l.innerHeight,f=l.innerWidth;if(c){var h=e.x,p=e.y;if(void 0!==h&&void 0!==p){var g=o.getNode(e.id);if(g)try{u=function(e,t){if(ed=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r,n,i={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};r=(el=(0,ey.__assign)((0,ey.__assign)({},i),t)).root,n=i,ec=r.nodeType===Node.DOCUMENT_NODE?r:r===n.root?r.ownerDocument:r;var o=sQ(e,"all",function(){return sQ(e,"two",function(){return sQ(e,"one",function(){return sQ(e,"none")})})});if(o){var s=s8(function e(t,r,n){var i,o,s;return void 0===n&&(n={counter:0,visited:new Map}),(0,ey.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>el.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u,l;if(!(i<t.length-1))return[3,5];if(n.counter>el.maxNumberOfTries||(n.counter+=1,(o=(0,ey.__spreadArray)([],(0,ey.__read)(t),!1)).splice(i,1),s=sZ(o),n.visited.has(s)))return[2];if(!(s1(o)&&(u=o,l=r,ec.querySelector(sZ(u))===l)))return[3,4];return[4,o];case 2:return a.sent(),n.visited.set(s,!0),[5,(0,ey.__values)(e(o,r,n))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(o,e));return s.length>0&&(o=s[0]),sZ(o)}throw Error("Selector was not found.")}(g,a)}catch(e){r.logger.debug("error resolving selector from finder")}var v=oX(c.href,s),m={x:h+r.scrollWatcher.currentScrollX,y:p+r.scrollWatcher.currentScrollY,selector:u,viewportHeight:d,viewportWidth:f,pageUrl:v,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:n,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}},this.logger=e,this.scrollWatcher=t};function at(){var e=(0,ez.getGlobalScope)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function ar(){var e=(0,ez.getGlobalScope)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var an=function(){function e(e,t){var r=(0,ez.getGlobalScope)();r&&r.navigator&&"function"==typeof r.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(r.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var r=new XMLHttpRequest;return r.open("POST",e,!0),r.setRequestHeader("Accept","*/*"),r.send(JSON.stringify(t)),!0},this.basePageUrl=oG(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var r=this.context,n=r.sessionId,i=r.type,o=new URLSearchParams({device_id:e,session_id:String(n),type:String(i),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),ai=function(){function e(e,t){var r=this;this.timestamp=Date.now(),this.hook=function(e){r.update(e)},this.send=function(e){return function(t){var n,i,o,s,a=e(),u=(0,ez.getGlobalScope)();if(u&&a){var l=null!=(n=u.scrollX)?n:0,c=null!=(i=u.scrollY)?i:0;(l>0||c>0)&&r.update({id:1,x:l,y:c}),r.transport.send(a,{version:1,events:[{maxScrollX:r._maxScrollX,maxScrollY:r._maxScrollY,maxScrollWidth:r._maxScrollWidth,maxScrollHeight:r._maxScrollHeight,viewportHeight:at(),viewportWidth:ar(),pageUrl:oX(u.location.href,null!=(s=null==(o=r.config.interactionConfig)?void 0:o.ugcFilterRules)?s:[]),timestamp:r.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=ar(),this._maxScrollHeight=at(),this.config=t,this.transport=e}return e.default=function(t,r){return new e(new an(t,r),r)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var r=ar();this._maxScrollX=e.x;var n=e.x+r;n>this._maxScrollWidth&&(this._maxScrollWidth=n),this.timestamp=t}if(e.y>this._maxScrollY){var i=at();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),ao=function(e){var t=e.sessionId,r=e.deviceId;this.deviceId=r,this.sessionId=t,t&&r&&(this.sessionReplayId="".concat(r,"/").concat(t))},as=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,ey.__awaiter)(e,void 0,void 0,function(){return(0,ey.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,sB.openDB)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,ey.__awaiter)(e,void 0,void 0,function(){var e,r;return(0,ey.__generator)(this,function(n){switch(n.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return r=n.sent(),this.dbs[t]=r,[2,r]}})})},this.getTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId;return(0,ey.__awaiter)(e,void 0,void 0,function(){var e,t,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),sK(r,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.sessionId,o=t.targetingMatch;return(0,ey.__awaiter)(e,void 0,void 0,function(){var e,t,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(n)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),sK(r,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var r=t.loggerProvider,n=t.apiKey,i=t.currentSessionId;return(0,ey.__awaiter)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,ey.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(n)];case 1:return e=d.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=d.sent(),a=0,d.label=3;case 3:if(!(a<s.length))return[3,6];if(u=s[a],l=Date.now()-u.lastUpdated,!(u.sessionId!==t&&l>1728e5))return[3,5];return[4,o.store.delete(u.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),sK(r,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},aa=function(t){var r=t.sessionId,n=t.targetingConfig,i=t.loggerProvider,o=t.apiKey,s=t.targetingParams,a=t.urlChange,u=void 0!==a&&a;return(0,ey.__awaiter)(void 0,void 0,void 0,function(){var t,a,l;return(0,ey.__generator)(this,function(c){switch(c.label){case 0:return[4,as.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:r})];case 1:return c.sent(),[4,as.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r})];case 2:if(!0===c.sent()&&!u)return[2,!0];t=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,e.A(18737)];case 4:return[4,(0,c.sent().evaluateTargeting)((0,ey.__assign)((0,ey.__assign)({},s),{flag:n,sessionId:"string"==typeof r?parseInt(r,10):r,apiKey:o,loggerProvider:i}))];case 5:return(a=c.sent())&&a.sr_targeting_config&&(t="on"===a.sr_targeting_config.key),as.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:r,targetingMatch:t}),[3,7];case 6:return l=c.sent(),i.warn(l.message),[3,7];case 7:return[2,t]}})})};function au(e,t){return(e<<t|e>>>32-t)>>>0}
1function al(e,t){return Math.imul(e=au(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function ac(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var ad="__amplitude_url_tracking_patched__",af=new WeakMap;function ah(e,t,r){if(void 0===r&&(r={}),!(null==e?void 0:e.location))return function(){};var n=r.enablePolling,i=r.pollingInterval;if(void 0!==n&&n){var o=function(){var t;return null!=(t=e.location.href)?t:""},s=o(),a=e.setInterval(function(){var e=o();e!==s&&(s=e,t(e))},void 0===i?1e3:i);return function(){null!=a&&e.clearInterval(a)}}var u=af.get(e);if(!u){var l=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},f=function(){var e=d();(void 0===l||e!==l)&&(l=e,c.forEach(function(t){return t(e)}))},h=function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=e.apply(this,t);return f(),n};return t[ad]=!0,t},p=e.history;if(null==p?void 0:p.pushState){var g=Reflect.get(p,"pushState");g[ad]||(p.pushState=h(g))}if(null==p?void 0:p.replaceState){var v=Reflect.get(p,"replaceState");v[ad]||(p.replaceState=h(v))}u={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},af.set(e,u)}var m=u;return m.listenersAttached||(e.addEventListener("popstate",m.onPopStateOrHashChange),e.addEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!0),m.callbacks.add(t),function(){m.callbacks.delete(t),0===m.callbacks.size&&m.listenersAttached&&(e.removeEventListener("popstate",m.onPopStateOrHashChange),e.removeEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!1)}}function ap(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,r,n){var i,o,s,a=(0,ey.__assign)((0,ey.__assign)({},e),n),u=a.ugcFilterRules||[],l=null!=(i=a.enablePolling)&&i,c=null!=(o=a.pollingInterval)?o:1e3,d=null!=(s=a.captureDocumentTitle)&&s;if(!r)return function(){};var f=void 0,h=function(){return r.location&&r.location.href||""},p=function(){var e=r.innerHeight,t=r.innerWidth,n=r.document,i=h(),o="";return d&&(o=(null==n?void 0:n.title)||""),{href:u.length>0?oX(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},g=function(){var e=h();(void 0===f||e!==f)&&(f=e,t(p()))},v=ah(r,function(){return g()},l?{enablePolling:!0,pollingInterval:c}:{});return g(),function(){return v()}},options:e}}ap();var ag=function(){function t(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.urlChangeCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var r=(0,ez.getGlobalScope)();r&&(r.removeEventListener("blur",e.blurListener),r.removeEventListener("focus",e.focusListener),t||r.addEventListener("blur",e.blurListener),t||r.addEventListener("focus",e.focusListener),r.self&&"onpagehide"in r.self?(r.removeEventListener("pagehide",e.pageLeaveListener),t||r.addEventListener("pagehide",e.pageLeaveListener)):(r.removeEventListener("beforeunload",e.pageLeaveListener),t||r.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,r,n,i){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===i&&(i=!1),(0,ey.__awaiter)(e,void 0,void 0,function(){var e,o,s,a,u,l,c,d,f,h,p,g;return(0,ey.__generator)(this,function(v){switch(v.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig)if(!r)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];else this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.");if(this.lastTargetingParams=t,!((e=this.config.targetingConfig)&&!this.sessionTargetingMatch))return[3,2];return o=i?this.latestUrlChangeTargetingEvaluationId:void 0,(s=t.event)&&Object.values(G).includes(s.event_type)&&(s=void 0),a=null!=(p=null!=(d=null==(c=t.page)?void 0:c.url)?d:null==(h=null==(f=(0,ez.getGlobalScope)())?void 0:f.location)?void 0:h.href)?p:"",u=null!=(g=t.page)?g:""!==a?{url:a}:void 0,[4,aa({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:u},urlChange:i})];case 1:if(l=v.sent(),i&&void 0!==o&&o!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(o,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||l,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),v.label=2;case 2:if(!r)return[3,3];return this.initialize(!0),[3,5];case 3:if(!(n||!this.recordCancelCallback))return[3,5];return this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()];case 4:v.sent(),v.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n=!0),(0,ey.__awaiter)(e,void 0,void 0,function(){var e,i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==eu.METADATA)||(e={config:oY(i),version:sj},!n))return[3,2];return[4,oQ()];case 1:o=a.sent(),e=(0,ey.__assign)((0,ey.__assign)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,ey.__assign)((0,ey.__assign)({},r),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return s=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",s),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop()}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}}
1,this.loggerProvider=new oB(new e1)}return t.prototype.init=function(e,t){return eQ(this._init(e,t))},t.prototype.setupUrlChangeListenerForTargeting=function(){var e,t=this;null==(e=this.urlChangeCleanup)||e.call(this);var r=(0,ez.getGlobalScope)();if(null==r?void 0:r.location){var n=ah(r,function(e){var r=++t.latestUrlChangeTargetingEvaluationId;t.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),t.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(r," for ").concat(e,"."))});this.urlChangeCleanup=function(){n(),t.urlChangeCleanup=null}}},t.prototype.getCurrentPageForTargeting=function(){var e,t,r=null==(t=null==(e=(0,ez.getGlobalScope)())?void 0:e.location)?void 0:t.href;return null!=r?{url:r}:void 0},t.prototype._init=function(t,r){var n,i,o,s,a,u,l,c;return(0,ey.__awaiter)(this,void 0,void 0,function(){var d,f,h,p,g,v,m,y,b,_,w,S,E,k,I;return(0,ey.__generator)(this,function(x){switch(x.label){case 0:return null==(n=this.urlChangeCleanup)||n.call(this),this.loggerProvider=new oB(r.loggerProvider||new e1),Object.prototype.hasOwnProperty.call(r,"logLevel")&&this.loggerProvider.enable(r.logLevel),this.identifiers=new ao({sessionId:r.sessionId,deviceId:r.deviceId}),d=this,[4,(0,ey.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,ey.__generator)(this,function(n){return e=new o0(t,r),[2,new se(new tk(t,e.loggerProvider,e.serverZone,r.configServerUrl),e)]})})];case 1:return d.joinedConfigGenerator=x.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:h=(f=x.sent()).joinedConfig,p=f.localConfig,g=f.remoteConfig,this.config=h,this.setMetadata(r.sessionId,h,p,g,null==(i=r.version)?void 0:i.version,sj,null==(o=r.version)?void 0:o.type),r.sessionId&&(null==(s=this.config.interactionConfig)?void 0:s.enabled)&&(v=ai.default({sessionId:r.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[v.send(this.getDeviceId.bind(this)).bind(v)],this.scrollHook=v.hook.bind(v),this.clickHandler=new ae(this.loggerProvider,v)),m=[],"idb"!==(y=this.config.storeType)||(null==(a=(0,ez.getGlobalScope)())?void 0:a.indexedDB)||(y="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(y," for event storage.")),x.label=3;case 3:return x.trys.push([3,5,,6]),[4,sJ({config:this.config,type:"replay",storeType:y})];case 4:return b=x.sent(),m.push({name:"replay",manager:b}),[3,6];case 5:return _=x.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(_.toString())),[3,6];case 6:if(!(null==(u=this.config.interactionConfig)?void 0:u.enabled))return[3,10];w=this.config.interactionConfig.batch?s9:s7,x.label=7;case 7:return x.trys.push([7,9,,10]),[4,sJ({config:this.config,type:"interaction",minInterval:null!=(l=this.config.interactionConfig.trackEveryNms)?l:3e4,maxInterval:6e4,payloadBatcher:w,storeType:y})];case 8:return S=x.sent(),m.push({name:"interaction",manager:S}),[3,10];case 9:return _=x.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(_.toString())),[3,10];case 10:if(this.eventsManager=new(sX.bind.apply(sX,(0,ey.__spreadArray)([void 0],(0,ey.__read)(m),!1))),this.eventCompressor&&this.eventCompressor.terminate(),E=void 0,k=(0,ez.getGlobalScope)(),!(this.config.useWebWorker&&k&&k.Worker))return[3,12];return[4,e.A(936283)];case 11:E=x.sent().compressionScript,x.label=12;case 12:return this.eventCompressor=new sL(this.eventsManager,this.config,this.getDeviceId(),E),[4,this.initializeNetworkObservers()];case 13:return x.sent(),(null==(c=(0,ez.getGlobalScope)())?void 0:c.opener)&&(ng(I=nh()),I.setup((0,ey.__assign)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:nl[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:r.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 14:return x.sent(),this.config.targetingConfig&&this.setupUrlChangeListenerForTargeting(),[2]}})})},t.prototype.setSessionId=function(e,t){return eQ(this.asyncSetSessionId(e,t))},t.prototype.asyncSetSessionId=function(e,t,r){var n;return(0,ey.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,ey.__generator)(this,function(a){switch(a.label){case 0:if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(i=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(i),o=t||this.getDeviceId(),this.identifiers=new ao({sessionId:e,deviceId:o}
1),!(this.joinedConfigGenerator&&i))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:s=a.sent().joinedConfig,this.config=s,a.label=2;case 2:if(!(null==(n=this.config)?void 0:n.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==r?void 0:r.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return a.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:a.sent(),a.label=6;case 6:return[2]}})})},t.prototype.getSessionReplayProperties=function(){var e,t=this.config,r=this.identifiers;if(!t||!r)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var n=this.getShouldRecord(),i={};return n&&((e={})[oD]=r.sessionReplayId?r.sessionReplayId:null,i=e,t.debugMode&&(i[oL]=JSON.stringify({appHash:tR(t.apiKey).toString()}))),this.addCustomRRWebEvent(eu.GET_SR_PROPS,{shouldRecord:n,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},t.prototype.sendEvents=function(e){var t,r=e||(null==(t=this.identifiers)?void 0:t.sessionId),n=this.getDeviceId();this.eventsManager&&r&&n&&this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:n})},t.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){var r;return(0,ey.__generator)(this,function(n){return(null==(t=this.identifiers)?void 0:t.sessionId)?(r=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:r}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},t.prototype.shouldOptOut=function(){if(null==(e=this.config)?void 0:e.instanceName){var e,t,r;r=tv(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==r?r:null==(t=this.config)?void 0:t.optOut},t.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,r=!1,n="",i=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(n="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(n),r=!0,i=!0):(n="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(n),r=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,function(e,t){void 0===t&&(t=0);var r,n=function(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){var i=e.charCodeAt(r+1);i>=56320&&i<=57343&&(n=(n-55296<<10)+(i-56320)+65536,r++)}n<128?t.push(n):n<2048?t.push(192|n>>6,128|63&n):n<65536?t.push(224|n>>12,128|n>>6&63,128|63&n):t.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n)}return new Uint8Array(t)}(e),i=n.length,o=0;if(i>=16){for(var s=t+0x9e3779b1+0x85ebca77>>>0,a=t+0x85ebca77>>>0,u=t>>>0,l=t-0x9e3779b1>>>0;o<=i-16;)s=al(s,ac(n,o)),o+=4,a=al(a,ac(n,o)),o+=4,u=al(u,ac(n,o)),o+=4,l=al(l,ac(n,o)),o+=4;r=au(s,1)+au(a,7)+au(u,12)+au(l,18)>>>0}else r=t+0x165667b1>>>0;for(r=r+i>>>0;o<=i-4;)r=Math.imul(au(r=r+Math.imul(ac(n,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)r=Math.imul(au(r=r+Math.imul(n[o],0x165667b1)>>>0,11),0x9e3779b1)>>>0,o++;return r^=r>>>15,r=Math.imul(r,0x85ebca77)>>>0,r^=r>>>13,r=Math.imul(r,0xc2b2ae3d)>>>0,(r^=r>>>16)>>>0}(e.toString())%1e6/1e6<t)?(r=!0,i=!0):(n="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(n),r=!1,i=!1),this.lastShouldRecordDecision!==r&&this.config.targetingConfig&&(this.addCustomRRWebEvent(eu.TARGETING_DECISION,{message:n,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=r),r},t.prototype.getBlockSelectors=function(){var e,t,r,n=null!=(r=null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.blockSelector)?r:[];if(0!==n.length)return n},t.prototype.getMaskTextSelectors=function(){if((null==(t=null==(e=this.config)?void 0:e.privacyConfig)?void 0:t.defaultMaskLevel)==="conservative")return"*";var e,t,r,n,i=null==(n=null==(r=this.config)?void 0:r.privacyConfig)?void 0:n.maskSelector;if(i)return i},t.prototype.getRecordingPlugins=function(t){var r,n,i,o,s,a;return(0,ey.__awaiter)(this,void 0,void 0,function(){var u,l,c,d;return(0,ey.__generator)(this,function(f){switch(f.label){case 0:u=[];try{l=ap({ugcFilterRules:(null==(n=null==(r=this.config)?void 0:r.interactionConfig)?void 0:n.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(o=this.config)?void 0:o.urlChangePollingInterval,captureDocumentTitle:null==(s=this.config)?void 0:s.captureDocumentTitle}),u.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==t?void 0:t.console)?void 0:a.enabled))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e.A(125065)];case 2:return c=f.sent().getRecordConsolePlugin,u.push(c({level:t.console.levels})),[3,4];case 3:return d=f.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,u.length>0?u:void 0]}})})},t.prototype.getRecordFunction=function(){return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,r;return(0,ey.__generator)(this,function(n){switch(n.label){case 0:if(this.recordFunction)return[2,this.recordFunction];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.A(568059)];case 2:return t=n.sent().record,this.recordFunction=t,[2,t];case 3:return r=n.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",r),[2,null];case 4:return[2]}})})},t.prototype.recordEvents=function(e){var t,r,n,i,o,s,a,u;return void 0===e&&(e=!0),(0,ey.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,h,p,g,v,m,y,b,_,w,S,E,
1k=this;return(0,ey.__generator)(this,function(I){switch(I.label){case 0:if(l=this.config,c=this.getShouldRecord(),d=null==(t=this.identifiers)?void 0:t.sessionId,!c||!d||!l)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(f=I.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:I.sent(),h=null==(r=l.loggingConfig)?void 0:r.network,p=[oq,oj,oF,oG(l.serverZone,l.trackServerUrl)],null==(n=this.networkObservers)||n.start(function(e){p.some(function(t){return e.url.startsWith(t)})||k.addCustomRRWebEvent(eu.FETCH_REQUEST,e)},h),g=l.privacyConfig,v=l.interactionConfig,m=l.loggingConfig,y=(null==v?void 0:v.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:f.mirror,ugcFilterRules:null!=(o=v.ugcFilterRules)?o:[],performanceOptions:null==(s=l.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},b=(null==v?void 0:v.enabled)&&v.ugcFilterRules?v.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),I.label=3;case 3:var x;return I.trys.push([3,5,,6]),_=this,w=f,E={emit:function(e){if(k.shouldOptOut()){k.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),k.stopRecordingEvents(),k.sendEvents();return}e.type===o1.Meta&&(e.data.href=oX(e.data.href,b)),k.eventCompressor&&k.eventCompressor.enqueueEvent(e,d)},inlineStylesheet:l.shouldInlineStylesheet,hooks:y,maskAllInputs:!0,maskTextClass:oU,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroundColorToBlockedElements:l.applyBackgroundColorToBlockedElements,maskInputFn:oW("input",g),maskTextFn:oW("text",g),maskAttributeFn:(x=g,function(e,t,r){var n;return"style"!==e&&(null!=(n=null==x?void 0:x.maskAttributes)?n:[]).includes(e)&&oz("text",x,r)?t.replace(/[^\s]/g,"*"):t}),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:null==(a=l.omitElementTags)?void 0:a.script,comment:null==(u=l.omitElementTags)?void 0:u.comment},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return k.loggerProvider.warn("Error while capturing replay: ",e.toString()),!0}},[4,this.getRecordingPlugins(m)];case 4:return _.recordCancelCallback=w.apply(void 0,[(E.plugins=I.sent(),E)]),this.addCustomRRWebEvent(eu.DEBUG_INFO),e&&this.addCustomRRWebEvent(eu.METADATA,this.metadata),[3,6];case 5:return S=I.sent(),this.loggerProvider.warn("Failed to initialize session replay:",S),[3,6];case 6:return[2]}})})},t.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},t.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},t.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},t.prototype.shutdown=function(){var e;null==(e=this.urlChangeCleanup)||e.call(this),this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},t.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},t.prototype.setMetadata=function(e,t,r,n,i,o,s){var a=(null==e?void 0:e.toString())?tR(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:r,remoteConfig:n,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},t.prototype.initializeNetworkObservers=function(){var t,r,n;return(0,ey.__awaiter)(this,void 0,void 0,function(){var i,o;return(0,ey.__generator)(this,function(s){switch(s.label){case 0:if(!((null==(n=null==(r=null==(t=this.config)?void 0:t.loggingConfig)?void 0:r.network)?void 0:n.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e.A(457192)];case 2:return i=s.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=s.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},t}(),av=function(e){return function(){var t=e.config||oZ();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let am={init:tt((P=new ag).init.bind(P),"init",av(P)),evaluateTargetingAndCapture:tt(P.evaluateTargetingAndCapture.bind(P),"evaluateTargetingAndRecord",av(P)),setSessionId:tt(P.setSessionId.bind(P),"setSessionId",av(P)),getSessionId:tt(P.getSessionId.bind(P),"getSessionId",av(P)),getSessionReplayProperties:tt(P.getSessionReplayProperties.bind(P),"getSessionReplayProperties",av(P)),flush:tt(P.flush.bind(P),"flush",av(P)),shutdown:tt(P.shutdown.bind(P),"shutdown",av(P))};var ay=am.init,ab=am.setSessionId,a_=am.getSessionId,aw=am.getSessionReplayProperties,aS=am.flush,aE=am.shutdown,ak=am.evaluateTargetingAndCapture;(O=ef||(ef={})).SET="$set",O.SET_ONCE="$setOnce",O.ADD="$add",O.APPEND="$append",O.PREPEND="$prepend",O.REMOVE="$remove",O.PREINSERT="$preInsert",O.POSTINSERT="$postInsert",O.UNSET="$unset",O.CLEAR_ALL="$clearAll",(A=eh||(eh={})).REVENUE_PRODUCT_ID="$productId",A.REVENUE_QUANTITY="$quantity",A.REVENUE_PRICE="$price",A.REVENUE_TYPE="$revenueType",A.REVENUE_CURRENCY="$currency",A.REVENUE="$revenue",(R=ep||(ep={})).IDENTIFY="$identify",R.GROUP_IDENTIFY="$groupidentify",R.REVENUE="revenue_amount";var aI=[ef.SET,ef.SET_ONCE,ef.ADD,ef.APPEND,ef.PREPEND,ef.POSTINSERT],ax=function(e){if(e.user_properties){var t={};
1return Object.keys(e.user_properties).forEach(function(r){if(aI.includes(r)){var n=e.user_properties&&e.user_properties[r];t=(0,ey.__assign)((0,ey.__assign)({},t),n)}}),t}},aC="1.27.6",aT="".concat("[Amplitude]"," Session Replay ID"),aP=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:aS,getSessionId:a_,getSessionReplayProperties:aw,init:ay,setSessionId:ab,shutdown:aE,evaluateTargetingAndCapture:ak},this.options=(0,ey.__assign)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var r,n,i,o,s,a,u,l;return(0,ey.__awaiter)(this,void 0,void 0,function(){var t,c;return(0,ey.__generator)(this,function(d){switch(d.label){case 0:var f;return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(aC,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=(0,ey.__assign)((0,ey.__assign)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),tg.getInstance(f)).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(r=this.options.deviceId)?r:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null==(n=this.config.remoteConfig)?void 0:n.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(i=this.options.privacyConfig)?void 0:i.blockSelector,maskSelector:null==(o=this.options.privacyConfig)?void 0:o.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(a=this.options.privacyConfig)?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:aC},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(u=this.options.useWebWorker)?u:null==(l=this.options.experimental)?void 0:l.useWebWorker,userProperties:t,omitElementTags:this.options.omitElementTags,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return d.sent(),[3,3];case 2:return c=d.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(c.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){switch(r.label){case 0:return null==(t=this.config)||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return r.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){switch(r.label){case 0:if(null==(t=this.config)||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,4];case 1:if(null==this.config)return[3,3];return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2:r.sent(),r.label=3;case 3:r.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,r,n;return(0,ey.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u;return(0,ey.__generator)(this,function(l){switch(l.label){case 0:if(l.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(i=this.options.customSessionId(e)))return[3,3];if(i===this.sessionReplay.getSessionId())return[3,2];return[4,this.sessionReplay.setSessionId(i).promise];case 1:l.sent(),l.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,ey.__assign)((0,ey.__assign)({},e.event_properties),o),l.label=3;case 3:return[3,8];case 4:if(!((i=null==(t=this.config)?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:l.sent(),l.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===G.IDENTIFY&&(s=ax(e)),a=(0,ez.getGlobalScope)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null==(r=null==a?void 0:a.location)?void 0:r.href)!=null?{url:a.location.href}:void 0})];case 7:l.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,ey.__assign)((0,ey.__assign)({},e.event_properties),o),l.label=8;case 8:return e.event_type===G.IDENTIFY&&e.event_properties&&delete e.event_properties[aT],[2,Promise.resolve(e)];case 9:return u=l.sent(),null==(n=this.config)||n.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(u.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),aO=e.i(659487),aA=function(e,t){return(aA=Object.setPrototypeOf||({__proto__:[]}
1)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 aR(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}aA(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var aD=function(){return(aD=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function aM(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function aN(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function aL(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function aU(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function aq(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var aj="is not",aF="contains",aB="does not contain",aV="less",aK="less or equal",az="greater",aW="greater or equal",aH="version less",aG="version less or equal",a$="version greater",aJ="version greater or equal",aX="set is",aQ="set is not",aY="set contains",aZ="set does not contain",a0="set contains any",a1="set does not contain any",a2=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return Uint8Array.from(t)},a3=function(e,t){void 0===t&&(t=0);for(var r=a2(e),n=r.length,i=n>>2,o=t,s=0;s<i;s++)o=a4(a8(r,s<<2),o);var a=i<<2,u=0;switch(n-a){case 3:u^=r[a+2]<<16,u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=a6(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=r[a+1]<<8,u^=r[a],o^=u=Math.imul(u=a6(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=r[a],o^=u=Math.imul(u=a6(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return a5(o^=n)>>>0},a4=function(e,t){var r=e,n=t;return n^=r=Math.imul(r=a6(r=Math.imul(r,-0x3361d2af),15),0x1b873593),(n=Math.imul(n=a6(n,13),5))+-0x19ab949c|0},a5=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-0x7a143595),t^=t>>>
113,t=Math.imul(t,-0x3d4d51cb),t^=t>>>16},a6=function(e,t,r){void 0===r&&(r=32),t>r&&(t%=r);var n=(e&0xffffffff<<r-t>>>0)>>>0>>>r-t>>>0;return(e<<t|n)>>>0},a8=function(e,t){return void 0===t&&(t=0),a7(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},a7=function(e){return(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24},a9=function(e,t){var r,n;if(t&&0!==t.length){try{for(var i=aL(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!s||!e||"object"!=typeof e)return;e=e[s]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}if(null==e)return;return e}},ue="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),ut=function(){function e(e,t,r,n){void 0===n&&(n=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=n}return e.parse=function(t){if(t){var r=new RegExp(ue).exec(t);if(r){var n=Number(r[1]),i=Number(r[2]);if(!(isNaN(n)||isNaN(i)))return new e(n,i,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){if(this.major>e.major)return 1;if(this.major<e.major)return -1;if(this.minor>e.minor)return 1;if(this.minor<e.minor)return -1;if(this.patch>e.patch)return 1;if(this.patch<e.patch||this.preRelease&&!e.preRelease)return -1;if(!this.preRelease&&e.preRelease)return 1;if(this.preRelease&&e.preRelease){if(this.preRelease>e.preRelease)return 1;if(this.preRelease<e.preRelease)return -1}return 0},e}(),ur=function(){function e(){}return e.prototype.evaluate=function(e,t){var r,n,i={},o={context:e,result:i};try{for(var s=aL(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.evaluateFlag(o,u);l&&(i[u.key]=l)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.prototype.evaluateFlag=function(e,t){try{for(var r,n,i,o=aL(t.segments),s=o.next();!s.done;s=o.next()){var a=s.value;if(i=this.evaluateSegment(e,t,a)){var u=aD(aD(aD({},t.metadata),a.metadata),i.metadata);i=aD(aD({},i),{metadata:u});break}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.evaluateSegment=function(e,t,r){if(!r.conditions){var n=this.bucket(e,r);return void 0!==n?t.variants[n]:void 0}if(this.evaluateConditions(e,r.conditions)){var n=this.bucket(e,r);if(void 0!==n)return t.variants[n]}},e.prototype.evaluateConditions=function(e,t){var r,n,i,o;try{for(var s=aL(t),a=s.next();!a.done;a=s.next()){var u=a.value,l=!0;try{for(var c=(i=void 0,aL(u)),d=c.next();!d.done;d=c.next()){var f=d.value;if(!(l=this.matchCondition(e,f)))break}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}if(l)return!0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1},e.prototype.matchCondition=function(e,t){var r=a9(e,t.selector);if(null==r)return this.matchNull(t.op,t.values);if(this.isSetOperator(t.op)){var n=this.coerceStringArray(r);return!!n&&this.matchSet(n,t.op,t.values)}var i=this.coerceString(r);return void 0!==i&&this.matchString(i,t.op,t.values)},e.prototype.getHash=function(e){return a3(e)},e.prototype.bucket=function(e,t){if(!t.bucket)return t.variant;var r,n,i,o,s=this.coerceString(a9(e,t.bucket.selector));if(!s||0===s.length)return t.variant;var a="".concat(t.bucket.salt,"/").concat(s),u=this.getHash(a),l=u%100,c=Math.floor(u/100);try{for(var d=aL(t.bucket.allocations),f=d.next();!f.done;f=d.next()){var h=f.value,p=h.range[0],g=h.range[1];if(l>=p&&l<g)try{for(var v=(i=void 0,aL(h.distributions)),m=v.next();!m.done;m=v.next()){var y=m.value,b=y.range[0],_=y.range[1];if(c>=b&&c<_)return y.variant}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return t.variant},e.prototype.matchNull=function(e,t){var r=this.containsNone(t);switch(e){case"is":case aF:case aV:case aK:case az:case aW:case aH:case aG:case a$:case aJ:case aX:case aY:case a0:return r;case aj:case aB:case aZ:case a1:return!r;default:return!1}},e.prototype.matchSet=function(e,t,r){switch(t){case aX:return this.setEquals(e,r);case aQ:return!this.setEquals(e,r);case aY:return this.matchesSetContainsAll(e,r);case aZ:return!this.matchesSetContainsAll(e,r);case a0:return this.matchesSetContainsAny(e,r);case a1:return!this.matchesSetContainsAny(e,r);default:return!1}},e.prototype.matchString=function(e,t,r){var n=this;switch(t){case"is":return this.matchesIs(e,r);case aj:return!this.matchesIs(e,r);case aF:return this.matchesContains(e,r);case aB:return!this.matchesContains(e,r);case aV:case aK:case az:case aW:return this.matchesComparable(e,t,r,function(e){return n.parseNumber(e)},this.comparator);case aH:case aG:case a$:case aJ:return this.matchesComparable(e,t,r,function(e){return ut.parse(e)},this.versionComparator);case"regex match":return this.matchesRegex(e,r);case"regex does not match":return!this.matchesRegex(e,r);default:return!1}},e.prototype.matchesIs=function(e,t){if(this.containsBooleans(t)){var r=e.toLowerCase();if("true"===r||"false"===r)return t.some(function(e){return e.toLowerCase()===r})}return t.some(function(t){return e===t})},e.prototype.matchesContains=function(e,t){var r,n;try{for(var i=aL(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.toLowerCase().includes(s.toLowerCase()))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.prototype.matchesComparable=function(e,t,r,n,i){var o=this,s=n(e),a=r.map(function(e){return n(e)}).filter(function(e){return void 0!==e});return void 0===s||0===a.length?r.some(function(r){return o.comparator(e,t,r)}):a.some(function(e){return i(s,t,e)})},e.prototype.comparator=function(e,t,r){switch(t){case aV:case aH:return e<r;case aK:case aG:return e<=r;case az:case a$:return e>r;case aW:case aJ:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var n=e.compareTo(r);switch(t){case aV:case aH:return n<0;case aK:case aG:return n<=0;case az:case a$:return n>0;case aW:case aJ:return n>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some(function(t){return!!new RegExp(t).exec(e)})},e.prototype.containsNone=function(e){return e.some(function(e){return"(none)"===e})},e.prototype.containsBooleans=function(e){return e.some(function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})},e.prototype.parseNumber=function(e){var t;return null!=(t=Number(e))?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e)){var r=e;return r.map(function(e){return t.coerceString(e)}
1).filter(Boolean)}var n=String(e);try{var i=JSON.parse(n);if(Array.isArray(i)){var r=e;return r.map(function(e){return t.coerceString(e)}).filter(Boolean)}var o=this.coerceString(n);return o?[o]:void 0}catch(e){var o=this.coerceString(n);return o?[o]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case aX:case aQ:case aY:case aZ:case a0:case a1:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),n=new Set(t);return r.size===n.size&&aq([],aU(n),!1).every(function(e){return r.has(e)})},e.prototype.matchesSetContainsAll=function(e,t){var r,n;if(e.length<t.length)return!1;try{for(var i=aL(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(!this.matchesIs(s,e))return!1}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0},e.prototype.matchesSetContainsAny=function(e,t){var r,n;try{for(var i=aL(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(this.matchesIs(s,e))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e}(),un=function(e,t){var r,n,i=aD({},e),o=[],s=t||Object.keys(i);try{for(var a=aL(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=ui(l,i);c&&o.push.apply(o,aq([],aU(c),!1))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},ui=function(e,t,r){void 0===r&&(r=[]);var n,i,o=t[e];if(o){if(!o.dependencies||0===o.dependencies.length)return delete t[o.key],[o];r.push(o.key);var s=[],a=function(e){if(r.some(function(t){return t===e}))throw Error("Detected a cycle between flags ".concat(r));var n=ui(e,t,r);n&&s.push.apply(s,aq([],aU(n),!1))};try{for(var u=aL(o.dependencies),l=u.next();!l.done;l=u.next()){var c=l.value;a(c)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return s.push(o),r.pop(),delete t[o.key],s}};let uo="function"==typeof aO.Buffer,us="function"==typeof TextDecoder?new TextDecoder:void 0,ua="function"==typeof TextEncoder?new TextEncoder:void 0,uu=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),ul=(r={},uu.forEach((e,t)=>r[e]=t),r),uc=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,ud=String.fromCharCode.bind(String),uf="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),uh=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),up="function"==typeof btoa?e=>btoa(e):uo?e=>aO.Buffer.from(e,"binary").toString("base64"):e=>{let t,r,n,i,o="",s=e.length%3;for(let s=0;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=uu[(t=r<<16|n<<8|i)>>18&63]+uu[t>>12&63]+uu[t>>6&63]+uu[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},ug=uo?e=>aO.Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(ud.apply(null,e.subarray(r,r+4096)));return up(t.join(""))},uv=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?ud(192|t>>>6)+ud(128|63&t):ud(224|t>>>12&15)+ud(128|t>>>6&63)+ud(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return ud(240|t>>>18&7)+ud(128|t>>>12&63)+ud(128|t>>>6&63)+ud(128|63&t)},um=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,uy=uo?e=>aO.Buffer.from(e,"utf8").toString("base64"):ua?e=>ug(ua.encode(e)):e=>up(e.replace(um,uv)),ub=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t?uh(uy(e)):uy(e)},u_=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,uw=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return ud((t>>>10)+55296)+ud((1023&t)+56320);case 3:return ud((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return ud((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},uS="function"==typeof atob?e=>atob(e.replace(/[^A-Za-z0-9\+\/]/g,"")):uo?e=>aO.Buffer.from(e,"base64").toString("binary"):e=>
1{if(e=e.replace(/\s+/g,""),!uc.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r="",n,i;for(let o=0;o<e.length;)t=ul[e.charAt(o++)]<<18|ul[e.charAt(o++)]<<12|(n=ul[e.charAt(o++)])<<6|(i=ul[e.charAt(o++)]),r+=64===n?ud(t>>16&255):64===i?ud(t>>16&255,t>>8&255):ud(t>>16&255,t>>8&255,255&t);return r},uE=uo?e=>uf(aO.Buffer.from(e,"base64")):e=>uf(uS(e).split("").map(e=>e.charCodeAt(0))),uk=uo?e=>aO.Buffer.from(e,"base64").toString("utf8"):us?e=>us.decode(uE(e)):e=>uS(e).replace(u_,uw);var uI=function(e){function t(r,n){var i=e.call(this,n)||this;return i.statusCode=r,Object.setPrototypeOf(i,t.prototype),i}return aR(t,e),t}(Error),ux=function(e){function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return aR(t,e),t}(Error),uC=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return aM(this,void 0,void 0,function(){var r,n,i,o;return aN(this,function(s){switch(s.label){case 0:return r=ub(JSON.stringify(e),!0),n={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(n["X-Amp-Exp-Flag-Keys"]=ub(JSON.stringify(t.flagKeys),!0)),(null==t?void 0:t.trackingOption)&&(n["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(n["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption),i=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:n,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=s.sent()).status)throw new uI(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}})})},e}(),uT=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return aM(this,void 0,void 0,function(){var t,r;return aN(this,function(n){switch(n.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=ub(JSON.stringify(e.user),!0)),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=n.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce(function(e,t){return e[t.key]=t,e},{})]}})})},e}(),uP="u">typeof globalThis?globalThis:e.g||self,uO=function(){return"u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof self?self:e.g},uA=function(){var e=uO();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1},uR=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=uP.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(uP.clearInterval(this.poller),this.poller=void 0)},e}(),uD=e.i(482999);function uM(e){this.amplitudeInstance=e}function uN(e){this.amplitudeInstance=e}uM.prototype.getUser=function(){var e,t,r,n,i,o,s,a,u,l;return{device_id:null==(t=null==(e=this.amplitudeInstance)?void 0:e.options)?void 0:t.deviceId,user_id:null==(n=null==(r=this.amplitudeInstance)?void 0:r.options)?void 0:n.userId,version:null==(o=null==(i=this.amplitudeInstance)?void 0:i.options)?void 0:o.versionName,language:null==(a=null==(s=this.amplitudeInstance)?void 0:s.options)?void 0:a.language,platform:null==(l=null==(u=this.amplitudeInstance)?void 0:u.options)?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},uM.prototype.getOs=function(){var e,t,r,n,i,o;return[null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.browser)?void 0:r.name,null==(o=null==(i=null==(n=this.amplitudeInstance)?void 0:n._ua)?void 0:i.browser)?void 0:o.major].filter(function(e){return null!=e}).join(" ")},uM.prototype.getDeviceModel=function(){var e,t,r;return null==(r=null==(t=null==(e=this.amplitudeInstance)?void 0:e._ua)?void 0:t.os)?void 0:r.name},uN.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},uN.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null==(r=e.variant)?void 0:r.value,t))},uN.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:((t={})[e.userProperty]="-",t)})};var uL=function(){return(uL=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function uU(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})}function uq(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){var l=[a,u];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function uj(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function uF(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function uB(e,t,r){if(r||2==arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var uV=function(e,t){void 0===t&&(t=!1);var r,n,i=uW(e,t),o=void 0,s=uP.document.cookie.split("; ");try{for(var a=uj(s),u=a.next();!u.done;u=a.next()){var l=u.value,c=uF(l.split("=",2),2),d=c[0],f=c[1];d===i&&(o=decodeURIComponent(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}if(o)try{if(t){var h=atob(o);return JSON.parse(decodeURIComponent(h))}var p=o.split("."),g=void 0;return p.length>=2&&p[1]&&(g=atob(p[1])),{deviceId:p[0],userId:g}}catch(e){return}},uK=function(e){var t=uW(e,!0);try{var r=uP.localStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},uz=function(e){var t=uW(e,!0);try{var r=uP.sessionStorage.getItem(t);if(!r)return;var n=JSON.parse(r);if("object"!=typeof n)return;return n}catch(e){return}},uW=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},uH=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return uU(this,void 0,void 0,function(){return uq(this,function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(function(){null==t||t.fetch()}),[2,this.waitForConnectorIdentity(this.timeoutMillis)]})})},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=uV(this.apiKey,!0);return!!(e||(e=uV(this.apiKey,!1))||(e=uK(this.apiKey))||(e=uz(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return uU(this,void 0,void 0,function(){var t,r=this;return uq(this,function(n){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise(function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)}),new Promise(function(t,r){uP.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])]})})},e}(),uG=uP.fetch||function(e,t){return t=t||{},new Promise(function(r,n){var i=new XMLHttpRequest,o=[],s=[],a={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var l in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,r){o.push(t=t.toLowerCase()),s.push([t,r]),a[t]=a[t]?a[t]+","+r:r}),r(u())},i.onerror=n,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(l,t.headers[l]);i.send(t.body||null)})},u$=function(){function e(e){this.client=e}return e.prototype.request=function(e){return uU(this,void 0,void 0,function(){return uq(this,function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}})})},e}(),uJ={request:function(e,t,r,n,i){var o;return o=uU(void 0,void 0,void 0,function(){var i,o;return uq(this,function(s){switch(s.label){case 0:return[4,uG(e,{method:t,headers:r,body:n})];case 1:return o={status:(i=s.sent()).status},[4,i.text()];case 2:return o.body=s.sent(),[2,o]}})}),null==i||i<=0?o:new Promise(function(e,t){uP.setTimeout(function(){t(new ux("Request timeout after "+i+" milliseconds"))},i),o.then(e,t)})}};(D=eg||(eg={}))[D.Disable=0]="Disable",D[D.Error=1]="Error",D[D.Warn=2]="Warn",D[D.Info=3]="Info",D[D.Debug=4]="Debug",D[D.Verbose
1=5]="Verbose",(M=ev||(ev={})).LocalStorage="localStorage",M.InitialVariants="initialVariants",(N=em||(em={})).LocalStorage="storage",N.InitialVariants="initial",N.SecondaryLocalStorage="secondary-storage",N.SecondaryInitialVariants="secondary-initial",N.FallbackInline="fallback-inline",N.FallbackConfig="fallback-config",N.LocalEvaluation="local-evaluation";var uX=function(e){return!e||e===em.FallbackInline||e===em.FallbackConfig||e===em.SecondaryInitialVariants},uQ={debug:!1,logLevel:eg.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:ev.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:uJ},uY="1.20.4",uZ=function(){function e(e,t){var r,n=this;this.isReady=new Promise(function(e){n.resolve=e}),this.config=e,this.client=t;var i=null!=(r=e.instanceName)?r:uQ.instanceName;this.queue=new u1(i),this.cache=new u0(i)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()},function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e,t){if(this.cache.shouldTrack(e,t)){var r=this.getExposureEvent(e);this.queue.push(r)}},e.prototype.getExposureEvent=function(e){var t,r,n,i={eventType:"$exposure",eventProperties:e};return(null==(t=e.metadata)?void 0:t.exposureEvent)?i={eventType:null==(r=e.metadata)?void 0:r.exposureEvent,eventProperties:e}:(null==(n=e.metadata)?void 0:n.deliveryMethod)==="web"&&(i={eventType:"$impression",eventProperties:e}),i},e}(),u0=function(){function e(e){this.isSessionStorageAvailable=u2(),this.inMemoryCache={},this.identity={},this.storageKey="EXP_sent_v3_".concat(e),this.isSessionStorageAvailable&&(uP.sessionStorage.removeItem("EXP_sent_".concat(e)),uP.sessionStorage.removeItem("EXP_sent_v2_".concat(e)))}return e.prototype.shouldTrack=function(e,t){if((null==(r=e.metadata)?void 0:r.deliveryMethod)==="web")return!0;var r,n,i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();var o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(n=e.variant)?n:null,u=!1;return o&&(null!=s?s:null)===a||(u=!0,this.inMemoryCache[e.flag_key]=a),this.storeCache(),u},e.prototype.clearCache=function(){this.inMemoryCache={},this.isSessionStorageAvailable&&uP.sessionStorage.removeItem(this.storageKey)},e.prototype.identityEquals=function(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=uP.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){if(this.isSessionStorageAvailable)try{uP.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}},e}(),u1=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=uA(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=uP.setInterval(function(){t.loadFlushStore()},1e3),this.loadFlushStore()},e.prototype.flush=function(){if(this.tracker&&0!==this.inMemoryQueue.length){for(var e=0;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller&&(uP.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=uP.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),uP.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),u2=function(){var e=uO();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1},u3=function(){function e(e,t){void 0===t&&(t=eg.Error),this.logger=e,this.logLevel=t}return e.prototype.error=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=eg.Error&&(t=this.logger).error.apply(t,uB([e],uF(r),!1))},e.prototype.warn=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=eg.Warn&&(t=this.logger).warn.apply(t,uB([e],uF(r),!1))},e.prototype.info=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=eg.Info&&(t=this.logger).info.apply(t,uB([e],uF(r),!1))},e.prototype.debug=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=eg.Debug&&(t=this.logger).debug.apply(t,uB([e],uF(r),!1))},e.prototype.verbose=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.logLevel>=eg.Verbose&&(t=this.logger).verbose.apply(t,uB([e],uF(r),!1))},e}(),u4=function(){function e(){}return e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.error.apply(console,uB([e],uF(t),!1))},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,uB([e],uF(t),!1))},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.info.apply(console,uB([e],uF(t),!1))},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,uB([e],uF(t),!1))},e.prototype.verbose=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.debug.apply(console,uB([e],uF(t),!1))},e}(),u5=function(){function e(){this.globalScope=uO()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)},e}(),u6=function(e,t,r){var n=e.substring(e.length-6);return new le("amp-exp-".concat(t,"-").concat(n),r,lt)},u8=function(e,t,r){void 0===r&&(r=new u5);var n=e.substring(e.length-6);return new le("amp-exp-".concat(t,"-").concat(n,"-flags"),r)},u7=function(e,t,r){void 0===r&&(r=new u5);var n=e.substring(e.length-6);return new u9("amp-exp-".concat(t,"-").concat(n,"-variants-options"),r)},u9=function(){function e(e,t){this.namespace=e,this.storage=t}return e.prototype.get=function(){return this.value},e.prototype.put=function(e){this.value=e},e.prototype.load=function(){var e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))},e.prototype.store=function(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))},e}(),le=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return uL({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var n=uj(Object.keys(e)),i=n.next();!i.done;i=n.next()){var o=i.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,n=this.storage.get(this.namespace);try{r=JSON.parse(n)||{}}catch(e){return}var i={};try{for(var o=uj(Object.keys(r)),s=o.next();!s.done;s=o.next()){var a=s.value;try{var u=void 0;(u=this.transformer?this.transformer(r[a]):r[a])&&(i[a]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(i)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),lt=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,n=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);var s={};return t?s.key=t:r&&(s.key=r),r&&(s.value=r),i&&(s.metadata=i),n&&(s.payload=n),o&&(s.expKey=o),s}},lr=function(){function e(){this.globalScope=uO()}return e.prototype.get=function(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null==(r=this.globalScope)||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)},e}(),ln=function(e,t,r,n){var i,o=null==r?void 0:r.value,s="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:s,properties:{key:t,variant:o,source:n},userProperties:((i={})[s]=o,i)}},li=function(e){return null==e},lo=function(e){return!!li(e)||e&&0===Object.keys(e).length},ls=function(e){if(!e||"object"!=typeof e)return{};var t,r,n={};try{for(var i=uj(Object.entries(e)),o=i.next();!o.done;o=i.next()){var s=uF(o.value,2),a=s[0],u=s[1];li(u)||(n[a]=u)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n},la=function(e){var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"},lu=function(){function e(e,t,r,n){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=n}return e.prototype.start=function(e){return uU(this,void 0,void 0,function(){return uq(this,function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}})})},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return uU(this,void 0,void 0,function(){var n=this;return uq(this,function(i){return this.done||(this.timeoutHandle=uP.setTimeout(function(){return uU(n,void 0,void 0,function(){var n,i;return uq(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(n=t+1)<this.attempts&&(i=Math.min(r*this.scalar,this.max),this.backoff(e,n,i)
1),[3,3];case 3:return[2]}})})},r)),[2]})})},e}(),ll=function(e){if(!e)return{};var t,r,n,i,o={user:e},s=uO();s&&(o.page={url:s.location.href});var a={};if(!e.groups)return o;try{for(var u=uj(Object.keys(e.groups)),l=u.next();!l.done;l=u.next()){var c=l.value,d=e.groups[c];if(d.length>0&&d[0]){var f=d[0],h={group_name:f},p=null==(i=null==(n=e.group_properties)?void 0:n[c])?void 0:i[f];p&&Object.keys(p).length>0&&(h.group_properties=p),a[c]=h}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(a).length>0&&(o.groups=a),delete o.user.groups,delete o.user.group_properties,o},lc=function(e){return null==e?{}:"string"==typeof e?{key:e,value:e}:e},ld=function(e){if(!e)return{};var t=void 0;e.metadata&&(t=e.metadata.experimentKey);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r},lf=function(){function e(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}return e.prototype.track=function(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))},e.prototype.setUserProperty=function(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)},e.prototype.unsetUserProperty=function(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))},e}(),lh=function(){function e(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}return e.prototype.track=function(e,t){var r={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,r)||(this.tracked={}),this.identity=r;var n=e.flag_key in this.tracked,i=this.tracked[e.flag_key];n&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))},e.prototype.identityEquals=function(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId},e}(),lp=function(){function e(t,r){var n,i,o,s,a,u=this;this.engine=new ur,this.isRunning=!1,this.apiKey=t,r=ls(r),this.config=uL(uL(uL({},uQ),r),{serverUrl:(null==r?void 0:r.serverUrl)||((null==(n=null==r?void 0:r.serverZone)?void 0:n.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":uQ.serverUrl),flagsServerUrl:(null==r?void 0:r.flagsServerUrl)||((null==(i=null==r?void 0:r.serverZone)?void 0:i.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":uQ.flagsServerUrl),flagConfigPollingIntervalMillis:r.flagConfigPollingIntervalMillis<6e4?6e4:null!=(o=r.flagConfigPollingIntervalMillis)?o:uQ.flagConfigPollingIntervalMillis}),this.logger=new u3(this.config.loggerProvider||new u4,e.getLogLevel(r));var l=null==(s=this.config)?void 0:s.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new uR(function(){return uU(u,void 0,void 0,function(){var e;return uq(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.doFlags()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this.logger.info(e),[3,3];case 3:return[2]}})})},this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(var c in this.config.initialVariants)this.config.initialVariants[c]=lt(this.config.initialVariants[c]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new lf(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new lh(this.config.exposureTrackingProvider)),this.integrationManager=new uZ(this.config,this);var d=new u$(this.config.httpClient||uJ);this.flagApi=new uT(this.apiKey,this.config.flagsServerUrl,d),this.evaluationApi=new uC(this.apiKey,this.config.serverUrl,d);var f=l?"".concat(this.config.instanceName,"-").concat(l):this.config.instanceName;a=this.isWebExperiment?new lr:new u5,this.variants=u6(this.apiKey,f,a),this.flags=u8(this.apiKey,f,a),this.fetchVariantsOptions=u7(this.apiKey,f,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}return e.prototype.start=function(e){return uU(this,void 0,void 0,function(){var t,r,n;return uq(this,function(i){switch(i.label){case 0:if(this.isRunning)return[2];this.isRunning=!0,this.setUser(e),i.label=1;case 1:if(i.trys.push([1,6,,7]),t=this.doFlags(),!(null==(n=this.config.fetchOnStart)||n))return[3,3];return[4,Promise.all([this.fetch(e),t])];case 2:return i.sent(),[3,5];case 3:return[4,t];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:if(r=i.sent(),this.config.throwOnError)throw r;return[3,7];case 7:return this.config.pollOnStart&&this.poller.start(),[2]}})})},e.prototype.stop=function(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)},e.prototype.fetch=function(){return uU(this,arguments,void 0,function(e,t){var r;return void 0===e&&(e=this.user),uq(this,function(n){switch(n.label){case 0:this.setUser(e||{}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)];case 2:return n.sent(),[3,4];case 3:if(r=n.sent(),this.config.throwOnError)throw r;return r instanceof ux?this.logger.debug(r):this.logger.error(r),[3,4];case 4:return[2,this]}})})},e.prototype.variant=function(e,t){if(!this.apiKey)return{value:void 0};var r,n,i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug("[Experiment] variant for ".concat(e," is ").concat((null==(r=i.variant)?void 0:r.key)||(null==(n=i.variant)?void 0:n.value))),i.variant||{}}
1,e.prototype.exposure=function(e){var t=this.variantAndSource(e);this.exposureInternal(e,t)},e.prototype.all=function(){if(!this.apiKey)return{};var e=this.evaluate();for(var t in e)la(this.flags.get(t))||delete e[t];return uL(uL(uL({},this.secondaryVariants()),this.sourceVariants()),e)},e.prototype.clear=function(){this.variants.clear();try{this.variants.store()}catch(e){}},e.prototype.getUser=function(){if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return uL({},this.user);var e,t=uL({},this.user.user_properties);return uL(uL({},this.user),{user_properties:t})},e.prototype.setUser=function(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){var r=uL({},e.user_properties);this.user=uL(uL({},e),{user_properties:r})}else this.user=uL({},e)},e.prototype.getUserProvider=function(){return this.userProvider},e.prototype.setUserProvider=function(e){return this.userProvider=e,this},e.prototype.mergeInitialFlagsWithStorage=function(){var e=this;this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEach(function(t){e.flags.get(t.key)||e.flags.put(t.key,t)})},e.prototype.evaluate=function(e){var t,r,n=this.addContext(this.user),i=un(this.flags.getAll(),e),o=ll(n),s=this.engine.evaluate(o,i),a={};try{for(var u=uj(Object.keys(s)),l=u.next();!l.done;l=u.next()){var c=l.value;a[c]=ld(s[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return a},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===ev.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===ev.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var n=this.flags.get(e);return(la(n)||!r.variant&&n)&&(r=this.localEvaluationVariantAndSource(e,n,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var n,i={},o=this.evaluate([t.key])[e],s=em.LocalEvaluation,a=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!li(o)&&!a)return{variant:lc(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:lc(o),source:s,hasDefaultVariant:!0}),!li(r))return{variant:lc(r),source:em.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var u=this.config.initialVariants[e];if(!li(u))return{variant:lc(u),source:em.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var l=lc(this.config.fallbackVariant),c={variant:l,source:em.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return lo(l)?i:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,n={},i=this.variants.get(e),o=null==(r=null==i?void 0:i.metadata)?void 0:r.default;if(!li(i)&&!o)return{variant:lc(i),source:em.LocalStorage,hasDefaultVariant:!1};if(o&&(n={variant:lc(i),source:em.LocalStorage,hasDefaultVariant:!0}),!li(t))return{variant:lc(t),source:em.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var s=this.config.initialVariants[e];if(!li(s))return{variant:lc(s),source:em.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var a=lc(this.config.fallbackVariant),u={variant:a,source:em.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return lo(a)?n:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,n={},i=this.config.initialVariants[e];if(!li(i))return{variant:lc(i),source:em.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),s=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!li(o)&&!s)return{variant:lc(o),source:em.LocalStorage,hasDefaultVariant:!1};if(s&&(n={variant:lc(o),source:em.LocalStorage,hasDefaultVariant:!0}),!li(t))return{variant:lc(t),source:em.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var a=lc(this.config.fallbackVariant),u={variant:a,source:em.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return lo(a)?n:u},e.prototype.fetchInternal=function(e,t,r,n){return uU(this,void 0,void 0,function(){var i,o,s;return uq(this,function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.logger.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,uL({trackingOption:null==(s=this.fetchVariantsOptions.get())?void 0:s.trackingOption},n))];case 2:return i=a.sent(),[4,this.storeVariants(i,n)];case 3:return a.sent(),[2,i];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,n),o;case 5:return[2]}})})},e.prototype.setTracksAssignment=function(e){return uU(this,void 0,void 0,function(){return uq(this,function(t){return this.fetchVariantsOptions.put(uL(uL({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"}
1)),this.fetchVariantsOptions.store(),[2]})})},e.prototype.cleanUserPropsForFetch=function(e){var t=uL({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return uU(this,void 0,void 0,function(){var n,i,o,s,a,u,l;return uq(this,function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,uL({timeoutMillis:t},r))];case 2:n=c.sent(),i={};try{for(s=(o=uj(Object.keys(n))).next();!s.done;s=o.next())i[a=s.value]=ld(n[a])}catch(e){u={error:e}}finally{try{s&&!s.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.logger.debug("[Experiment] Received variants: ",i),[2,i]}})})},e.prototype.doFlags=function(){return uU(this,void 0,void 0,function(){var e,t,r;return uq(this,function(n){switch(n.label){case 0:if(n.trys.push([0,4,,5]),e=void 0,!this.isWebExperiment)return[3,2];return[4,this.addContextOrWait(this.getUser())];case 1:e=n.sent(),n.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:uY,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=n.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if((r=n.sent())instanceof ux){if(this.logger.debug(r),this.config.throwOnError)throw r}else throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}})})},e.prototype.storeVariants=function(e,t){return uU(this,void 0,void 0,function(){var r,n,i,o;return uq(this,function(s){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),n=function(t){r=r.filter(function(e){return e!==t}),i.variants.put(t,e[t])},i=this,e)n(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.logger.debug("[Experiment] Stored variants: ",e),[2]})})},e.prototype.startRetries=function(e,t){return uU(this,void 0,void 0,function(){var r=this;return uq(this,function(n){return this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new lu(8,500,1e4,1.5),this.retriesBackoff.start(function(){return uU(r,void 0,void 0,function(){return uq(this,function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}})})}),[2]})})},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null==(t=this.userProvider)?void 0:t.getUser(),n=this.integrationManager.getUser(),i=uL(uL(uL({},null==r?void 0:r.user_properties),n.user_properties),null==e?void 0:e.user_properties);return uL(uL(uL(uL({library:"experiment-js-client/".concat(uY)},r),n),e),{user_properties:i})},e.prototype.addContextOrWait=function(e){return uU(this,void 0,void 0,function(){return uq(this,function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}})})},e.prototype.sourceVariants=function(){return this.config.source==ev.LocalStorage?this.variants.getAll():this.config.source==ev.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==ev.LocalStorage?this.config.initialVariants:this.config.source==ev.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){if(null==(i=null==(n=null==(r=t.variant)?void 0:r.metadata)?void 0:n.trackExposure)||i){this.legacyExposureInternal(e,t.variant,t.source);var r,n,i,o,s,a,u,l,c,d={flag_key:e},f=uX(t.source);if(!f||t.hasDefaultVariant){(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);var h=null==(a=t.variant)?void 0:a.metadata;if(f||(null==h?void 0:h.default)||((null==(u=t.variant)?void 0:u.key)?d.variant=t.variant.key:(null==(l=t.variant)?void 0:l.value)&&(d.variant=t.variant.value)),h&&(d.metadata=h),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){var p=uO();if(null==p?void 0:p.location)try{var g=p.location.href;d.metadata.url=g.split("?")[0]||""}catch(e){}}var v=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,v),this.integrationManager.track(d,v)}}},e.prototype.legacyExposureInternal=function(e,t,r){var n,i,o,s,a;if(this.analyticsProvider){var u=ln(this.addContext(this.getUser()),e,t,r);!uX(r)&&(null==t?void 0:t.value)?(null==t?void 0:t.value)&&(null==(s=null==(o=this.analyticsProvider)?void 0:o.setUserProperty)||s.call(o,u),null==(a=this.analyticsProvider)||a.track(u)):null==(i=null==(n=this.analyticsProvider)?void 0:n.unsetUserProperty)||i.call(n,u)}},e.getLogLevel=function(e){var t;return!0===e.debug?eg.Debug:null!=(t=e.logLevel)?t:eg.Error},e.prototype.shouldRetryFetch=function(e){return!(e instanceof uI)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
1,e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),lg=function(){function e(e,t){var r,n,i;this.globalScope=uO(),this.userAgent=void 0!==(null==(r=this.globalScope)?void 0:r.navigator)?null==(n=this.globalScope)?void 0:n.navigator.userAgent:void 0,this.ua=new uD.UAParser(this.userAgent).getResult(),this.localStorage=new u5,this.sessionStorage=new lr,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null==(i=this.apiKey)?void 0:i.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,n,i,o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return uL({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!=(r=null==(t=this.ua.device)?void 0:t.type)?r:"desktop",referring_url:null==(i=null==(n=this.globalScope)?void 0:n.document)?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null==(t=e.browser)?void 0:t.name,null==(r=e.browser)?void 0:r.major].filter(function(e){return null!=e}).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null==(t=e.os)?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null==(t=e.browser)?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,n,i;if(null==(t=null==(e=this.globalScope)?void 0:e.document)?void 0:t.cookie)return Object.fromEntries(null==(i=null==(n=null==(r=this.globalScope)?void 0:r.document)?void 0:n.cookie)?void 0:i.split("; ").map(function(e){return e.split("=")}))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){if(this.globalScope){var e,t,r,n={};try{var i=new URL(this.globalScope.location.href);try{for(var o=uj(i.searchParams),s=o.next();!s.done;s=o.next()){var a=uF(s.value,2),u=a[0],l=a[1];n[u]=uB(uB([],uF(null!=(r=n[u])?r:[]),!1),uF(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(n).reduce(function(e,t){var r=uF(t,2),n=r[0],i=r[1];return e[n]=1==i.length?i[0]:i,e},{})}},e}();uP.experimentInstances={};var lv=uP.experimentInstances,lm=function(e){return(null==e?void 0:e.instanceName)||uQ.instanceName},ly=function(e,t){var r=lm(t),n=null==t?void 0:t.internalInstanceNameSuffix;return n?"".concat(r,".").concat(e,".").concat(n):"".concat(r,".").concat(e)},lb=function(e,t,r){var n=ly(e,t),i=lv[n];return i?i:(i=new lp(e,uL(uL({},t),{userProvider:new lg(null==t?void 0:t.userProvider,e)})),r&&i.addPlugin(r()),lv[n]=i,i)};function l_(){}l_.prototype.getUser=function(){return{}},l_.prototype.start=function(e){return uU(this,void 0,void 0,function(){return uq(this,function(e){return[2]})})},l_.prototype.stop=function(){},l_.prototype.setUser=function(e){},l_.prototype.fetch=function(e,t){return uU(this,void 0,void 0,function(){return uq(this,function(e){return[2,this]})})},l_.prototype.getUserProvider=function(){return null},l_.prototype.setUserProvider=function(e){return this},l_.prototype.variant=function(e,t){return uQ.fallbackVariant},l_.prototype.all=function(){return{}},l_.prototype.clear=function(){}
1,l_.prototype.exposure=function(e){};var lw=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var r;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(t){var n,i;return this.experiment=lb(n=(null==(r=this.config)?void 0:r.deploymentKey)||e.apiKey,i=this.config,function(){return new uH(n,tg.getInstance(lm(i)),1e4)}),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),lS=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:lE(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),lE=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},lk=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),lI=function(){return(lI=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function lx(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function lC(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}var lT=function(e,t){var r,n,i=typeof e;if(i!==typeof t)return!1;try{for(var o=lx(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===i)return e===t}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;var a=Array.isArray(e),u=Array.isArray(t);if(a!==u)return!1;if(a&&u){for(var l=0;l<e.length;l++)if(!lT(e[l],t[l]))return!1}else{if(!lT(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(r){lT(e[r],t[r])||(c=!1)}),c}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var lP=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=lI({},this.identity.userProperties),r=lI(lI({},this.identity),{userProperties:t});return{setUserId:function(e){return r.userId=e,this},setDeviceId:function(e){return r.deviceId=e,this},setUserProperties:function(e){return r.userProperties=e,this},setOptOut:function(e){return r.optOut=e,this},updateUserProperties:function(e){var t,n,i,o,s,a,u=r.userProperties||{};try{for(var l=lx(Object.entries(e)),c=l.next();!c.done;c=l.next()){var d=lC(c.value,2),f=d[0],h=d[1];switch(f){case"$set":try{for(var p=(i=void 0,lx(Object.entries(h))),g=p.next();!g.done;g=p.next()){var v=lC(g.value,2),m=v[0],y=v[1];u[m]=y}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,lx(Object.keys(h))),_=b.next();!_.done;_=b.next()){var m=_.value;delete u[m]}}catch(e){s={error:e}}finally{try{_&&!_.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return r.userProperties=u,this},commit:function(){return e.setIdentity(r),this}}},e.prototype.getIdentity=function(){return lI({},this.identity)},e.prototype.setIdentity=function(e){var t=lI({},this.identity);this.identity=lI({},e),lT(t,this.identity)||this.listeners.forEach(function(t){t(e)})},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),lO="u">typeof globalThis?globalThis:"u">typeof window?window:self,lA=function(){function e(){this.identityStore=new lP,this.eventBridge=new lk,this.applicationContextProvider=new lS}return e.getInstance=function(t){return lO.analyticsConnectorInstances||(lO.anal
1yticsConnectorInstances={}),lO.analyticsConnectorInstances[t]||(lO.analyticsConnectorInstances[t]=new e),lO.analyticsConnectorInstances[t]},e}(),lR=["boot"],lD=((n=lD||{}).Local="https://local.amplitude.com:3010/",n.Staging="https://apps.stag2.amplitude.com/",n.Production="https://app.amplitude.com/",n.ProductionEU="https://app.eu.amplitude.com/",n),lM=((e=>{if("u">typeof window&&window.opener)for(let t of Object.values(lD))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),L=(e,t,r,n)=>(function(e,t,r,n){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",r&&e.setAttribute("nonce",r),t&&e.setAttribute("type",t),n&&(e.onerror=n),document.getElementsByTagName("head")[0].appendChild(e)}})([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,r,n),i="u">typeof window?window.engagement:void 0,o=!1,new Proxy(s={_q:null!=(U=null==i?void 0:i._q)?U:[],_configuration:{apiKey:null!=(j=null==(q=null==i?void 0:i._configuration)?void 0:q.apiKey)?j:"",serverUrl:null==(F=null==i?void 0:i._configuration)?void 0:F.serverUrl,chatUrl:null==(B=null==i?void 0:i._configuration)?void 0:B.chatUrl,mediaUrl:null==(V=null==i?void 0:i._configuration)?void 0:V.mediaUrl,serverZone:null!=(z=null==(K=null==i?void 0:i._configuration)?void 0:K.serverZone)?z:"US",options:{...null==(W=null==i?void 0:i._configuration)?void 0:W.options}},init(e,t){var r,n,i,a;let u;if(s._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if(null!=t&&t.useEngagementDomain){let e=(null!=(r=t.serverZone)?r:s._configuration.serverZone)==="EU",n="amplitudeengagement.com";t.serverUrl||(t.serverUrl=e?`https://gs.eu.${n}`:`https://gs.${n}`),t.chatUrl||(t.chatUrl=e?`https://houston-chat.eu.${n}`:`https://houston-chat.${n}`),t.mediaUrl||(t.mediaUrl=e?`https://engagement-static.eu.${n}`:`https://engagement-static.${n}`),t.cdnUrl||(t.cdnUrl=e?`https://cdn.eu.${n}`:`https://cdn.${n}`)}if(s._configuration={...s._configuration,...t,apiKey:e,options:{splitting:!0,...s._configuration.options,...null==t?void 0:t.options}},null!=(i=null==(n=s._configuration)?void 0:n.options)&&i.logger&&s._configuration.options.logger.enable(null!=(a=s._configuration.options.logLevel)?a:2),null!=t&&t.cdnUrl)u=s._configuration.options.splitting?`${t.cdnUrl}/engagement-browser/prod/split/index.js`:t.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===s._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";u=s._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let l=null,c=()=>{if(o=!0,l&&(clearTimeout(l),l=null),s._q&&s._q.length>0)for(console.warn(`Engagement SDK failed to load within ${d}ms. Resolving pending calls gracefully.`);s._q.length>0;){let e=s._q.shift();if(!e)continue;let t=e[0],r=lR.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${r}); attempting to resolve as no-op.`),r&&e[1]instanceof Function&&e[2]instanceof Function){let r=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),r(void 0)}}};L(u,s._configuration.options.splitting?"module":void 0,null==t?void 0:t.nonce,c);let d=1e4;l=setTimeout(()=>{c()},1e4)},plugin(e){let t=s.init;return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(r,n){var i;let o=null!=(i=r.instanceName)?i:"$default_instance",s=lA.getInstance(o).identityStore;t(r.apiKey,{serverZone:r.serverZone,...e,options:{logLevel:r.logLevel,logger:r.loggerProvider,...null==e?void 0:e.options}});let a=[{track:e=>{n.track(e)}}];await window.engagement.boot({user:()=>{let e=s.getIdentity();return{user_id:n.getUserId(),device_id:n.getDeviceId(),user_properties:e.userProperties,getSessionId:n.getSessionId}},integrations:a}),s.addIdentityListener(e=>{var t,r,i,o;null!=(t=window.engagement)&&t._.user&&null!=(r=window.engagement)&&r._analytics.hasBooted?(null==(o=null==(i=window.engagement)?void 0:i._.user)?void 0:o.user_id)!==e.userId?(window.engagement.shutdown(),window.engagement.boot({user:()=>{let e=s.getIdentity();return{user_id:n.getUserId(),device_id:n.getDeviceId(),user_properties:e.userProperties,getSessionId:n.getSessionId}},integrations:a})):window.engagement._setUserProperties(e.userProperties):console.warn("Engagement SDK not booted. Ignoring identity change.")})},execute:async e=>(window.engagement.forwardEvent(e),e)}}},{get:function(e,t){return t in s?s[t]:"then"!==t?"gs"===t||"rc"===t?new Proxy({},{get:function(e,r){return function(){let e=Array.from(arguments),n=`${t}.${r}`;e.unshift(n),s._q.push(e)}}}):lR.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((r,n)=>{e.unshift(t,r,n),s._q.push(e),o&&r(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),s._q.push(e)}:void 0}})),lN=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,ey.__extends)(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(lw);return 0===e.length?void this.config.loggerProvider.debug("".concat(lw.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(lw.pluginName," are found."))}},t.prototype.initAll=function(t,r){return(0,ey.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,ey.__generator)(this,function(i){return this._initAllPromise||(this._initAllPromise=(0,ey.__awaiter)(n,void 0,void 0,function(){var n,i;return(0,ey.__generator)(this,function(o){switch(o.label){case 0:return n={serverZone:null==r?void 0:r.serverZone,instanceName:null==r?void 0:r.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return(0,ey.__awaiter)(this,void 0,void 0,function(){return(0,ey.__generator)(this,function(r){return e.library="".concat("amplitude-ts-unified","/").concat("1.0.15","-").concat(null!=(t=e.library)?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,(0,ey.__assign)((0,ey.__assign)({},null==r?void 0:r.analytics),n)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,new aP((0,ey.__assign)((0,ey.__assign)({},null==r?void 0:r.sessionReplay),n))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,new lw((0,ey.__assign)((0,ey.__assign)({},null==r?void 0:r.experiment),n))).promise];case 3:let s;return o.sent(),void 0===(i=this.plugin(aP.pluginName))?this.config.loggerProvider.debug("".concat(aP.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,(s=(0,ey.__assign)((0,ey.__assign)({},null==r?void 0:r.engagement),n),"u">typeof window&&!window.engagement&&(window.engagement=lM),lM.plugin(s))).promise];case 4:return o.sent(),[2]}})}).finally(function(){n._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,r,n){return void 0===t&&(t=""),e.prototype.init.call(this,t,r,n)},t}(oO),lL=function(){var e=new lN;return{_setDiagnosticsSampleRate:tt(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",e7(e),te(e,["config"])),_enableRequestBodyCompressionExperimental:tt(e._enableRequestBodyCompressionExperimental.bind(e),"_enableRequestBodyCompressionExperimental",e7(e),te(e,["config"])),experiment:tt(e.experiment.bind(e),"experiment",e7(e),te(e,["config"])),sessionReplay:tt(e.sessionReplay.bind(e),"sessionReplay",e7(e),te(e,["config"])),initAll:tt(e.initAll.bind(e),"initAll",e7(e),te(e,["config"])),init:tt(e.init.bind(e),"init",e7(e),te(e,["config"])),add:tt(e.add.bind(e),"add",e7(e),te(e,["config.apiKey","timeline.plugins"])),remove:tt(e.remove.bind(e),"remove",e7(e),te(e,["config.apiKey","timeline.plugins"])),track:tt(e.track.bind(e),"track",e7(e),te(e,["config.apiKey","timeline.queue.length"])),logEvent:tt(e.logEvent.bind(e),"logEvent",e7(e),te(e,["config.apiKey","timeline.queue.length"])),identify:tt(e.identify.bind(e),"identify",e7(e),te(e,["config.apiKey","timeline.queue.length"])),groupIdentify:tt(e.groupIdentify.bind(e),"groupIdentify",e7(e),te(e,["config.apiKey","timeline.queue.length"])),setGroup:tt(e.setGroup.bind(e),"setGroup",e7(e),te(e,["config.apiKey","timeline.queue.length"])),revenue:tt(e.revenue.bind(e),"revenue",e7(e),te(e,["config.apiKey","timeline.queue.length"])),flush:tt(e.flush.bind(e),"flush",e7(e),te(e,["config.apiKey","timeline.queue.length"])),getUserId:tt(e.getUserId.bind(e),"getUserId",e7(e),te(e,["config","config.userId"])),setUserId:tt(e.setUserId.bind(e),"setUserId",e7(e),te(e,["config","config.userId"])),getDeviceId:tt(e.getDeviceId.bind(e),"getDeviceId",e7(e),te(e,["config","config.deviceId"])),setDeviceId:tt(e.setDeviceId.bind(e),"setDeviceId",e7(e),te(e,["config","config.deviceId"])),reset:tt(e.reset.bind(e),"reset",e7(e),te(e,["config","config.userId","config.deviceId"])),getSessionId:tt(e.getSessionId.bind(e),"getSessionId",e7(e),te(e,["config"])),setSessionId:tt(e.setSessionId.bind(e),"setSessionId",e7(e),te(e,["config"])),extendSession:tt(e.extendSession.bind(e),"extendSession",e7(e),te(e,["config"])),setOptOut:tt(e.setOptOut.bind(e),"setOptOut",e7(e),te(e,["config"])),getOptOut:tt(e.getOptOut.bind(e),"getOptOut",e7(e),te(e,["config"])),setTransport:tt(e.setTransport.bind(e),"setTransport",e7(e),te(e,["config"])),getIdentity:tt(e.getIdentity.bind(e),"getIdentity",e7(e),te(e,["config"])),setIdentity:tt(e.setIdentity.bind(e),"setIdentity",e7(e),te(e,["config","config.userId","config.deviceId"]))}};let lU=lL();e.s(["createInstance",0,lL,"default",0,lU],513999);var lq=lU._setDiagnosticsSampleRate,lj=lU._enableRequestBodyCompressionExperimental,lF=lU.initAll,lB=lU.experiment,lV=lU.sessionReplay,lK=lU.add,lz=lU.extendSession,lW=lU.flush,lH=lU.getDeviceId,lG=lU.getIdentity,l$=lU.getOptOut,lJ=lU.getSessionId,lX=lU.getUserId,lQ=lU.groupIdentify,lY=lU.identify,lZ=lU.logEvent,l0=lU.remove,l1=lU.reset,l2=lU.revenue,l3=lU.setDeviceId,l4=lU.setGroup,l5=lU.setIdentity,l6=lU.setOptOut,l8=lU.setSessionId,l7=lU.setTransport,l9=lU.setUserId,ce=lU.track;
1e.s(["_enableRequestBodyCompressionExperimental",0,lj,"_setDiagnosticsSampleRate",0,lq,"add",0,lK,"experiment",0,lB,"extendSession",0,lz,"flush",0,lW,"getDeviceId",0,lH,"getIdentity",0,lG,"getOptOut",0,l$,"getSessionId",0,lJ,"getUserId",0,lX,"groupIdentify",0,lQ,"identify",0,lY,"initAll",0,lF,"logEvent",0,lZ,"remove",0,l0,"reset",0,l1,"revenue",0,l2,"sessionReplay",0,lV,"setDeviceId",0,l3,"setGroup",0,l4,"setIdentity",0,l5,"setOptOut",0,l6,"setSessionId",0,l8,"setTransport",0,l7,"setUserId",0,l9,"track",0,ce],166300)},427968,(e,t,r)=>{var n=Object.prototype.hasOwnProperty;function i(e){return"[Throws: "+(e?e.message:"?")+"]"}function o(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 o=e(r.toJSON());return t.pop(),o}catch(e){return i(e)}if(Array.isArray(r)){var s=r.map(e);return t.pop(),s}var a=Object.keys(r).reduce(function(t,o){return t[o]=e(function(e,t){if(n.call(e,t))try{return e[t]}catch(e){return i(e)}return e[t]}(r,o)),t},{});return t.pop(),a}(e)}t.exports=function(e,t,r){return JSON.stringify(o(e),t,r)},t.exports.ensureProperties=o},14919,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Observable=void 0;let n=e=>!!Symbol[e],i=e=>n(e)?Symbol[e]:"@@"+e,o=i("iterator"),s=i("observable"),a=i("species");function u(e,t){let r=e[t];if(null!=r){if("function"!=typeof r)throw TypeError(r+" is not a function");return r}}function l(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 f(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=u(t,"unsubscribe");e&&e.call(t)}}catch(e){c(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function p(e,t,r){e._state="running";let n=e._observer;try{let i=u(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(h(e),i)i.call(n,r);else throw r;break;case"complete":h(e),i&&i.call(n)}}catch(e){c(e)}"closed"===e._state?f(e):"running"===e._state&&(e._state="ready")}function g(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&&(p(e,t[r].type,t[r].value),"closed"!==e._state);++r);}})(e));return}p(e,t,r)}}class v{get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(h(this),f(this))}constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let r=this,n={get closed(){return"closed"===r._state},next(e){g(r,"next",e)},error(e){g(r,"error",e)},complete(){g(r,"complete")}};try{this._cleanup=t.call(void 0,n)}catch(e){n.error(e)}"initializing"===this._state&&(this._state="ready")}}class m{subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new v(e,this._subscriber)}forEach(e){return new Promise((t,r)=>{if("function"!=typeof e)return void r(TypeError(e+" is not a function"));function n(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(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(l(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=l(this),r=arguments.length>1,n=!1,i=arguments[1],o=i;return new t(t=>this.subscribe({next(i){let s=!n;if(n=!0,!s||r)try{o=e(o,i)}catch(e){return t.error(e)}else o=i},error(e){t.error(e)},complete(){if(!n&&!r)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];let n=l(this);return new n(e=>{let r,i=0;return!function o(s){r=s.subscribe({next(t){e.next(t)},error(t){e.error(t)},complete(){i===t.length?(r=void 0,e.complete()):o(n.from(t[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=l(this);return new t(r=>{let n=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return r.error(e)}let s=t.from(i).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){let e=n.indexOf(s);e>=0&&n.splice(e,1),o()}});n.push(s)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>
1{n.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[s](){return this}static from(e){let t="function"==typeof this?this:m;if(null==e)throw TypeError(e+" is not an object");let r=u(e,s);if(r){let n=r.call(e);if(Object(n)!==n)throw TypeError(n+" is not an object");return n instanceof m&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(n("iterator")&&(r=u(e,o)))return new t(t=>{d(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),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(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return new("function"==typeof this?this:m)(e=>{d(()=>{if(!e.closed){for(let r=0;r<t.length;++r)if(e.next(t[r]),e.closed)return;e.complete()}})})}static get[a](){return this}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}}r.Observable=m,Object.defineProperty(m,Symbol("extensions"),{value:{symbol:s,hostReportError:c},configurable:!0})},523072,(e,t,r)=>{t.exports=e.r(14919).Observable}]);

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.