PageSourceSearch

https://studio.firstory.me/assets/index-Bt2MuzZD.js

js firstory.me collected 2026-10-01 09:20:18 UTC 240,118 bytes, 11 lines download raw bytes

1import{_ as x,a as _,b as H,c as D,d as A,e as w,f as Bt,g as Ge}from"./main-BjGN4ckN.js";import{g as Si}from"./react-vendor-BGQ-fvu8.js";import"./charts-vendor-fU6IkEZ_.js";import"./lodash-vendor-0cI-KiNp.js";import"./apollo-vendor-WdUFfbxi.js";function ea(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var Re;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(Re||(Re={}));var ve;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(ve||(ve={}));var on="-",$t="AMP",ta="".concat($t,"_unsent"),_i="$default_instance",Mr="https://api2.amplitude.com/2/httpapi",wi="https://api.eu.amplitude.com/2/httpapi",Ai="https://api2.amplitude.com/batch",ki="https://api.eu.amplitude.com/batch",ra="utm_campaign",na="utm_content",ia="utm_id",oa="utm_medium",aa="utm_source",sa="utm_term",an="dclid",sn="fbclid",un="gbraid",ln="gclid",cn="ko_click_id",dn="li_fat_id",fn="msclkid",vn="rdt_cid",hn="ttclid",pn="twclid",gn="wbraid",Yt={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},qt=["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"],ua=["authorization","cookie","set-cookie"],la=1e3,Tr=function(e){if(Object.keys(e).length>la)return!1;for(var t in e){var r=e[t];if(!Ii(t,r))return!1}return!0},Ii=function(e,t){var r,n;if(typeof e!="string")return!1;if(Array.isArray(t)){var i=!0;try{for(var o=x(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if(typeof s=="object")i=i&&Tr(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(t==null)return!1;if(typeof t=="object")return Tr(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},gt=(function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return _({},this._properties)},e.prototype.set=function(t,r){return this._safeSet(X.SET,t,r),this},e.prototype.setOnce=function(t,r){return this._safeSet(X.SET_ONCE,t,r),this},e.prototype.append=function(t,r){return this._safeSet(X.APPEND,t,r),this},e.prototype.prepend=function(t,r){return this._safeSet(X.PREPEND,t,r),this},e.prototype.postInsert=function(t,r){return this._safeSet(X.POSTINSERT,t,r),this},e.prototype.preInsert=function(t,r){return this._safeSet(X.PREINSERT,t,r),this},e.prototype.remove=function(t,r){return this._safeSet(X.REMOVE,t,r),this},e.prototype.add=function(t,r){return this._safeSet(X.ADD,t,r),this},e.prototype.unset=function(t){return this._safeSet(X.UNSET,t,on),this},e.prototype.clearAll=function(){return this._properties={},this._properties[X.CLEAR_ALL]=on,this}
1,e.prototype._safeSet=function(t,r,n){if(this._validate(t,r,n)){var i=this._properties[t];return i===void 0&&(i={},this._properties[t]=i),i[r]=n,this._propertySet.add(r),!0}return!1},e.prototype._validate=function(t,r,n){return this._properties[X.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:t===X.ADD?typeof n=="number":t!==X.UNSET&&t!==X.REMOVE?Ii(r,n):!0},e})(),X;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(X||(X={}));var ca=[X.CLEAR_ALL,X.UNSET,X.SET,X.SET_ONCE,X.ADD,X.APPEND,X.PREPEND,X.PREINSERT,X.POSTINSERT,X.REMOVE],da="Event tracked successfully",fa="Unexpected error occurred",va="Event rejected due to exceeded retry count",ha="Event skipped due to optOut config",mn="Event skipped due to empty event type",pa="Event rejected due to missing API key",ga="Invalid API key",ma="Client not initialized",ee;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(ee||(ee={}));var Ve=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=ee.Unknown),{event:e,code:t,message:r}},F=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},ba=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Se)},bn=H([],D(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),Se=function(e){var t,r=F();if(!(!((t=r?.crypto)===null||t===void 0)&&t.getRandomValues))return ba(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,H([],D(n.entries()),!1).map(function(i){var o=D(i,2),a=o[0],s=o[1];return[4,6,8,10].includes(a)?"-".concat(bn[s]):bn[s]}).join("")},ya=(function(){function e(t){this.client=t,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(t,r){var n,i;return A(this,void 0,void 0,function(){var o;return w(this,function(a){switch(a.label){case 0:return t.name===void 0&&(t.name=Se(),this.loggerProvider.warn(`Plugin name is undefined.
2      Generating a random UUID for plugin name: `.concat(t.name,`.
3      Set a name for the plugin to prevent it from being added multiple times.`))),o=t.name,this.pluginStatus.has(o)?(this.loggerProvider.warn("Plugin with name ".concat(o," already exists, skipping registration")),[2]):(t.type=(n=t.type)!==null&&n!==void 0?n:"enrichment",this.pluginStatus.set(o,"locked"),[4,(i=t.setup)===null||i===void 0?void 0:i.call(t,r,this.client)]);case 1:return a.sent(),this.pluginStatus.get(o)!=="locked"?[2]:(this.plugins.push(t),this.pluginStatus.set(o,"installed"),[2])}})})},e.prototype.deregister=function(t,r){var n;return A(this,void 0,void 0,function(){var i,o;return w(this,function(a){switch(a.label){case 0:return this.pluginStatus.delete(t),i=this.plugins.findIndex(function(s){return s.name===t}),i===-1?(r.loggerProvider.warn("Plugin with name ".concat(t," does not exist, skipping deregistration")),[2]):(o=this.plugins[i],this.plugins.splice(i,1),[4,(n=o.teardown)===null||n===void 0?void 0:n.call(o)]);case 1:return a.sent(),[2]}})})},e.prototype.reset=function(t){this._clearOptOutListeners(),this.applying=!1;var r=this.plugins;r.map(function(n){var i;return(i=n.teardown)===null||i===void 0?void 0:i.call(n)}),this.plugins=[],this.pluginStatus.clear(),this.client=t},e.prototype.push=function(t){var r=this;return new Promise(function(n){r.queue.push([t,n]),r.scheduleApply(0)})},e.prototype.scheduleApply=function(t){var r=this;this.applying||(this.applying=!0,setTimeout(function(){r.apply(r.queue.shift()).then(function(){r.applying=!1,r.queue.length>0&&r.scheduleApply(0)})},t))},e.prototype.apply=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a,s,l,v,h,u,c,d,f,v,h,g,y,m,p,b,E,T;return w(this,function(S){switch(S.label){case 0:if(!t)return[2];r=D(t,1),n=r[0],i=D(t,2),o=i[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(k){return k.type==="before"}),S.label=1;case 1:S.trys.push([1,6,7,8]),s=x(a),l=s.next(),S.label=2;case 2:return l.done?[3,5]:(v=l.value,v.execute?[4,v.execute(_({},n))]:[3,4]);case 3:if(h=S.sent(),h===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),S.label=4;case 4:return l=s.next(),[3,2];case 5:return[3,8];case 6:return u=S.sent(),p={error:u},[3,8];case 7:try{l&&!l.done&&(b=s.return)&&b.call(s)}finally{if(p)throw p.error}
3return[7];case 8:c=this.plugins.filter(function(k){return k.type==="enrichment"||k.type===void 0}),S.label=9;case 9:S.trys.push([9,14,15,16]),d=x(c),f=d.next(),S.label=10;case 10:return f.done?[3,13]:(v=f.value,v.execute?[4,v.execute(_({},n))]:[3,12]);case 11:if(h=S.sent(),h===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=h,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),S.label=12;case 12:return f=d.next(),[3,10];case 13:return[3,16];case 14:return g=S.sent(),E={error:g},[3,16];case 15:try{f&&!f.done&&(T=d.return)&&T.call(d)}finally{if(E)throw E.error}return[7];case 16:return y=this.plugins.filter(function(k){return k.type==="destination"}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),m=y.map(function(k){var O=_({},n);return k.execute(O).catch(function(C){return Ve(O,0,String(C))})}),Promise.all(m).then(function(k){var O=D(k,1),C=O[0],M=C||Ve(n,100,"Event not tracked, no destination plugins on the instance");o(M)}),[2]}})})},e.prototype.flush=function(){return A(this,void 0,void 0,function(){var t,r,n,i=this;return w(this,function(o){switch(o.label){case 0:return t=this.queue,this.queue=[],[4,Promise.all(t.map(function(a){return i.apply(a)}))];case 1:return o.sent(),r=this.plugins.filter(function(a){return a.type==="destination"}),n=r.map(function(a){return a.flush&&a.flush()}),[4,Promise.all(n)];case 2:return o.sent(),[2]}})})},e.prototype.addOptOutListener=function(t){this._optOutListeners.push(t)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onIdentityChanged)===null||n===void 0||n.call(r,t)})},e.prototype.onSessionIdChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onSessionIdChanged)===null||n===void 0||n.call(r,t)})},e.prototype.onOptOutChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onOptOutChanged)===null||n===void 0||n.call(r,t)}),this._callOptOutListeners(t)},e.prototype._callOptOutListeners=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a,s,l;return w(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),r=x(this._optOutListeners),n=r.next(),u.label=1;case 1:if(n.done)return[3,6];i=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,i(t)];case 3:return u.sent(),[3,5];case 4:return o=u.sent(),this.loggerProvider.error("Error calling optOut listener",o),[3,5];case 5:return n=r.next(),[3,1];case 6:return[3,9];case 7:return a=u.sent(),s={error:a},[3,9];case 8:try{n&&!n.done&&(l=r.return)&&l.call(r)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(t){var r;(r=t.onReset)===null||r===void 0||r.call(t)})},e})(),Ea=function(e,t,r){var n=typeof e=="string"?{event_type:e}:e;return _(_(_({},n),r),t&&{event_properties:t})},Ur=function(e,t){var r=_(_({},t),{event_type:ve.IDENTIFY,user_properties:e.getUserProperties()});return r},Ta=function(e,t,r,n){var i,o=_(_({},n),{event_type:ve.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)});return o},Sa=function(e,t,r){var n,i=new gt;i.set(e,t);var o=_(_({},r),{event_type:ve.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[e]=t,n)});return o},_a=function(e,t){return _(_({},t),{event_type:ve.REVENUE,event_properties:e.getEventProperties()})},de=function(e){return{promise:e||Promise.resolve()}},wa=(function(){function e(t){t===void 0&&(t="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new ya(this),this.name=t}return e.prototype._init=function(t){return A(this,void 0,void 0,function(){var r=this;return w(this,function(n){switch(n.label){case 0:return this.config=t,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return r.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(t,r){return A(this,void 0,void 0,function(){var n,i,o,a,s,l,u,c;return w(this,function(d){switch(d.label){case 0:n=this[t],this[t]=[],d.label=1;case 1:d.trys.push([1,8,9,10]),i=x(n),o=i.next(),d.label=2;case 2:return o.done?[3,7]:(a=o.value,s=a(),s&&"promise"in s?[4,s.promise]:[3,4]);case 3:return d.sent(),[3,6];case 4:return[4,s];case 5:d.sent(),d.label=6;case 6:return o=i.next(),[3,2];case 7:return[3,10];case 8:return l=d.sent(),u={error:l},[3,10];case 9:try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}
3return[7];case 10:return this[t].length?[4,this.runQueuedFunctions(t,r)]:[3,12];case 11:return d.sent(),[3,13];case 12:r?.(),d.label=13;case 13:return[2]}})})},e.prototype.track=function(t,r,n){var i=Ea(t,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),de(this.dispatch(i))},e.prototype.identify=function(t,r){var n=Ur(t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),de(this.dispatch(n))},e.prototype.groupIdentify=function(t,r,n,i){var o=Ta(t,r,n,i);return de(this.dispatch(o))},e.prototype.setGroup=function(t,r,n){var i=Sa(t,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),de(this.dispatch(i))},e.prototype.revenue=function(t,r){var n=_a(t,r);return de(this.dispatch(n))},e.prototype.add=function(t){return this.isReady?this._addPlugin(t):(this.q.push(this._addPlugin.bind(this,t)),de())},e.prototype._addPlugin=function(t){return de(this.timeline.register(t,this.config))},e.prototype.remove=function(t){return this.isReady?this._removePlugin(t):(this.q.push(this._removePlugin.bind(this,t)),de())},e.prototype._removePlugin=function(t){return de(this.timeline.deregister(t,this.config))},e.prototype.dispatchWithCallback=function(t,r){if(!this.isReady)return r(Ve(t,0,ma));this.process(t).then(r)},e.prototype.dispatch=function(t){return A(this,void 0,void 0,function(){var r=this;return w(this,function(n){return this.isReady?[2,this.process(t)]:[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,t,i))})]})})},e.prototype.getOperationAppliedUserProperties=function(t){var r,n=(r=this.userProperties)!==null&&r!==void 0?r:{},i=_({},n);if(t===void 0)return i;var o={};return Object.keys(t).forEach(function(a){Object.values(Re).includes(a)||(o[a]=t[a])}),ca.forEach(function(a){if(Object.keys(t).includes(a)){var s=t[a];
3switch(a){case Re.CLEAR_ALL:Object.keys(i).forEach(function(l){delete i[l]});break;case Re.UNSET:Object.keys(s).forEach(function(l){delete i[l]});break;case Re.SET:Object.assign(i,s);break}}}),Object.assign(i,o),i},e.prototype.process=function(t){return A(this,void 0,void 0,function(){var r,o,n,i,o;return w(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,Ve(t,0,ha)]:(r=t.event_type,typeof r!="string"||r.trim().length===0?(this.config.loggerProvider.error(mn),[2,Ve(t,0,mn)]):(t.event_type===ve.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(t)]));case 1:return o=a.sent(),o.code===200?this.config.loggerProvider.log(o.message):o.code===100?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),i=String(n),this.config.loggerProvider.error(i),o=Ve(t,0,i),[2,o];case 3:return[2]}})})},e.prototype.setOptOut=function(t){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!t));return}this._setOptOut(t)},e.prototype._setOptOut=function(t){this.config.optOut!==t&&(this.config.optOut=!!t,this.timeline.onOptOutChanged(t))},e.prototype.flush=function(){return de(this.timeline.flush())},e.prototype.plugin=function(t){var r=this.timeline.plugins.find(function(n){return n.name===t});if(r===void 0){this.config.loggerProvider.debug("Cannot find plugin with name ".concat(t));return}return r},e.prototype.plugins=function(t){return this.timeline.plugins.filter(function(r){return r instanceof t})},e})(),Aa=(function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(t){return this.productId=t,this},e.prototype.setQuantity=function(t){return t>0&&(this.quantity=t),this},e.prototype.setPrice=function(t){return this.price=t,this},e.prototype.setRevenueType=function(t){return this.revenueType=t,this},e.prototype.setCurrency=function(t){return this.currency=t,this},e.prototype.setRevenue=function(t){return this.revenue=t,this},e.prototype.setReceipt=function(t){return this.receipt=t,this},e.prototype.setReceiptSig=function(t){return this.receiptSig=t,this},e.prototype.setEventProperties=function(t){try{var r=JSON.parse(JSON.stringify(t));Tr(r)&&(this.properties=r)}catch{}return this},e.prototype.getEventProperties=function(){var t=this.properties?_({},this.properties):{};return t[Ee.REVENUE_PRODUCT_ID]=this.productId,t[Ee.REVENUE_QUANTITY]=this.quantity,t[Ee.REVENUE_PRICE]=this.price,t[Ee.REVENUE_TYPE]=this.revenueType,t[Ee.REVENUE_CURRENCY]=this.currency,t[Ee.REVENUE]=this.revenue,t[Ee.RECEIPT]=this.receipt,t[Ee.RECEIPT_SIG]=this.receiptSig,t},e})(),Ee;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"})(Ee||(Ee={}));var ka=function(e,t){var r=Math.max(t,1);return e.reduce(function(n,i,o){var a=Math.floor(o/r);return n[a]||(n[a]=[]),n[a].push(i),n},[])},fe;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})(fe||(fe={}));var kt="Amplitude Logger ",Fr=(function(){function e(){this.logLevel=fe.None}return e.prototype.disable=function(){this.logLevel=fe.None},e.prototype.enable=function(t){t===void 0&&(t=fe.Warn),this.logLevel=t},e.prototype.log=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<fe.Verbose||console.log("".concat(kt,"[Log]: ").concat(t.join(" ")))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<fe.Warn||console.warn("".concat(kt,"[Warn]: ").concat(t.join(" ")))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<fe.Error||console.error("".concat(kt,"[Error]: ").concat(t.join(" ")))},e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<fe.Debug||console.log("".concat(kt,"[Debug]: ").concat(t.join(" ")))},e})(),Nt=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:_i,logLevel:fe.Warn,loggerProvider:new Fr,offline:!1,optOut:!1,serverUrl:Mr,serverZone:"US",useBatch:!1}},Ia=(function(){function e(t){var r,n,i,o;this._optOut=!1;var a=Nt();this.apiKey=t.apiKey,this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=t.flushQueueSize||a.flushQueueSize,this.instanceName=t.instanceName||a.instanceName,this.loggerProvider=t.loggerProvider||a.loggerProvider,this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=t.minIdLength,this.plan=t.plan,this.ingestionMetadata=t.ingestionMetadata,this.offline=t.offline!==void 0?t.offline:a.offline,this.optOut=(i=t.optOut)!==null&&i!==void 0?i:a.optOut,this.serverUrl=t.serverUrl,this.serverZone=t.serverZone||a.serverZone,this.storageProvider=t.storageProvider,this.transportProvider=t.transportProvider,this.useBatch=(o=t.useBatch)!==null&&o!==void 0?o:a.useBatch,this.loggerProvider.enable(this.logLevel);var s=Pi(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t}
3,enumerable:!1,configurable:!0}),e})(),Pa=function(e,t){return e==="EU"?t?ki:wi:t?Ai:Mr},Pi=function(e,t,r){if(e===void 0&&(e=""),t===void 0&&(t=Nt().serverZone),r===void 0&&(r=Nt().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:Nt().serverZone;return{serverZone:n,serverUrl:Pa(n,r)}},Oa=(function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(t,r){this.sdk.metrics.histogram[t]=r},e})();function Sr(e){return e>=200&&e<300}var Mt=function(e){e===void 0&&(e=0);var t=new Error().stack||"";return t.split(`
4`).slice(2+e).map(function(r){return r.trim()})},Y=function(e){return function(){var t=_({},e.config),r=t.loggerProvider,n=t.logLevel;return{logger:r,logLevel:n}}},Ca=function(e,t){var r,n;t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,"");try{for(var i=x(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in e)e=e[a];else return}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return e},J=function(e,t){return function(){var r,n,i={};try{for(var o=x(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=Ca(e,s)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},Q=function(e,t,r,n,i){return i===void 0&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=r(),l=s.logger,u=s.logLevel;if(u&&u<fe.Debug||!u||!l)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:Mt(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()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))),d}},Ra=new Set([Mr,wi,Ai,ki]),Da=function(e,t){return t===void 0&&(t=!1),Ra.has(e)?!0:t};function xa(e){return e instanceof Error?e.message:String(e)}function at(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var La=(function(){function e(t){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=t?.diagnosticsClient}return e.prototype.setup=function(t){var r;return A(this,void 0,void 0,function(){var n,i=this;return w(this,function(o){switch(o.label){case 0:return this.config=t,this.storageKey="".concat(ta,"_").concat(this.config.apiKey.substring(0,10)),[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:return n=o.sent(),n&&n.length>0&&Promise.all(n.map(function(a){return i.execute(a)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(t){var r=this;return t.insert_id||(t.insert_id=Se()),new Promise(function(n){var i={event:t,attempts:0,callback:function(o){return n(o)},timeout:0};r.queue.push(i),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(t){var r=this;return t.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,va),!1)})},e.prototype.scheduleEvents=function(t){var r=this;t.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},e.prototype.schedule=function(t){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&t>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=t,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},t);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(t){return t===void 0&&(t=!1),A(this,void 0,void 0,function(){var r,n,i,o=this;return w(this,function(a){switch(a.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),r=[],n=[],this.queue.forEach(function(s){return s.timeout===0?r.push(s):n.push(s)}),i=ka(r,this.config.flushQueueSize),[4,i.reduce(function(s,l){return A(o,void 0,void 0,function(){return w(this,function(u){switch(u.label){case 0:return[4,s];case 1:return u.sent(),[4,this.send(l,t)];case 2:return[2,u.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(t,r){var n;return r===void 0&&(r=!0),A(this,void 0,void 0,function(){var i,o,a,s,l,u;return w(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(t,400,pa)];i={api_key:this.config.apiKey,events:t.map(function(d){var f=d.event;f.extra;var v=Bt(f,["extra"]);return v}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new Oa,c.label=1;case 1:return c.trys.push([1,3,,4]),o=Pi(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,a=Da(o,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(o,i,a)];case 2:return s=c.sent(),s===null?(this.fulfillRequest(t,0,fa),[2]):r?(this.handleResponse(s,t),[3,4]):("body"in s?this.fulfillRequest(t,s.statusCode,"".concat(s.status,": ").concat(at(s))):this.fulfillRequest(t,s.statusCode,s.status),[2]);case 3:return l=c.sent(),u=xa(l),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:t.map(function(d){return d.event.event_type}),message:u,stack_trace:Mt()}),this.handleResponse({status:ee.Failed,statusCode:0},t),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(t,r){var n;Sr(t.statusCode)||(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful",{events:r.map(function(o){return o.event.event_type}),code:t.statusCode,status:t.status,body:at(t),stack_trace:Mt()});var i=t.status;switch(i){case ee.Success:{this.handleSuccessResponse(t,r);break}case ee.Invalid:{this.handleInvalidResponse(t,r);break}case ee.PayloadTooLarge:{this.handlePayloadTooLargeResponse(t,r);break}case ee.RateLimit:{this.handleRateLimitResponse(t,r);break}default:{this.config.loggerProvider.warn(`{code: 0, error: "Status '`.concat(i,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},e.prototype.handleSuccessResponse=function(t,r){this.fulfillRequest(r,t.statusCode,da)},e.prototype.handleInvalidResponse=function(t,r){var n=this;if(t.body.missingField||t.body.error.startsWith(ga)){this.fulfillRequest(r,t.statusCode,t.body.error);return}var i=H(H(H(H([],D(Object.values(t.body.eventsWithInvalidFields)),!1),D(Object.values(t.body.eventsWithMissingFields)),!1),D(Object.values(t.body.eventsWithInvalidIdLengths)),!1),D(t.body.silencedEvents),!1).flat(),o=new Set(i),a=r.filter(function(l,u){if(o.has(u)){n.fulfillRequest([l],t.statusCode,t.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(at(t));
4var s=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(s)},e.prototype.handlePayloadTooLargeResponse=function(t,r){if(r.length===1){this.fulfillRequest(r,t.statusCode,t.body.error);return}this.config.loggerProvider.warn(at(t)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(t,r){var n=this,i=Object.keys(t.body.exceededDailyQuotaUsers),o=Object.keys(t.body.exceededDailyQuotaDevices),a=t.body.throttledEvents,s=new Set(i),l=new Set(o),u=new Set(a),c=r.filter(function(f,v){if(f.event.user_id&&s.has(f.event.user_id)||f.event.device_id&&l.has(f.event.device_id)){n.fulfillRequest([f],t.statusCode,t.body.error);return}return u.has(v)&&(f.timeout=n.throttleTimeout),!0});c.length>0&&this.config.loggerProvider.warn(at(t));var d=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(d)},e.prototype.handleOtherResponse=function(t){var r=this,n=t.map(function(o){return o.timeout=o.attempts*r.retryTimeout,o}),i=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(i)},e.prototype.fulfillRequest=function(t,r,n){var i,o,a;Sr(r)?(a=this.diagnosticsClient)===null||a===void 0||a.increment("analytics.events.sent",t.length):((i=this.diagnosticsClient)===null||i===void 0||i.increment("analytics.events.dropped",t.length),(o=this.diagnosticsClient)===null||o===void 0||o.recordEvent("analytics.events.dropped",{events:t.map(function(s){return s.event.event_type}),code:r,message:n,stack_trace:Mt()})),this.removeEvents(t),t.forEach(function(s){return s.callback(Ve(s.event,r,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var t=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,t)}},e.prototype.removeEvents=function(t){this.queue=this.queue.filter(function(r){return!t.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},e})();class Na{getApplicationContext(){return{versionName:this.versionName,language:Ma(),platform:"Web",os:void 0,deviceModel:void 0}}}const Ma=()=>typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class Ua{constructor(){this.queue=[]}logEvent(t){this.receiver?this.receiver(t):this.queue.length<512&&this.queue.push(t)}setEventReceiver(t){this.receiver=t,this.queue.length>0&&(this.queue.forEach(r=>{t(r)}),this.queue=[])}}const Ut=(e,t)=>{const r=["string","number","boolean","undefined"],n=typeof e;if(n!==typeof t)return!1;for(const s of r)if(s===n)return e===t;if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;const o=Array.isArray(e),a=Array.isArray(t);if(o!==a)return!1;if(o&&a){for(let s=0;s<e.length;s++)if(!Ut(e[s],t[s]))return!1}else{const s=Object.keys(e).sort(),l=Object.keys(t).sort();if(!Ut(s,l))return!1;let u=!0;return Object.keys(e).forEach(c=>{Ut(e[c],t[c])||(u=!1)}),u}return!0},Fa="$set",Va="$unset",Ha="$clearAll";Object.entries||(Object.entries=function(e){const t=Object.keys(e);let r=t.length;const n=new Array(r);for(;r--;)n[r]=[t[r],e[t[r]]];return n});class Ba{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){const t=this,r=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},this.identity),{userProperties:r});return{setUserId:function(i){return n.userId=i,this},setDeviceId:function(i){return n.deviceId=i,this},setUserProperties:function(i){return n.userProperties=i,this},setOptOut(i){return n.optOut=i,this},updateUserProperties:function(i){let o=n.userProperties||{};for(const[a,s]of Object.entries(i))switch(a){case Fa:for(const[l,u]of Object.entries(s))o[l]=u;break;case Va:for(const l of Object.keys(s))delete o[l];break;case Ha:o={};break}return n.userProperties=o,this},commit:function(){return t.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(t){const r=Object.assign({},this.identity);this.identity=Object.assign({},t),Ut(r,this.identity)||this.listeners.forEach(n=>{n(t)})}addIdentityListener(t){this.listeners.add(t)}removeIdentityListener(t){this.listeners.delete(t)}}const st=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self;
4class Vr{constructor(){this.identityStore=new Ba,this.eventBridge=new Ua,this.applicationContextProvider=new Na}static getInstance(t){return st.analyticsConnectorInstances||(st.analyticsConnectorInstances={}),st.analyticsConnectorInstances[t]||(st.analyticsConnectorInstances[t]=new Vr),st.analyticsConnectorInstances[t]}}var Et=function(e){return e===void 0&&(e=_i),Vr.getInstance(e)},qa=function(e,t){Et(t).identityStore.editIdentity().setUserId(e).commit()},Ga=function(e,t){Et(t).identityStore.editIdentity().setDeviceId(e).commit()},Wa=(function(){function e(){this.name="identity",this.type="before",this.identityStore=Et().identityStore}return e.prototype.execute=function(t){return A(this,void 0,void 0,function(){var r;return w(this,function(n){return r=t.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,t]})})},e.prototype.setup=function(t){return A(this,void 0,void 0,function(){return w(this,function(r){return t.instanceName&&(this.identityStore=Et(t.instanceName).identityStore),[2]})})},e})(),Oi=function(e,t){t===void 0&&(t=Date.now());var r=Date.now(),n=r-t;return n>e},Ci=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[$t,t,e.substring(0,r)].filter(Boolean).join("_")},ja=function(e){return"".concat($t.toLowerCase(),"_").concat(e.substring(0,6))},Ka=function(){var e,t,r,n;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(n=(r=(t=(e=navigator.languages)===null||e===void 0?void 0:e[0])!==null&&t!==void 0?t:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""},Gt=function(){var e,t=F();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(i,o){var a=o.split("=",2),s=yn(a[0]),l=yn(a[1]);return l&&(i[s]=l),i},{});return n},yn=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}},_r=function(e,t){return!t||!t.length?!0:t.some(function(r){return typeof r=="string"?e===r:e.match(r)})},Te=function(e,t){var r=e;try{r=decodeURI(e)}catch(n){t?.error("Malformed URI sequence: ",n)}return r},za=function(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t},En=function(e,t){var r=za(e.toString()),n=Math.abs(r),i=n*31,o=i%1e5;return o/1e5<t},Ri=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t},Hr=(function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return A(this,void 0,void 0,function(){return w(this,function(t){return[2,!0]})})},e.prototype.get=function(t){return A(this,void 0,void 0,function(){return w(this,function(r){return[2,this.memoryStorage.get(t)]})})},e.prototype.getRaw=function(t){return A(this,void 0,void 0,function(){var r;return w(this,function(n){switch(n.label){case 0:return[4,this.get(t)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},e.prototype.set=function(t,r){return A(this,void 0,void 0,function(){return w(this,function(n){return this.memoryStorage.set(t,r),[2]})})},e.prototype.remove=function(t){return A(this,void 0,void 0,function(){return w(this,function(r){return this.memoryStorage.delete(t),[2]})})},e.prototype.reset=function(){return A(this,void 0,void 0,function(){return w(this,function(t){return this.memoryStorage.clear(),[2]})})},e})(),Xa=function(){var e,t=F();return(e=t?.navigator)===null||e===void 0?void 0:e.locks},Wt=(function(){function e(t,r){r===void 0&&(r={}),this.options=_({},t),this.config=r}return e.prototype.isEnabled=function(){return A(this,void 0,void 0,function(){var t,r,n,i,o=this;return w(this,function(a){switch(a.label){case 0:return t="AMP_TEST",r=_({},this.options),n=new e(r),i=String(Date.now()),[4,n.transaction(t,function(s){var l,u;try{s.set(i);var c=s.get(),d=c===i;return!d&&o.config.diagnosticsClient&&((l=o.config.diagnosticsClient)===null||l===void 0||l.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),d}catch(v){if(o.config.diagnosticsClient){var f=v instanceof Error?v.message:String(v);(u=o.config.diagnosticsClient)===null||u===void 0||u.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:f,sync:!0})}return!1}finally{s.set(null)}})];case 1:return[2,a.sent()]}})})},e.prototype.get=function(t){return A(this,void 0,void 0,function(){var r;return w(this,function(n){switch(n.label){case 0:return[4,this.getRaw(t)];case 1:return r=n.sent(),[2,this.decodeCookieValue(t,r)]}})})},e.prototype.decodeCookieValue=function(t,r){if(r)try{var n=Di(r);if(n===void 0){console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(t,", value: ").concat(r));return}return JSON.parse(n)}catch{console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(t,", value: ").concat(r));return}},e.prototype.getSync=function(t){var r=this.getRawSync(t);return this.decodeCookieValue(t,r)},e.prototype.getRaw=function(t){var r,n;return A(this,void 0,void 0,function(){var i,o,a,s,l,u,c,d,f;return w(this,function(v){switch(v.label){case 0:i=F(),o=i,v.label=1;
4case 1:return v.trys.push([1,4,,5]),a=o?.cookieStore,a?[4,a.getAll(t)]:[3,3];case 2:if(s=v.sent(),s){s.length>1&&((r=this.config.diagnosticsClient)===null||r===void 0||r.recordEvent("cookies.duplicate",{cookies:s.map(function(h){return h.domain})}),(n=this.config.diagnosticsClient)===null||n===void 0||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(l=x(s),u=l.next();!u.done;u=l.next())if(c=u.value,xi(c.domain,this.options.domain))return[2,c.value]}catch(h){d={error:h}}finally{try{u&&!u.done&&(f=l.return)&&f.call(l)}finally{if(d)throw d.error}}}v.label=3;case 3:return[3,5];case 4:return v.sent(),[3,5];case 5:return[2,this.getRawSync(t)]}})})},e.prototype.getRawSync=function(t){var r=this,n,i,o=F(),a=((i=(n=o?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&i!==void 0?i:[]).filter(function(u){return u.indexOf(t+"=")===0}),s=void 0,l=this.config.duplicateResolverFn;if(typeof l=="function"&&a.length>1&&(s=a.find(function(u){var c;try{var d=l(u.substring(t.length+1));return d||(c=r.config.diagnosticsClient)===null||c===void 0||c.increment("cookies.duplicate.occurrence.document.cookie"),d}catch{return!1}})),s||(s=a[0]),!!s)return s.substring(t.length+1)},e.prototype.set=function(t,r){return A(this,void 0,void 0,function(){return w(this,function(n){return this.setSync(t,r),[2]})})},e.prototype.setSync=function(t,r){var n;try{var i=F();if(!i||!i.document||typeof i.btoa!="function"||typeof i.encodeURIComponent!="function")return;var o=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,a=r!==null?o:-1,s=void 0;if(a){var l=new Date;l.setTime(l.getTime()+a*24*60*60*1e3),s=l}var u="".concat(t,"=").concat(i.btoa(i.encodeURIComponent(JSON.stringify(r))));s&&(u+="; expires=".concat(s.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),i.document.cookie=u}catch(d){var c=d instanceof Error?d.message:String(d);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(t,". Error: ").concat(c))}},e.prototype.remove=function(t){return A(this,void 0,void 0,function(){return w(this,function(r){switch(r.label){case 0:return[4,this.set(t,null)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(){return A(this,void 0,void 0,function(){return w(this,function(t){return[2]})})},e.isDomainWritable=function(t){return A(this,void 0,void 0,function(){var r,n,i,o;return w(this,function(a){switch(a.label){case 0:if(e.cachedTlds[t])return[2,!0];r={domain:"."+t},n="AMP_TLDTEST",i=new e(r),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i.transaction(n,function(s){if(e.cachedTlds[t])return!0;try{s.set(1);var l=!!s.get();return l&&(e.cachedTlds[t]=!0),l}finally{s.set(null)}})];case 2:return o=a.sent(),[2,!!o];case 3:return a.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(t,r){return A(this,void 0,void 0,function(){var n,i,o=this;return w(this,function(a){switch(a.label){case 0:if(n=Xa(),i=function(){var s={get:function(){return o.getSync(t)},set:function(l){return o.setSync(t,l)}};return r(s)},!n)return[2,i()];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(t),i)];case 2:return[2,a.sent()];case 3:return a.sent(),[2,i()];case 4:return[2]}})})},e.cachedTlds={},e})(),$a=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Ya=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},Di=function(e){var t;return(t=$a(e))!==null&&t!==void 0?t:Ya(e)},xi=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()},Tn=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[$t,t,e.substring(0,r)].filter(Boolean).join("_")},Jt=(function(){function e(t){this.storage=t}return e.prototype.isEnabled=function(){return A(this,void 0,void 0,function(){var t,r,n,i;return w(this,function(o){switch(o.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return o.sent(),[4,r.get(n)];case 3:return i=o.sent(),[2,i===t];case 4:return o.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){return A(this,void 0,void 0,function(){var r;return w(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(t)];case 1:return r=n.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(t){var r;return A(this,void 0,void 0,function(){return w(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(t))||void 0]})})},e.prototype.set=function(t,r){var n;return A(this,void 0,void 0,function(){return w(this,function(i){try{(n=this.storage)===null||n===void 0||n.setItem(t,JSON.stringify(r))}catch{}return[2]})})},e.prototype.remove=function(t){var r;return A(this,void 0,void 0,function(){return w(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(t)}catch{}return[2]})})},e.prototype.reset=function(){var t;return A(this,void 0,void 0,function(){return w(this,function(r){try{(t=this.storage)===null||t===void 0||t.clear()}catch{}return[2]})})},e})(),Ja=10,Qa=1,W={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},Sn={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},_n=(function(){function e(t,r){this.dbPromise=null,this.logger=r,this.dbName="AMP_diagnostics_".concat(t.substring(0,10))}return e.isSupported=function(){var t;return((t=F())===null||t===void 0?void 0:t.indexedDB)!==void 0},e.prototype.getDB=function(){return A(this,void 0,void 0,function(){return w(this,function(t){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var t=this;return new Promise(function(r,n){var i=indexedDB.open(t.dbName,Qa);i.onerror=function(){t.dbPromise=null,n(new Error("Failed to open IndexedDB"))},i.onsuccess=function(){var o=i.result;
4o.onclose=function(){t.dbPromise=null,t.logger.debug("DiagnosticsStorage: DB connection closed.")},o.onerror=function(a){t.logger.debug("DiagnosticsStorage: A global database error occurred.",a),o.close()},r(o)},i.onupgradeneeded=function(){var o=i.result;if(!o){t.logger.debug("DiagnosticsStorage: Missing DB during upgrade.");return}t.createTables(o)}})},e.prototype.createTables=function(t){if(t.objectStoreNames.contains(W.TAGS)||t.createObjectStore(W.TAGS,{keyPath:"key"}),t.objectStoreNames.contains(W.COUNTERS)||t.createObjectStore(W.COUNTERS,{keyPath:"key"}),t.objectStoreNames.contains(W.HISTOGRAMS)||t.createObjectStore(W.HISTOGRAMS,{keyPath:"key"}),!t.objectStoreNames.contains(W.EVENTS)){var r=t.createObjectStore(W.EVENTS,{keyPath:"id",autoIncrement:!0});r.createIndex("time_idx","time",{unique:!1})}t.objectStoreNames.contains(W.INTERNAL)||t.createObjectStore(W.INTERNAL,{keyPath:"key"})},e.prototype.setTags=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a=this;return w(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([W.TAGS],"readwrite"),i=n.objectStore(W.TAGS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set tags",c),l()},u.forEach(function(c){var d=D(c,2),f=d[0],v=d[1],h=i.put({key:f,value:v});h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to set tag",f,v,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",o),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a=this;return w(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([W.COUNTERS],"readwrite"),i=n.objectStore(W.COUNTERS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to increment counters",c),l()},u.forEach(function(c){var d=D(c,2),f=d[0],v=d[1],h=i.get(f);h.onsuccess=function(){var g=h.result,y=g?g.value:0,m=i.put({key:f,value:y+v});m.onerror=function(p){a.logger.debug("DiagnosticsStorage: Failed to update counter",f,p)}},h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to read existing counter",f,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",o),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a=this;return w(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([W.HISTOGRAMS],"readwrite"),i=n.objectStore(W.HISTOGRAMS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",c),l()},u.forEach(function(c){var d=D(c,2),f=d[0],v=d[1],h=i.get(f);h.onsuccess=function(){var g=h.result,y;g?y={key:f,count:g.count+v.count,min:Math.min(g.min,v.min),max:Math.max(g.max,v.max),sum:g.sum+v.sum}:y={key:f,count:v.count,min:v.min,max:v.max,sum:v.sum};var m=i.put(y);m.onerror=function(p){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",f,p)}},h.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",f,g)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",o),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(t){return A(this,void 0,void 0,function(){var r,n,i,o,a=this;return w(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t.length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([W.EVENTS],"readwrite"),i=n.objectStore(W.EVENTS),[2,new Promise(function(l){n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to add event records",c),l()};var u=i.count();u.onsuccess=function(){var c=u.result,d=Math.max(0,Ja-c);d<t.length&&a.logger.debug("DiagnosticsStorage: Only added ".concat(d," of ").concat(t.length," events due to storage limit")),t.slice(0,d).forEac
4h(function(f){var v=i.add(f);v.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to add event record",h)}})},u.onerror=function(c){a.logger.debug("DiagnosticsStorage: Failed to count existing events",c)}})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",o),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(t,r){return A(this,void 0,void 0,function(){var n,i,o,a;return w(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=s.sent(),i=n.transaction([W.INTERNAL],"readwrite"),o=i.objectStore(W.INTERNAL),[2,new Promise(function(l,u){i.onabort=function(){return u(new Error("Failed to set internal value"))};var c=o.put({key:t,value:r});c.onsuccess=function(){return l()},c.onerror=function(){return u(new Error("Failed to set internal value"))}})];case 2:return a=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",a),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(t){return A(this,void 0,void 0,function(){var r,n,i,o;return w(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=a.sent(),n=r.transaction([W.INTERNAL],"readonly"),i=n.objectStore(W.INTERNAL),[2,new Promise(function(s,l){n.onabort=function(){return l(new Error("Failed to get internal value"))};var u=i.get(t);u.onsuccess=function(){return s(u.result)},u.onerror=function(){return l(new Error("Failed to get internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",o),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return A(this,void 0,void 0,function(){var t,r;return w(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Sn.LAST_FLUSH_TIMESTAMP)];case 1:return t=n.sent(),[2,t?parseInt(t.value,10):void 0];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",r),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(t){return A(this,void 0,void 0,function(){var r;return w(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Sn.LAST_FLUSH_TIMESTAMP,t.toString())];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",r),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(t,r){return new Promise(function(n,i){var o=t.objectStore(r),a=o.clear();a.onsuccess=function(){return n()},a.onerror=function(){return i(new Error("Failed to clear table ".concat(r)))}})},e.prototype.getAllAndClear=function(){return A(this,void 0,void 0,function(){var t,r,n,i,o,a,s,l;return w(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return t=u.sent(),r=t.transaction([W.TAGS,W.COUNTERS,W.HISTOGRAMS,W.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(r,W.TAGS),this.getAllFromStore(r,W.COUNTERS),this.getAllFromStore(r,W.HISTOGRAMS),this.getAllFromStore(r,W.EVENTS)])];case 2:return n=D.apply(void 0,[u.sent(),4]),i=n[0],o=n[1],a=n[2],s=n[3],[4,Promise.all([this.clearTable(r,W.COUNTERS),this.clearTable(r,W.HISTOGRAMS),this.clearTable(r,W.EVENTS)])];case 3:return u.sent(),[2,{tags:i,counters:o,histogramStats:a,events:s}];case 4:return l=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",l),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(t,r){return new Promise(function(n,i){var o=t.objectStore(r),a=o.getAll();a.onsuccess=function(){return n(a.result)},a.onerror=function(){return i(new Error("Failed to get all from ".concat(r)))}})},e})(),Za="__AMPLITUDE_SCRIPT_URL__",es="sdk.error.uncaught",ts=function(){var e=F();if(!e)return[];var t=e[Za];return Array.isArray(t)?t:typeof t=="string"?[t]:[]},rs=function(e){var t=F();if(!(!t||typeof t.addEventListener!="function")){var r=function(o){var a=o.error instanceof Error?o.error:void 0,s=a?.stack,l=wn({filename:o.filename,stack:s});l&&i({type:"error",message:o.message,stack:s,filename:o.filename,errorName:a?.name,metadata:{colno:o.colno,lineno:o.lineno,isTrusted:o.isTrusted,matchReason:l}})},n=function(o){var a,s=o.reason instanceof Error?o.reason:void 0,l=s?.stack,u=ns(l),c=wn({filename:u,stack:l});c&&i({type:"unhandledrejection",message:(a=s?.message)!==null&&a!==void 0?a:is(o.reason),stack:l,filename:u,errorName:s?.name,metadata:{isTrusted:o.isTrusted,matchReason:c}})},i=function(o){e.recordEvent(es,_({type:o.type,message:o.message,filename:o.filename,error_name:o.errorName,stack:o.stack},o.metadata))};t.addEventListener("error",r,!0),t.addEventListener("unhandledrejection",n,!0)}},wn=function(e){var t,r,n=ts();if(n.length!==0)try{for(var i=x(n),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(s){t={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},ns=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},is=function(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"[object Object]"}},os=1e3,It=300*1e3,as="https://diagnostics.prod.us-west-2.amplitude.com/v1/capture",ss="https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",ir=1e4,us=10,ls=(function(){function e(t,r,n,i,o){n===void 0&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=t,this.logger=r,this.serverUrl=n==="US"?as:ss,this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(i,null,2)),this.config=_({enabled:!0,sampleRate:0},i),this.startTimestamp=Date.now(),this.shouldTrack=En(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,o?this.storage=o:_n.isSupported()?this.storage=new _n(t,r):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),rs(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(t,r){if(this.isStorageAndTrackEnabled()){if
4(Object.keys(this.inMemoryTags).length>=ir){this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");return}this.inMemoryTags[t]=r,this.startTimersIfNeeded()}},e.prototype.increment=function(t,r){if(r===void 0&&(r=1),!!this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=ir){this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");return}this.inMemoryCounters[t]=(this.inMemoryCounters[t]||0)+r,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(t,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=ir){this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");return}var n=this.inMemoryHistograms[t];n?(n.count+=1,n.min=Math.min(n.min,r),n.max=Math.max(n.max,r),n.sum+=r):this.inMemoryHistograms[t]={count:1,min:r,max:r,sum:r},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(t,r){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=us){this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");return}this.inMemoryEvents.push({event_name:t,time:Date.now(),event_properties:r}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var t=this;this.saveTimer||(this.saveTimer=setTimeout(function(){t.saveAllDataToStorage().catch(function(r){t.logger.debug("DiagnosticsClient: Failed to save all data to storage",r)}).finally(function(){t.saveTimer=null})},os)),this.flushTimer||(this.flushTimer=setTimeout(function(){t._flush().catch(function(r){t.logger.debug("DiagnosticsClient: Failed to flush",r)}).finally(function(){t.flushTimer=null})},It))},e.prototype.saveAllDataToStorage=function(){return A(this,void 0,void 0,function(){var t,r,n,i;return w(this,function(o){switch(o.label){case 0:return this.storage?(t=_({},this.inMemoryTags),r=_({},this.inMemoryCounters),n=_({},this.inMemoryHistograms),i=H([],D(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(t),this.storage.incrementCounters(r),this.storage.setHistogramStats(n),this.storage.addEventRecords(i)])]):[2];case 1:return o.sent(),[2]}})})},e.prototype._flush=function(){return A(this,void 0,void 0,function(){var t,r,n,i,o,a,s,l,u,c;return w(this,function(d){switch(d.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return d.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return t=d.sent(),r=t.tags,n=t.counters,i=t.histogramStats,o=t.events,this.storage.setLastFlushTimestamp(Date.now()),a={},r.forEach(function(f){a[f.key]=f.value}),s={},n.forEach(function(f){s[f.key]=f.value}),l={},i.forEach(function(f){l[f.key]={count:f.count,min:f.min,max:f.max,avg:Math.round(f.sum/f.count*100)/100}}),u=o.map(function(f){return{event_name:f.event_name,time:f.time,event_properties:f.event_properties}}),Object.keys(s).length===0&&Object.keys(l).length===0&&u.length===0?[2]:(c={tags:a,histogram:l,counters:s,events:u},this.fetch(c),[2])}})})},e.prototype.fetch=function(t){return A(this,void 0,void 0,function(){var r,n;return w(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),!F())throw new 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(t)})];case 1:return r=i.sent(),r.ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return n=i.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",n),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return A(this,void 0,void 0,function(){var t,r,n;return w(this,function(i){switch(i.label){case 0:return this.storage?(t=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return r=i.sent()||-1,r===-1?(this.storage.setLastFlushTimestamp(t),this._setFlushTimer(It),[2]):(n=t-r,n>=It?(this._flush(),[2]):(this._setFlushTimer(It-n),[2]))}})})},e.prototype._setFlushTimer=function(t){var r=this;this.flushTimer=setTimeout(function(){r._flush().catch(function(n){r.logger.debug("DiagnosticsClient: Failed to flush",n)}).finally(function(){r.flushTimer=null})},t)},e.prototype._setSampleRate=function(t){this.logger.debug("DiagnosticsClient: Setting sample rate to",t),this.config.sampleRate=t,this.shouldTrack=En(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e})(),Br=(function(){function e(){}return e.prototype.send=function(t,r,n){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,i,o,a,s,l,u,c,d,f,v,h,g,y,m,p,b,E,T,S,k;if(typeof t!="object")return null;var O=t.code||0,C=this.buildStatus(O);switch(C){case ee.Success:return{status:C,statusCode:O,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=t.server_upload_time)!==null&&i!==void 0?i:0}};case ee.Invalid:return{status:C,statusCode:O,body:{error:(o=t.error)!==null&&o!==void 0?o:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(s=t.events_with_invali
4d_fields)!==null&&s!==void 0?s:{},eventsWithMissingFields:(l=t.events_with_missing_fields)!==null&&l!==void 0?l:{},eventsWithInvalidIdLengths:(u=t.events_with_invalid_id_lengths)!==null&&u!==void 0?u:{},epsThreshold:(c=t.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(d=t.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(f=t.silenced_devices)!==null&&f!==void 0?f:[],silencedEvents:(v=t.silenced_events)!==null&&v!==void 0?v:[],throttledDevices:(h=t.throttled_devices)!==null&&h!==void 0?h:{},throttledEvents:(g=t.throttled_events)!==null&&g!==void 0?g:[]}};case ee.PayloadTooLarge:return{status:C,statusCode:O,body:{error:(y=t.error)!==null&&y!==void 0?y:""}};case ee.RateLimit:return{status:C,statusCode:O,body:{error:(m=t.error)!==null&&m!==void 0?m:"",epsThreshold:(p=t.eps_threshold)!==null&&p!==void 0?p:0,throttledDevices:(b=t.throttled_devices)!==null&&b!==void 0?b:{},throttledUsers:(E=t.throttled_users)!==null&&E!==void 0?E:{},exceededDailyQuotaDevices:(T=t.exceeded_daily_quota_devices)!==null&&T!==void 0?T:{},exceededDailyQuotaUsers:(S=t.exceeded_daily_quota_users)!==null&&S!==void 0?S:{},throttledEvents:(k=t.throttled_events)!==null&&k!==void 0?k:[]}};case ee.Timeout:default:return{status:C,statusCode:O}}},e.prototype.buildStatus=function(t){return Sr(t)?ee.Success:t===429?ee.RateLimit:t===413?ee.PayloadTooLarge:t===408?ee.Timeout:t>=400&&t<500?ee.Invalid:t>=500?ee.Failed:ee.Unknown},e})(),Li=2*1024;function Ni(){return typeof CompressionStream<"u"}function Mi(e){return A(this,void 0,void 0,function(){var t,r;return w(this,function(n){switch(n.label){case 0:if(t=CompressionStream,typeof t>"u")return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),r=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(r).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var cs=(function(){function e(t,r){this.key="AMP_remote_config_".concat(t.substring(0,10)),this.logger=r}return e.prototype.fetchConfig=function(){var t=null,r={remoteConfig:null,lastFetch:new Date};try{t=localStorage.getItem(this.key)}catch(i){return this.logger.debug("Remote config localstorage failed to access: ",i),Promise.resolve(r)}if(t===null)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(r);try{var n=JSON.parse(t);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(i){return this.logger.debug("Remote config localstorage failed to parse: ",i),localStorage.removeItem(this.key),Promise.resolve(r)}},e.prototype.setConfig=function(t){try{return localStorage.setItem(this.key,JSON.stringify(t)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(r){this.logger.debug("Remote config localstorage failed to set: ",r)}return Promise.resolve(!1)},e})();function ds(e,t){return new Promise(function(r,n){var i=function(){var o=new Error("Remote config custom fetch aborted by timeout");o.name="AbortError",n(o)};t.addEventListener("abort",i,{once:!0}),e.then(function(o){t.removeEventListener("abort",i),r(o)},function(o){t.removeEventListener("abort",i),n(o)})})}var fs="https://sr-client-cfg.amplitude.com/config",vs="https://sr-client-cfg.eu.amplitude.com/config",hs=3,or={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},ps=1e3,gs=300*1e3,ms=(function(){function e(t,r,n,i,o){n===void 0&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.serverUrl=i||(n==="US"?fs:vs),this.logger=r,this.storage=new cs(t,r),this.customFetch=o}return e.prototype.subscribe=function(t,r,n){var i=Se(),o={id:i,key:t,deliveryMode:r,callback:n};return this.callbackInfos.push(o),r==="all"?this.subscribeAll(o):this.subscribeWaitForRemote(o,r.timeout),i},e.prototype.unsubscribe=function(t){var r=this.callbackInfos.findIndex(function(n){return n.id===t});return r===-1?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(t," doesn't exist.")),!1):(this.callbackInfos.splice(r,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(t,".")),!0)},e.prototype.updateConfigs=function(){return A(this,void 0,void 0,function(){var t,r,n=this;return w(this,function(i){switch(i.label){case 0:return this.lastSuccessfulFetch&&(t=Date.now()-this.lastSuccessfulFetch,t<gs)?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return r=i.sent(),this.storage.setConfig(r),this.callbackInfos.forEach(function(o){n.sendCallback(o,r,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var t=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvali
4dApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){t.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(r){return r.remoteConfig!==null&&(t.lastSuccessfulFetch=Date.now()),r}).finally(function(){t.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(t){return A(this,void 0,void 0,function(){var r,n,i,o=this;return w(this,function(a){switch(a.label){case 0:return r=this.getOrCreateFetchPromise().then(function(s){o.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(s))),o.sendCallback(t,s,"remote"),o.storage.setConfig(s)}),n=this.storage.fetchConfig().then(function(s){return s}),[4,Promise.race([r,n])];case 1:return i=a.sent(),i!==void 0&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(i))),i.remoteConfig!==null?this.sendCallback(t,i,"cache"):this.logger.debug("Remote config client skips sending c
4allback because cache is empty (first time user).")),[4,r];case 2:return a.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(t,r){return A(this,void 0,void 0,function(){var n,i,i;return w(this,function(o){switch(o.label){case 0:n=new Promise(function(a,s){setTimeout(function(){s("Timeout exceeded")},r)}),o.label=1;case 1:return o.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return i=o.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(t,i,"remote"),this.storage.setConfig(i),[3,5];case 3:return o.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 i=o.sent(),i.remoteConfig!==null?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(t,i,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(t,i,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(t,r,n){t.lastCallback=new Date;var i;t.key?i=t.key.split(".").reduce(function(o,a){return o===null?o:a in o?o[a]:null},r.remoteConfig):i=r.remoteConfig,t.callback(i,n,r.lastFetch)},e.prototype.fetch=function(t,r){return t===void 0&&(t=hs),r===void 0&&(r=ps),A(this,void 0,void 0,function(){var n,i,o,a,s,l,u=this;return w(this,function(c){switch(c.label){case 0:n=r/t,i={remoteConfig:null,lastFetch:new Date},o=function(d){var f,v,h,g,y,m,p,b,E,T,S;return w(this,function(k){switch(k.label){case 0:f=!0,v=new AbortController,h=setTimeout(function(){return v.abort()},r),k.label=1;case 1:return k.trys.push([1,10,11,12]),g=a.getUrlParams(),y={Accept:"*/*"},a.customFetch?[4,ds(a.customFetch({url:g,method:"GET",headers:y,signal:v.signal}),v.signal)]:[3,3];case 2:return p=k.sent(),[3,5];case 3:return[4,fetch(g,{method:"GET",headers:y,signal:v.signal})];case 4:p=k.sent(),k.label=5;case 5:return m=p,b=m.ok||m.status>=200&&m.status<300,b?[3,7]:[4,m.text()];case 6:return E=k.sent(),a.logger.debug("Remote config client fetch with retry time ".concat(t," failed with ").concat(m.status,": ").concat(E)),m.status===or.INVALID_API_KEY||m.status===or.FORBIDDEN?(a.logger.error("Remote config client fetch failed with ".concat(m.status,". Invalid API key; future fetches will be skipped.")),a.isLastFetchInvalidApiKey=!0,f=!1):m.status>=400&&m.status<500&&m.status!==or.RATE_LIMIT&&(f=!1),[3,9];case 7:return[4,m.json()];case 8:return T=k.sent(),[2,{value:{remoteConfig:T,lastFetch:new Date}}];case 9:return[3,12];case 10:return S=k.sent(),S instanceof Error&&S.name==="AbortError"?a.logger.debug("Remote config client fetch with retry time ".concat(t," timed out after ").concat(r,"ms")):a.logger.debug("Remote config client fetch with retry time ".concat(t," is rejected because: "),S),[3,12];case 11:return clearTimeout(h),[7];case 12:return f?d<t-1?[4,new Promise(function(O){return setTimeout(O,u.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:k.sent(),k.label=14;case 14:return[2]}})},a=this,s=0,c.label=1;case 1:return s<t?[5,o(s)]:[3,4];case 2:if(l=c.sent(),typeof l=="object")return[2,l.value];if(l==="break")return[3,4];c.label=3;case 3:return s++,[3,1];case 4:return[2,i]}})})},e.prototype.getJitterDelay=function(t){return Math.floor(Math.random()*t)},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})(),ar=F(),Xe=ar?.console,Be={},mt={},sr=!1;function bs(e){if(!Xe||typeof Xe[e]!="function")return!1;if(mt[e])return!0;var t=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{if(Be[e]&&!sr){sr=!0;var i=Be[e];i&&i.forEach(function(o){try{o(e,r)}catch{}})}}catch{}return sr=!1,mt[e].apply(Xe,r)};return mt[e]=Xe[e],Xe[e]=t,!0}function ys(e,t){var r=bs(e);if(!r)return new Error("Console override failed");Be[e]?Be[e].push(t):Be[e]=[t]}function Es(e){var t,r;try{for(var n=x(Object.values(Be)),i=n.next();!i.done;i=n.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}function Ts(){var e,t;try{for(var r=x(Object.entries(mt)),n=r.next();!n.done;n=r.next()){var i=D(n.value,2),o=i[0],a=i[1];a&&(Xe[o]=a)}}catch(s){e={error:s}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}mt={},Be={}}var An={addListener:ys,removeListener:Es,_restoreConsole:Ts},wr;(function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"})(wr||(wr={}));var Ui=null,Fi=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],qr="data-amp-track-",Vi=["div","span","h1","h2","h3","h4","h5","h6"],Hi=150,Ss=["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]'],Bi=H(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],D(Ss),!1),_s=Bi,ws=Bi,As=["*"],ks=1e3,Is=4,Ps=50;function Os(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null||e===void 0}function qi(e,t,r){if(e){var n=t.map(kn),i=r.map(kn);Gi({json:e,allowlist:n,excludelist:i,ancestors:[]})}}function Gi(e){var t,r,n=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,l=e.parentObject,u=e.targetKey;
4i||(i=n);var c=Object.keys(i);try{for(var d=x(c),f=d.next();!f.done;f=d.next()){var v=f.value,h=H(H([],D(s),!1),[v],!1);Os(i[v])?(!In(h,o)||In(h,a))&&delete i[v]:Gi({json:n,targetObject:i[v],allowlist:o,excludelist:a,ancestors:h,parentObject:i,targetKey:v})}}catch(g){t={error:g}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}Object.keys(i).length===0&&l&&u&&delete l[u]}function kn(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(t){return t.replace(/~0/g,"~").replace(/~1/g,"/")})}function Ar(e,t,r,n){if(r===void 0&&(r=0),n===void 0&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&t[n]==="**";)n++;return n===t.length}var i=t[n];if(i==="**"){if(n+1===t.length)return!0;for(var o=r;o<=e.length;o++)if(Ar(e,t,o,n+1))return!0;return!1}else return i==="*"||i===e[r]?Ar(e,t,r+1,n+1):!1}function In(e,t){return t.some(function(r){return Ar(e,r)})}var Cs=500,Wi=100,Rs=(function(){function e(t){this.request=t}return e.prototype.headers=function(t){var r,n;t===void 0&&(t=[]);var i=this.request.headers,o={};if(Array.isArray(i))i.forEach(function(d){var f=D(d,2),v=f[0],h=f[1];o[v]=h});else if(i instanceof Headers)i.forEach(function(d,f){o[f]=d});else if(typeof i=="object"&&i!==null)try{for(var a=x(Object.entries(i)),s=a.next();!s.done;s=a.next()){var l=D(s.value,2),u=l[0],c=l[1];o[u]=c}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Qt(o,{allow:t})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(typeof this._bodySize=="number")return this._bodySize;var t=F();if(t?.TextEncoder){var r=this.request.body;return this._bodySize=ji(r,Wi),this._bodySize}},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 typeof this.request.body=="string"?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),A(this,void 0,void 0,function(){var n;return w(this,function(i){return t.length===0?[2,null]:(n=this.body,[2,Gr(n,t,r)])})})},e})(),Ds=(function(){function e(t,r){this.bodyRaw=t,this.requestHeaders=r}return e.prototype.headers=function(t){return t===void 0&&(t=[]),Qt(this.requestHeaders,{allow:t})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return ji(this.bodyRaw,Wi)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return typeof this.bodyRaw=="string"?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),A(this,void 0,void 0,function(){var n;return w(this,function(i){return t.length===0?[2,null]:(n=this.body,[2,Gr(n,t,r)])})})},e})();function ji(e,t){var r,n,i,o=F(),a=o?.TextEncoder;if(a&&e!=null){var s;if(typeof e=="string")s=e,i=new a().encode(s).length;else if(typeof Blob<"u"&&e instanceof Blob)s=e,i=s.size;else if(typeof URLSearchParams<"u"&&e instanceof URLSearchParams)s=e,i=new a().encode(s.toString()).length;else if(ArrayBuffer.isView(e))s=e,i=s.byteLength;else if(e instanceof ArrayBuffer)s=e,i=s.byteLength;else if(typeof FormData<"u"&&e instanceof FormData){var l=e,u=0,c=0;try{for(var d=x(l.entries()),f=d.next();!f.done;f=d.next()){var v=D(f.value,2),h=v[0],g=v[1];if(u+=h.length,typeof g=="string")u+=new a().encode(g).length;else if(typeof Blob<"u"&&g instanceof Blob)u+=g.size;else return;if(++c>=t)return}}catch(y){r={error:y}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}i=u}else if(typeof ReadableStream<"u"&&e instanceof ReadableStream){s=e;return}return i}}var xs=(function(){function e(t){this.response=t}return e.prototype.headers=function(t){var r;if(t===void 0&&(t=[]),this.response.headers instanceof Headers){var n=this.response.headers,i={};return(r=n?.forEach)===null||r===void 0||r.call(n,function(o,a){i[a]=o}),Qt(i,{allow:t})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var t,r;if(this._bodySize!==void 0)return this._bodySize;var n=(r=(t=this.response.headers)===null||t===void 0?void 0:t.get)===null||r===void 0?void 0:r.call(t,"content-length"),i=n?parseInt(n,10):void 0;return this._bodySize=i,i}
4,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return A(this,void 0,void 0,function(){var t,r,n;return w(this,function(i){switch(i.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),i.label=1;case 1:return i.trys.push([1,3,,4]),t=this.clonedResponse.text(),r=new Promise(function(o){return setTimeout(function(){return o(null)},Cs)}),[4,Promise.race([t,r])];case 2:return n=i.sent(),[2,n];case 3:return i.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),A(this,void 0,void 0,function(){var n;return w(this,function(i){switch(i.label){case 0:return t.length===0?[2,null]:[4,this.text()];case 1:return n=i.sent(),[2,Gr(n,t,r)]}})})},e})(),Ls=(function(){function e(t,r,n,i){this.statusCode=t,this.headersString=r,this.size=n,this.getJson=i}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(t){var r,n;if(t===void 0&&(t=[]),!this.headersString)return{};var i={},o=this.headersString.split(`\r
5`);try{for(var a=x(o),s=a.next();!s.done;s=a.next()){var l=s.value,u=D(l.split(": "),2),c=u[0],d=u[1];c&&d&&(i[c]=d)}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return Qt(i,{allow:t})},e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),A(this,void 0,void 0,function(){var n;return w(this,function(i){return t.length===0?[2,null]:(n=this.getJson(),n?(qi(n,t,r),[2,n]):[2,null])})})},e})();function Gr(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return qi(n,t,r),n}catch{return null}}var bt;(function(e){e.REDACT="redact",e.REMOVE="remove"})(bt||(bt={}));var Pn="[REDACTED]",Qt=function(e,t){var r,n,i=t.allow,o=i===void 0?[]:i,a=t.strategy,s=a===void 0?bt.REMOVE:a,l=H([],D(ua),!1),u={},c=function(h){var g=h.toLowerCase();l.find(function(y){return y.toLowerCase()===g})?s===bt.REDACT&&(u[h]=Pn):o.find(function(y){return y.toLowerCase()===g})?u[h]=e[h]:s===bt.REDACT&&(u[h]=Pn)};try{for(var d=x(Object.keys(e)),f=d.next();!f.done;f=d.next()){var v=f.value;c(v)}}catch(h){r={error:h}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return u},Ns=(function(){function e(t,r,n,i,o,a,s,l,u,c,d){s===void 0&&(s=0),this.type=t,this.method=r,this.timestamp=n,this.startTime=i,this.url=o,this.requestWrapper=a,this.status=s,this.duration=l,this.responseWrapper=u,this.error=c,this.endTime=d}return e.prototype.toSerializable=function(){var t,r,n,i,o={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:(t=this.requestWrapper)===null||t===void 0?void 0:t.headers(H([],D(qt),!1)),requestBodySize:(r=this.requestWrapper)===null||r===void 0?void 0:r.bodySize,responseHeaders:(n=this.responseWrapper)===null||n===void 0?void 0:n.headers(H([],D(qt),!1)),responseBodySize:(i=this.responseWrapper)===null||i===void 0?void 0:i.bodySize};return Object.fromEntries(Object.entries(o).filter(function(a){var s=D(a,2);s[0];var l=s[1];return l!==void 0}))},e})();function Ms(e){return typeof e=="object"&&e!==null&&"url"in e&&"method"in e}var Us=(function(){function e(t,r){r===void 0&&(r=Se()),this.callback=t,this.id=r}return e})();function Ue(e){try{e()}catch{}}var Fs=(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=F();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var t=F();return!!t&&!!t.fetch},e.prototype.subscribe=function(t,r){var n,i,o,a,s,l,u,c,d,f;if(this.logger||(this.logger=r),this.eventCallbacks.set(t.id,t),!this.isObserving){var v=(o=(i=(n=this.globalScope)===null||n===void 0?void 0:n.XMLHttpRequest)===null||i===void 0?void 0:i.prototype)===null||o===void 0?void 0:o.open,h=(l=(s=(a=this.globalScope)===null||a===void 0?void 0:a.XMLHttpRequest)===null||s===void 0?void 0:s.prototype)===null||l===void 0?void 0:l.send,g=(d=(c=(u=this.globalScope)===null||u===void 0?void 0:u.XMLHttpRequest)===null||c===void 0?void 0:c.prototype)===null||d===void 0?void 0:d.setRequestHeader;v&&h&&g&&this.observeXhr(v,h,g);var y=(f=this.globalScope)===null||f===void 0?void 0:f.fetch;y&&this.observeFetch(y),this.isObserving=!0}},e.prototype.unsubscribe=function(t){this.eventCallbacks.delete(t.id)},e.prototype.triggerEventCallbacks=function(t){var r=this;this.eventCallbacks.forEach(function(n){try{n.callback(t)}catch(i){Ue(function(){var o;(o=r.logger)===null||o===void 0||o.debug("an unexpected error occurred while triggering event callbacks",i)})}})},e.prototype.handleNetworkRequestEvent=function(t,r,n,i,o,a,s){var l;if(!(a===void 0||s===void 0)){var u,c="GET";if(Ms(r)?(u=r.url,c=r.method):u=(l=r?.toString)===null||l===void 0?void 0:l.call(r),u)try{var d=new URL(u);u="".concat(d.protocol,"//").concat(d.host).concat(d.pathname).concat(d.search).concat(d.hash)}catch{}c=n?.method||c;var f,v;i&&(f=i.status),o&&(v={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},f=0);var h=Math.floor(performance.now()-s),g=Math.floor(a+h),y=new Ns(t,c,a,a,u,n,f,h,i,v,g);this.triggerEventCallbacks(y)}},e.prototype.getTimestamps=function(){var t,r;return{startTime:(t=Date.now)===null||t===void 0?void 0:t.call(Date),durationStart:(r=performance?.now)===null||r===void 0?void 0:r.call(performance)}},e.prototype.observeFetch=function(t){var r=this;!this.globalScope||!t||(this.globalScope.fetch=function(n,i){return A(r,void 0,void 0,function(){var o,a,s,l,u=this;return w(this,function(c){switch(c.label){case 0:try{o=this.getTimestamps()}catch(d){Ue(function(){var f;return(f=u.logger)===null||f===void 0?void 0:f.debug("an unexpected error occurred while retrieving timestamps",d)})}c.label=1;case 1:return c.trys.push([1,3,,4]),[4,t(n,i)];case 2:return a=c.sent(),[3,4];case 3:return l=c.sent(),s=l,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,i?new Rs(i):void 0,a?new xs(a):void 0,s,o?.startTime,o?.durationStart)}catch(d){Ue(function(){var f;return(f=u.logger)===null||f===void 0?void 0:f.debug("an unexpected error occurred while handling fetch",d)})}if(a)return[2,a];throw s}})})})},e.createXhrJsonParser=function(t,r){return function(){var n;try{if(t.responseType==="json"){if(!((n=r.globalScope)===null||n===void 0)&&n.structuredClone)return r.globalScope.structuredClone(t.response)}else if(["text",""].includes(t.responseType))return JSON.parse(t.responseText)}catch(i){return i instanceof Error&&i.name==="InvalidStateError"&&Ue(function(){var o;return(o=r.logger)===null||o===void 0?void 0:o.debug("unexpected error when retrieving responseText. responseType='".concat(t.responseType,"'"))}),null}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 a,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];var u=this,c=D(s,2),d=c[0],f=c[1];try{u.$$AmplitudeAnalyticsEvent=_({method:d,url:(a=f?.toString)===null||a===void 0?void 0:a.call(f),headers:{}},o.getTimestamps())}catch(v){Ue(function(){var h;
5return(h=o.logger)===null||h===void 0?void 0:h.debug("an unexpected error occurred while calling xhr open",v)})}return t.apply(u,s)},i.send=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var l=this,u=l,c=e.createXhrJsonParser(l,o),d=a[0],f=u.$$AmplitudeAnalyticsEvent;return u.$$AmplitudeAnalyticsEvent&&u.addEventListener("loadend",function(){try{var v=u.getAllResponseHeaders(),h=u.getResponseHeader("content-length"),g=new Ls(u.status,v,h?parseInt(h,10):void 0,c),y=u.$$AmplitudeAnalyticsEvent.headers,m=new Ds(d,y);f.status=u.status,o.handleNetworkRequestEvent("xhr",{url:f.url,method:f.method},m,g,void 0,f.startTime,f.durationStart)}catch(p){Ue(function(){var b;return(b=o.logger)===null||b===void 0?void 0:b.debug("an unexpected error occurred while handling xhr send",p)})}}),r.apply(u,a)},i.setRequestHeader=function(a,s){var l=this;try{var u=l.$$AmplitudeAnalyticsEvent;u&&(u.headers[a]=s)}catch(c){Ue(function(){var d;return(d=o.logger)===null||d===void 0?void 0:d.debug("an unexpected error occurred while calling xhr setRequestHeader",c)})}n.apply(l,[a,s])}}},e})(),On=new Fs,Vs=function(e,t){return e?.map(function(r){var n,i;if(!((n=r.urls)===null||n===void 0)&&n.length&&(!((i=r.hosts)===null||i===void 0)&&i.length)){var o=JSON.stringify(r.hosts),a=JSON.stringify(r.urls);return t?.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),_(_({},r),{hosts:void 0})}return r})},Wr=(function(){function e(){}return e.prototype.parse=function(){return A(this,void 0,void 0,function(){return w(this,function(t){return[2,_(_(_(_({},Yt),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var t=Gt(),r=t[ra],n=t[na],i=t[ia],o=t[oa],a=t[aa],s=t[sa];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:s}},e.prototype.getReferrer=function(){var t,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},e.prototype.getClickIds=function(){var t,r=Gt();return t={},t[an]=r[an],t[sn]=r[sn],t[un]=r[un],t[ln]=r[ln],t[cn]=r[cn],t[dn]=r[dn],t[fn]=r[fn],t[vn]=r[vn],t[hn]=r[hn],t[pn]=r[pn],t[gn]=r[gn],t},e})(),Le="data-amp-mask",xe="*****",Hs=/\b(?:\d[ -]*?){13,16}\b/,Bs=/(\d{3}-?\d{2}-?\d{4})/g,qs=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,jr=function(e,t){var r,n;if(t===void 0&&(t=[]),typeof e!="string")return"";var i=e;i=i.replace(Hs,xe),i=i.replace(Bs,xe),i=i.replace(qs,xe);try{for(var o=x(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,xe)}catch{}}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},Kr=function(e){if(typeof document>"u"||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Le)?xe:e?e(document.title):document.title},ut={},Cn;function Gs(){if(Cn)return ut;Cn=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.Observable=void 0;const e=m=>!!Symbol[m],t=m=>e(m)?Symbol[m]:"@@"+m,r=t("iterator"),n=t("observable"),i=t("species");function o(m,p){let b=m[p];if(b!=null){if(typeof b!="function")throw new TypeError(b+" is not a function");return b}}function a(m){let p=m.constructor;return p!==void 0&&(p=p[i],p===null&&(p=void 0)),p!==void 0?p:y}function s(m){return m instanceof y}function l(m){l.log?l.log(m):setTimeout(()=>{throw m})}function u(m){Promise.resolve().then(()=>{try{m()}catch(p){l(p)}})}function c(m){let p=m._cleanup;if(p!==void 0&&(m._cleanup=void 0,!!p))try{if(typeof p=="function")p();else{let b=o(p,"unsubscribe");b&&b.call(p)}}catch(b){l(b)}}function d(m){m._observer=void 0,m._queue=void 0,m._state="closed"}function f(m){let p=m._queue;if(p){m._queue=void 0,m._state="ready";for(let b=0;b<p.length&&(v(m,p[b].type,p[b].value),m._state!=="closed");++b);}}function v(m,p,b){m._state="running";let E=m._observer;try{let T=o(E,p);switch(p){case"next":T&&T.call(E,b);break;case"error":if(d(m),T)T.call(E,b);else throw b;break;case"complete":d(m),T&&T.call(E);break}}catch(T){l(T)}m._state==="closed"?c(m):m._state==="running"&&(m._state="ready")}function h(m,p,b){if(m._state!=="closed"){if(m._state==="buffering"){m._queue.push({type:p,value:b});return}if(m._state!=="ready"){m._state="buffering",m._queue=[{type:p,value:b}],u(()=>f(m));return}v(m,p,b)}}class g{constructor(p,b){this._cleanup=void 0,this._observer=p,this._queue=void 0,this._state="initializing";let E=this,T={get closed(){return E._state==="closed"},next(S){h(E,"next",S)},error(S){h(E,"error",S)},complete(){h(E,"complete")}};try{this._cleanup=b.call(void 0,T)}catch(S){T.error(S)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}
5unsubscribe(){this._state!=="closed"&&(d(this),c(this))}}class y{constructor(p){if(!(this instanceof y))throw new TypeError("Observable cannot be called as a function");if(typeof p!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=p}subscribe(p){return(typeof p!="object"||p===null)&&(p={next:p,error:arguments[1],complete:arguments[2]}),new g(p,this._subscriber)}forEach(p){return new Promise((b,E)=>{if(typeof p!="function"){E(new TypeError(p+" is not a function"));return}function T(){S.unsubscribe(),b()}let S=this.subscribe({next(k){try{p(k,T)}catch(O){E(O),S.unsubscribe()}},error:E,complete:b})})}map(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let b=a(this);return new b(E=>this.subscribe({next(T){try{T=p(T)}catch(S){return E.error(S)}E.next(T)},error(T){E.error(T)},complete(){E.complete()}}))}filter(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let b=a(this);return new b(E=>this.subscribe({next(T){try{if(!p(T))return}catch(S){return E.error(S)}E.next(T)},error(T){E.error(T)},complete(){E.complete()}}))}reduce(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let b=a(this),E=arguments.length>1,T=!1,k=arguments[1];return new b(O=>this.subscribe({next(C){let M=!T;if(T=!0,!M||E)try{k=p(k,C)}catch(I){return O.error(I)}else k=C},error(C){O.error(C)},complete(){if(!T&&!E)return O.error(new TypeError("Cannot reduce an empty sequence"));O.next(k),O.complete()}}))}async all(){let p=[];return await this.forEach(b=>p.push(b)),p}concat(...p){let b=a(this);return new b(E=>{let T,S=0;function k(O){T=O.subscribe({next(C){E.next(C)},error(C){E.error(C)},complete(){S===p.length?(T=void 0,E.complete()):k(b.from(p[S++]))}})}return k(this),()=>{T&&(T.unsubscribe(),T=void 0)}})}flatMap(p){if(typeof p!="function")throw new TypeError(p+" is not a function");let b=a(this);return new b(E=>{let T=[],S=this.subscribe({next(O){if(p)try{O=p(O)}catch(M){return E.error(M)}let C=b.from(O).subscribe({next(M){E.next(M)},error(M){E.error(M)},complete(){let M=T.indexOf(C);M>=0&&T.splice(M,1),k()}});T.push(C)},error(O){E.error(O)},complete(){k()}});function k(){S.closed&&T.length===0&&E.complete()}return()=>{T.forEach(O=>O.unsubscribe()),S.unsubscribe()}})}[n](){return this}static from(p){let b=typeof this=="function"?this:y;if(p==null)throw new TypeError(p+" is not an object");let E=o(p,n);if(E){let T=E.call(p);if(Object(T)!==T)throw new TypeError(T+" is not an object");return s(T)&&T.constructor===b?T:new b(S=>T.subscribe(S))}if(e("iterator")&&(E=o(p,r),E))return new b(T=>{u(()=>{if(!T.closed){for(let S of E.call(p))if(T.next(S),T.closed)return;T.complete()}})});if(Array.isArray(p))return new b(T=>{u(()=>{if(!T.closed){for(let S=0;S<p.length;++S)if(T.next(p[S]),T.closed)return;T.complete()}})});throw new TypeError(p+" is not observable")}static of(...p){let b=typeof this=="function"?this:y;return new b(E=>{u(()=>{if(!E.closed){for(let T=0;T<p.length;++T)if(E.next(p[T]),E.closed)return;E.complete()}})})}static get[i](){return this}}return ut.Observable=y,Object.defineProperty(y,Symbol("extensions"),{value:{symbol:n,hostReportError:l},configurable:!0}),ut}var ur,Rn;function Ws(){return Rn||(Rn=1,ur=Gs().Observable),ur}var js=Ws();const ne=Si(js);function zr(e,t){return new ne(function(r){e.subscribe({next:function(n){t(n).then(function(i){return r.next(i)}).catch(function(i){return r.error(i)})},error:function(n){r.error(n)},complete:function(){r.complete()}})})}function qe(e,t){return new ne(function(r){var n=!1,i=new Set,o=function(){var s,l;n=!0;try{for(var u=x(i),c=u.next();!c.done;c=u.next()){var d=c.value;try{d.unsubscribe()}catch{}}}catch(f){s={error:f}}finally{try{c&&!c.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}i.clear()},a=function(s){var l=s.subscribe({next:function(u){n||r.next(u)},error:function(u){n||(n=!0,r.error(u),o())},complete:function(){i.delete(l),!n&&i.size===0&&(r.complete(),o(),n=!0)}});i.add(l)};return a(e),a(t),o})}function Ie(e){var t=new Set,r=null;function n(){r?.unsubscribe(),r=null,t.clear()}return new ne(function(i){return t.add(i),r===null&&(r=e.subscribe({next:function(o){var a,s,l;try{for(var u=x(t),c=u.next();!c.done;c=u.next()){var d=c.value;(l=d.next)===null||l===void 0||l.call(d,o)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}},error:function(o){var a,s,l;try{for(var u=x(t),c=u.next();!c.done;c=u.next()){var d=c.value;(l=d.error)===null||l===void 0||l.call(d,o)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}n()},complete:function(){var o,a,s;try{for(var l=x(t),u=l.next();!u.done;u=l.next()){var c=u.value;(s=c.complete)===null||s===void 0||s.call(c)}}catch(d){o={error:d}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}n()}})),function(){t.delete(i),t.size===0&&r&&(r.unsubscribe(),r=null)}})}var Pt={exports:{}},Dn;function Ks(){if(Dn)return Pt.exports;Dn=1;var e=Object.prototype.hasOwnProperty;function t(i){return"[Throws: "+(i?i.message:"?")+"]"}function r(i,o){if(e.call(i,o))try{return i[o]}catch(a){return t(a)}return i[o]}function n(i){var o=[];function a(s){if(s===null||typeof s!="object")return s;if(o.indexOf(s)!==-1)return"[Circular]";if(o.push(s),typeof s.toJSON=="function")try{var l=a(s.toJSON());return o.pop(),l}catch(d){return t(d)}if(Array.isArray(s)){var u=s.map(a);return o.pop(),u}var c=Object.keys(s).reduce(function(d,f){return d[f]=a(r(s,f)),d},{});return o.pop(),c}return a(i)}return Pt.exports=function(i,o,a){return JSON.stringify(n(i),o,a)},Pt.exports.ensureProperties=n,Pt.exports}var Ki=Ks();const zi=Si(Ki),zs=ea({__proto__:null,default:zi},[Ki]);var kr=zi||zs,Ir="https://app.amplitude.com",Xs="https://app.eu.amplitude.com",$s="https://apps.stag2.amplitude.com",Ys={US:Ir,EU:Xs,STAGING:$s},Js="https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",Qs=function(e){var t=document.querySelector('script[src="'.concat(CSS.escape(e),'"]'));return t?Promise.resolve({status:!0}):new Promise(function(r,n){var i;try{var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=e,o.addEventListener("load",function(){r({status:!0})},{once:!0}),o.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),(i=document.head)===null||i===void 0||i.appendChild(o)}catch(a){n(a)}})};function Zs(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var Xi,Pr="__AMPLITUDE_MESSENGER_INSTANCE__",jt="__AMPLITUDE_MESSENGER__",eu=(function(){function e(t){var r=t===void 0?{}:t,n=r.origin,i=n===void 0?Ir:n;this[Xi]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=i}return e.prototype.notify=function(t){var r,n,i,o;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0||n.call(r,"Message sent: ",JSON.stringify(t)),(o=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||o===void 0||o.call(i,t,this.endpoint)},e.prototype.sendRequest=function(t,r,n){var i=this;n===void 0&&(n={timeout:15e3});var o=Zs(),a={id:o,action:t,args:r},s=new Promise(function(l,u){i.requestCallbacks[o]={resolve:l,reject:u},i.notify(a),n.timeout>0&&setTimeout(function(){u(new Error("".concat(t," timed out (id: ").concat(o,")"))),delete i.requestCallbacks[o]},n.timeout)});return s},e.prototype.handleResponse=function(t){var r;if(!this.requestCallbacks[t.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(t.id));return}this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]},e.prototype.registerActionHandler=function(t,r){var n,i,o,a;this.actionHandlers.has(t)&&((a=(o=this.logger)===null||o===void 0?void 0:o.warn)===null||a===void 0||a.call(o,"Overwriting existing action handler for: ".concat(t))),this.actionHandlers.set(t,r);var s=this.pendingMessages.get(t);if(s){this.pendingMessages.delete(t);try{for(var l=x(s),u=l.next();!u.done;u=l.next()){var c=u.value;r(c)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(t){return A(this,void 0,void 0,function(){var r,n,i;return w(this,function(o){switch(o.label){case 0:if(r=this.scriptLoadPromises.get(t),r)return[2,r];n=Qs(t).then(function(){}),this.scriptLoadPromises.set(t,n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this.scriptLoadPromises.delete(t),i;case 4:return[2]}})})},e.prototype.setup=function(t){var r=this,n,i,o=t===void 0?{}:t,a=o.logger,s=o.endpoint;a&&(this.logger=a),s&&this.endpoint===Ir&&(this.endpoint=s),!this.isSetup&&(this.isSetup=!0,(i=(n=this.logger)===null||n===void 0?void 0:n.debug)===null||i===void 0||i.call(n,"Setting up messenger"),this.messageHandler=function(l){var u,c,d,f,v;if((c=(u=r.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.c
5all(u,"Message received: ",JSON.stringify(l)),r.endpoint===l.origin){var h=l.data,g=h?.action;if(g)if("id"in h&&h.id)(f=(d=r.logger)===null||d===void 0?void 0:d.debug)===null||f===void 0||f.call(d,"Received Response to previous request: ",JSON.stringify(l)),r.handleResponse(h);else{if(g==="ping"){r.notify({action:"pong"});return}var y=r.actionHandlers.get(g);if(y)y(h.data);else{var m=(v=r.pendingMessages.get(g))!==null&&v!==void 0?v:[];m.push(h.data),r.pendingMessages.set(g,m)}}}},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 t=F();t?.[jt]===this&&delete t[jt]},e})();Xi=Pr;function tu(e){return typeof e=="object"&&e!==null&&Pr in e&&e[Pr]===!0}function ru(e){var t=F(),r=t?.[jt];if(tu(r))return r;var n=new eu(e);return t&&(t[jt]=n),n}var xn="__AMPLITUDE_BACKGROUND_CAPTURE__";function nu(e,t){var r,n=e;
5if(n[xn]!==!0){n[xn]=!0;var i=(r=void 0)!==null&&r!==void 0?r:Js,o=null,a=function(s,l){var u,c;s==="background-capture-complete"&&((c=(u=e.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.call(u,"Background capture complete"),e.notify({action:"background-capture-complete",data:l}))};e.registerActionHandler("initialize-background-capture",function(){var s,l;(l=(s=e.logger)===null||s===void 0?void 0:s.debug)===null||l===void 0||l.call(s,"Initializing background capture (external script)");var u=new URL(i,e.endpoint).toString();e.loadScriptOnce(u).then(function(){var c,d,f;(d=(c=e.logger)===null||c===void 0?void 0:c.debug)===null||d===void 0||d.call(c,"Background capture script loaded (external)"),o=(f=window?.amplitudeBackgroundCapture)===null||f===void 0?void 0:f.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:"background-capture-loaded"})}).catch(function(){var c;(c=e.logger)===null||c===void 0||c.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var s;(s=o?.close)===null||s===void 0||s.call(o),o=null})}}var Ft={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function $i(e,t){var r=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var n=e/t*100;r=Math.min(100,Math.max(0,n))}return r}function lt(e,t){var r=e.currentTime,n=e.duration;return _({duration:n,start_time:r,last_position:r,percent_completed:$i(r,n)},t!==void 0?{stop_reason:t}:{})}function ct(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function iu(e,t,r){var n=function(){var u=_(_({},lt(e)),r==="mux"?ct(e):{});t.onPlay(u)};e.addEventListener("play",n);var i=function(){var u=_(_({},lt(e,"paused")),r==="mux"?ct(e):{});t.onPause(u)};e.addEventListener("pause",i);var o=function(){var u=_(_({},lt(e,"ended")),r==="mux"?ct(e):{});t.onEnded(u)};e.addEventListener("ended",o);var a=function(){var u=_(_({},lt(e,"seeking")),r==="mux"?ct(e):{});t.onSeeking(u)};e.addEventListener("seeking",a);var s=function(){var u=_(_({},lt(e)),r==="mux"?ct(e):{});t.onSeeked(u)};e.addEventListener("seeked",s);var l=function(){var u=e,c={position:e.currentTime,isSeeking:!!u.seeking};t.onTimeUpdate(c)};return e.addEventListener("timeupdate",l),function(){e.removeEventListener("play",n),e.removeEventListener("pause",i),e.removeEventListener("ended",o),e.removeEventListener("seeking",a),e.removeEventListener("seeked",s),e.removeEventListener("timeupdate",l)}}function ou(e){return A(this,void 0,void 0,function(){var t;return w(this,function(r){switch(r.label){case 0:return[4,new Promise(function(n){return e.getCurrentTime(n)})];case 1:return t=r.sent(),[2,{currentTime:t}]}})})}function dt(e,t,r,n){return A(this,void 0,void 0,function(){var i,o,a,s,l;return w(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(c){return e.getDuration(c)}),new Promise(function(c){return e.getCurrentTime(c)})])];case 1:if(i=D.apply(void 0,[u.sent(),2]),o=i[0],a=i[1],s={},r==="mux"){l=void 0;try{l=new URL(t.getAttribute("src")),s.mux_video_title=l.searchParams.get("metadata-video-title"),s.mux_video_id=l.searchParams.get("metadata-video-id"),s.mux_playback_id=l.pathname.split("/").pop()}catch{}}return[2,_(_({duration:o,start_time:a,last_position:a,percent_completed:$i(a,o)},n!==void 0?{stop_reason:n}:{}),s)]}})})}function au(e,t,r){r===void 0&&(r=null);var n=[],i=function(){var o=e.elem,a=!1,s=function(){dt(e,o,r).then(function(v){t.onPlay(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'play' handler: ".concat(v))})};e.on("play",s),n.push(function(){return e.off("play",s)});var l=function(){dt(e,o,r,"paused").then(function(v){t.onPause(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(v))})};e.on("pause",l),n.push(function(){return e.off("pause",l)});var u=function(){dt(e,o,r,"ended").then(function(v){t.onEnded(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(v))})};e.on("ended",u),n.push(function(){return e.off("ended",u)});var c=function(){a=!0,dt(e,o,r,"seeking").then(function(v){t.onSeeking(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(v))})};e.on("seeking",c),n.push(function(){return e.off("seeking",c)});var d=function(){a=!1,dt(e,o,r).then(function(v){t.onSeeked(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(v))})};e.on("seeked",d),n.push(function(){return e.off("seeked",d)});var f=function(){ou(e).then(function(v){var h=v.currentTime,g={position:h,isSeeking:a};t.onTimeUpdate(g)}).catch(function(v){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(v))})};e.on("timeupdate",f),n.push(function(){return e.off("timeupdate",f)})};
5return e.on("ready",i),function(){e.off("ready",i),n.forEach(function(o){return o()})}}var su=(function(){function e(t){var r=t.videoEl,n=t.onStateChange,i=t.vendor,o=t.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(s){a.updatePlaybackState("playing",s)},onPause:function(s){a.updatePlaybackState("paused",s)},onEnded:function(s){a.updatePlaybackState("ended",s)},onSeeking:function(){var s=_(_({},a.state),{isSeeking:!0});a.updateState(s)},onSeeked:function(s){var l=_(_({},a.state),{isSeeking:!1,position:s.last_position});a.updateState(l)},onError:function(s){a.updateStateWithError(s)},onTimeUpdate:function(s){a.updateTime(s)}},this.onStateChange=n,o?this.untrack=au(r,this.handler,i):this.untrack=iu(r,this.handler,i)}return e.prototype.stateChangeHandler=function(t,r){try{this.onStateChange(t,r)}catch{}},e.prototype.updateStateWithError=function(t){var r=this.state,n=_(_({},r),{playbackState:"error",errorMessage:t});this.updateState(n)},e.prototype.updatePlaybackState=function(t,r){var n=_(_({},this.state),{playbackState:t,lastEvent:r,position:r.last_position});this.updateState(n)},e.prototype.updateTime=function(t){var r,n,i=this.state.lastEvent;if(!(!i||this.state.playbackState!=="playing")){var o=t.isSeeking||this.state.isSeeking,a=(r=this.state.position)!==null&&r!==void 0?r:0,s=t.position;if(o){this.state=_(_({},this.state),{position:s});return}var l=s-a,u=_(_({},this.state),{position:s,watchTime:((n=this.state.watchTime)!==null&&n!==void 0?n:0)+l});this.updateState(u)}},e.prototype.updateState=function(t){var r=this.state;this.state=t,this.stateChangeHandler(r,t)},e.prototype.destroy=function(){this.untrack()},e})();function uu(){var e,t,r=F();return typeof((t=(e=r?.chrome)===null||e===void 0?void 0:e.runtime)===null||t===void 0?void 0:t.id)=="string"}function lu(){var e,t=F();return((e=t?.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}function Yi(e,t,r){var n,i,o=[];try{for(var a=x(t??[]),s=a.next();!s.done;s=a.next()){var l=s.value;try{o.push(new RegExp(l))}catch(u){r.warn("Invalid regex pattern: ".concat(l),u)}}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return e.concat(o)}function cu(e,t){var r,n,i,o,a;if(!(typeof e!="object"||e===null||!(!((i=e.captureRules)===null||i===void 0)&&i.length))){var s=_({},e),l=(o=s.captureRules)!==null&&o!==void 0?o:[];try{for(var u=x(l),c=u.next();!c.done;c=u.next()){var d=c.value;d.urls=Yi((a=d.urls)!==null&&a!==void 0?a:[],d.urlsRegex,t),delete d.urlsRegex}}catch(f){r={error:f}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return s}}function Ji(e){var t,r,n,i,o,a,s,l,u,c,d,f;if(!(typeof e!="object"||e===null)&&!Array.isArray(e)){var v=Object.keys(e);try{for(var h=x(v),g=h.next();!g.done;g=h.next()){var y=g.value;try{var m=e[y];typeof m?.enabled=="boolean"&&(m.enabled?(delete m.enabled,Object.keys(m).length===0&&(e[y]=!0)):e[y]=!1),Ji(m)}catch{}}}catch(L){t={error:L}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}try{if(!((u=(l=(s=e.autocapture)===null||s===void 0?void 0:s.networkTracking)===null||l===void 0?void 0:l.captureRules)===null||u===void 0)&&u.length)try{for(var p=x(e.autocapture.networkTracking.captureRules),b=p.next();!b.done;b=p.next()){var E=b.value;try{for(var T=(o=void 0,x(["responseHeaders","requestHeaders"])),S=T.next();!S.done;S=T.next()){var k=S.value,O=(c=E[k])!==null&&c!==void 0?c:{},C=O.captureSafeHeaders,M=O.allowlist;if(!(!C&&!M)){if(M!==void 0&&!Array.isArray(M)){delete E[k];continue}E[k]=H(H([],D(C?qt:[]),!1),D(M??[]),!1)}}}catch(L){o={error:L}}finally{try{S&&!S.done&&(a=T.return)&&a.call(T)}finally{if(o)throw o.error}}}}catch(L){n={error:L}}finally{try{b&&!b.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}catch{}var I=(d=e.autocapture)===null||d===void 0?void 0:d.frustrationInteractions;I&&(I.rageClick&&(I.rageClicks=I.rageClick,delete I.rageClick),I.deadClick&&(I.deadClicks=I.deadClick,delete I.deadClick));try{var N=(f=e.autocapture)===null||f===void 0?void 0:f.elementInteractions;if(N&&typeof N=="object"&&(N.viewportContentUpdated===!0&&(N.viewportContentUpdated={}),N.viewportContentUpdated===!1&&(N.viewportContentUpdated={enabled:!1}),N.exposureDuration!==void 0)){var R=N.viewportContentUpdated;R===void 0?N.viewportContentUpdated={exposureDuration:N.exposureDuration}:typeof R=="object"&&R.exposureDuration===void 0&&R.enabled!==!1&&(R.exposureDuration=N.exposureDuration),delete N.exposureDuration}}catch{}}}var Ze=function(e,t){return typeof e=="boolean"?e:e?.[t]===!1?!1:uu()?!!e?.[t]:!0},Or=function(e){return Ze(e,"attribution")},du=function(e){return Ze(e,"fileDownloads")},Qi=function(e){return Ze(e,"formInteractions")},Zi=function(e){return Ze(e,"pageViews")},Ln=function(e){return Ze(e,"sessions")},fu=function(e){return Ze(e,"pageUrlEnrichment")},eo=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.networkTracking===!0||typeof e.networkTracking=="object")},to=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.elementInteractions===!0||typeof e.elementInteractions=="object")},vu=function(e){return typeof e=="boolean"?e:typeof e=="object"&&e.webVitals===!0},ro=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.frustrationInteractions===!0||typeof e.frustrationInteractions=="object")},hu=function(e){return typeof e=="object"&&(e.performanceTracking===!0||typeof e.performanceTracking=="object")},pu=function(e){if(typeof e.autocapture=="object"){var t=e.autocapture.performanceTracking;if(t===!0)return{mainThreadBlock:!0};if(typeof t=="object"&&t!==null)return t}},gu=function(e){return typeof e=="boolean"?e:typeof e=="object"&&e!==null&&e.enabled!==!1},mu=function(e){if(to(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.elementInteractions=="object")return e.autocapture.elementInteractions},bu=function(e){if(ro(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.frustrationInteractions=="object")return e.autocapture.frustrationInteractions},yu=function(e){if(eo(e.autocapture)){var t=void 0;
5return typeof e.autocapture=="object"&&typeof e.autocapture.networkTracking=="object"?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),_(_({},t),{captureRules:Vs(t?.captureRules,e.loggerProvider)})}},Nn=function(e){var t=function(){return!1},r=void 0,n,i=e.pageCounter,o=Zi(e.defaultTracking);return o&&(t=void 0,n=void 0,e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews=="object"&&("trackOn"in e.defaultTracking.pageViews&&(t=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(n=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:r,eventType:n,pageCounter:i}},Eu=function(e){return Or(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution=="object"?_({},e.defaultTracking.attribution):{}},Tu=function(e){if(Qi(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&typeof e.defaultTracking.formInteractions=="object")return e.defaultTracking.formInteractions},wf=function(e,t){Vt(e,t)},Vt=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,a=n.resolve,s=e&&e[i];if(typeof s=="function"){var l=s.apply(e,o);typeof a=="function"&&a(l?.promise)}}return e},lr=function(e){var t=e;return t&&t._q!==void 0},Su=function(e){var t,r;return typeof((r=(t=e.chrome)===null||t===void 0?void 0:t.runtime)===null||r===void 0?void 0:r.id)=="string"},_u=function(e){var t=e.ServiceWorkerGlobalScope;return typeof t=="function"&&e instanceof t},wu=function(e){var t=e.WorkerGlobalScope;return typeof t=="function"&&e instanceof t},Au=function(e){return typeof e.document<"u"},ku=function(e){var t,r;return typeof((r=(t=e.process)===null||t===void 0?void 0:t.versions)===null||r===void 0?void 0:r.node)=="string"};function Iu(){var e=F();if(!e)return"unknown";var t=Su(e);return _u(e)?t?"chrome_extension_service_worker":"service_worker":wu(e)?"web_worker":Au(e)?t?"chrome_extension":"browser":ku(e)?"node":"unknown"}var Xr="2.45.8",no="amplitude-ts",io="Web",Pu="$remote",Ou=(function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(no,"/").concat(Xr),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(t){return this.config=t,Promise.resolve(void 0)},e.prototype.execute=function(t){var r,n;return A(this,void 0,void 0,function(){var i,o,a,s;return w(this,function(l){return i=new Date().getTime(),o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1,a=(n=t.event_id)!==null&&n!==void 0?n:o+1,this.config.lastEventId=a,t.time||(this.config.lastEventTime=i),s=_(_(_(_(_(_(_(_({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:io}),this.config.trackingOptions.language&&{language:Ka()}),this.config.trackingOptions.ipAddress&&{ip:Pu}),{insert_id:Se(),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}}),t),{event_id:a,library:this.library,user_agent:this.userAgent}),[2,s]})})},e})(),Ot=1e3,oo=(function(e){Ge(t,e);function t(r){var n=this,i,o,a;try{a=(i=F())===null||i===void 0?void 0:i.localStorage}catch(s){(o=r?.loggerProvider)===null||o===void 0||o.debug("Failed to access localStorage. error=".concat(JSON.stringify(s))),a=void 0}return n=e.call(this,a)||this,n.loggerProvider=r?.loggerProvider,n}return t.prototype.set=function(r,n){var i;return A(this,void 0,void 0,function(){var o;return w(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>Ot?(o=n.length-Ot,[4,e.prototype.set.call(this,r,n.slice(0,Ot))]):[3,2];case 1:return a.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Ot,".")),[3,4];case 2:return[4,e.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t})(Jt),Cu=(function(e){Ge(t,e);function t(){var r;return e.call(this,(r=F())===null||r===void 0?void 0:r.sessionStorage)||this}return t})(Jt),Ru=(function(e){Ge(t,e);function t(r){r===void 0&&(r={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=r,n}return t.prototype.send=function(r,n,i){return i===void 0&&(i=!1),A(this,void 0,void 0,function(){var o=this;return w(this,function(a){return[2,new Promise(function(s,l){typeof XMLHttpRequest>"u"&&l(new Error("XHRTransport is not supported."));var u=new XMLHttpRequest;u.open("POST",r,!0),u.onreadystatechange=function(){if(u.readyState===o.state.done){var g=u.responseText;try{s(o.buildResponse(JSON.parse(g)))}catch{s(o.buildResponse({code:u.status}))}}};var c={"Content-Type":"application/json",Accept:"*/*"},d=JSON.stringify(n),f=i&&d.length>=Li&&Ni(),v=function(g){var y,m;c=_(_({},o.customHeaders),c);try{for(var p=x(Object.entries(c)),b=p.next();!b.done;b=p.next()){var E=D(b.value,2),T=E[0],S=E[1];u.setRequestHeader(T,S)}}catch(k){y={error:k}}finally{try{b&&!b.done&&(m=p.return)&&m.call(p)}finally{if(y)throw y.error}}u.send(g)},h=function(){return A(o,void 0,void 0,function(){var g;return w(this,function(y){switch(y.label){case 0:return f?[4,Mi(d)]:[3,2];case 1:return g=y.sent(),g?(c["Content-Encoding"]="gzip",v(g)):v(d),[3,3];case 2:v(d),y.label=3;case 3:return[2]}})})};h().catch(l)})]})})},t})(Br),Du=16*1024,xu=(function(e){Ge(t,e);function t(r,n,i){r===void 0&&(r={});var o=e.call(this)||this;return o.customHeaders=r,o.enableKeepalive=n!==!1,o.referrerPolicy=i,o}return t.prototype.send=function(r,n,i){return i===void 0&&(i=!1),A(this,void 0,void 0,function(){var o,a,s,l,u,c,d,f,v;return w(this,function(h){switch(h.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return o=JSON.stringify(n),a=i&&o.length>=Li&&Ni(),s=o,l={"Content-Type":"application/json",Accept:"*/*"},a?[4,Mi(o)]:[3,2];case 1:u=h.sent(),u&&(l["Content-Encoding"]="gzip",s=u),h.label=2;case 2:return l=_(_({},this.customHeaders),l),c=typeof s=="string"?s.length:s.byteLength,d={headers:l,body:s,method:"POST",keepalive:this.enableKeepalive&&c<=Du},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(r,d)];case 3:return f=h.sent(),[4,f.text()];case 4:v=h.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch{return[2,this.buildResponse({code:f.status})]}return[2]}})})},t})(Br),Lu=(function(e){Ge(t,e);function t(){return e.call(this)||this}return t.prototype.send=function(r,n,i){return A(this,void 0,void 0,function(){var o=this;return w(this,function(a){return[2,new Promise(function(s,l){var u=F();if(!u?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var c=JSON.stringify(n),d=u.navigator.sendBeacon(r,c);return s(d?o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}):o.buildResponse({code:500}))}catch(f){l(f)}})]})})},t})(Br),Nu=function(e,t,r){return r===void 0&&(r=!0),A(void 0,void 0,void 0,function(){var n,i,o,a,s,l,u,c,d;return w(this,function(f){switch(f.label){case 0:return n=ja(e),[4,t.getRaw(n)];case 1:return i=f.sent(),i?r?[4,t.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:f.sent(),f.label=3;
5case 3:return o=D(i.split("."),6),a=o[0],s=o[1],l=o[2],u=o[3],c=o[4],d=o[5],[2,{deviceId:a,userId:Mu(s),sessionId:cr(u),lastEventId:cr(d),lastEventTime:cr(c),optOut:!!l}]}})})},cr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Mu=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}},_e="[Amplitude]",Mn="".concat(_e," Form Started"),Uu="".concat(_e," Form Submitted"),Fu="".concat(_e," File Downloaded"),Un="session_start",Fn="session_end",Vu="".concat(_e," File Extension"),Hu="".concat(_e," File Name"),Bu="".concat(_e," Link ID"),qu="".concat(_e," Link Text"),Gu="".concat(_e," Link URL"),dr="".concat(_e," Form ID"),fr="".concat(_e," Form Name"),vr="".concat(_e," Form Destination"),Kt="cookie",ao="US";const Af=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_ACTION_CLICK_ALLOWLIST:Vi,DEFAULT_CSS_SELECTOR_ALLOWLIST:Fi,DEFAULT_DATA_ATTRIBUTE_PREFIX:qr,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Ft,get IdentifyOperation(){return Re},get LogLevel(){return fe},OfflineDisabled:Ui,get RevenueProperty(){return Ee},get ServerZone(){return wr},get SpecialEventType(){return ve}},Symbol.toStringTag,{value:"Module"}));var Vn=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Wu=function(e){return Object.values(e).every(function(t){return!t})},ju=function(e){var t=_(_({},e),{referring_domain:void 0,referrer:void 0});return Object.values(t).every(function(r){return!r})},Ku=function(e,t,r,n,i,o){i===void 0&&(i=!0),e.referrer;var a=e.referring_domain,s=Bt(e,["referrer","referring_domain"]),l=t||{};l.referrer;var u=l.referring_domain,c=Bt(l,["referrer","referring_domain"]),d=r.excludeInternalReferrers;if(d){var f=Ju(d,n);if(!(f instanceof TypeError)&&e.referring_domain&&Qu(e.referring_domain,o)){if(f==="always")return Hn(f,e.referring_domain,n),!1;if(f==="ifEmptyCampaign"&&ju(e))return Hn(f,e.referring_domain,n),!1}}if(zu(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&&Wu(e)&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var v=JSON.stringify(s)!==JSON.stringify(c),h=Vn(a||"")!==Vn(u||""),g=!t||v||h;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},zu=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=""),e.some(function(r){return r instanceof RegExp?r.test(t):r===t})},Xu=function(e,t){var r=t.startsWith(".")?t:".".concat(t),n=e.startsWith(".")?e:".".concat(e);return!!n.endsWith(r)},$u=function(e,t){var r=_(_({},Yt),e),n=Object.entries(r).reduce(function(i,o){var a,s=D(o,2),l=s[0],u=s[1];return i.setOnce("initial_".concat(l),(a=u??t.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY"),u?i.set(l,u):i.unset(l)},new gt);return Ur(n)},Yu=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},Ju=function(e,t){if(e===!0)return Ft.always;if(typeof e=="object"){var r=e.condition;if(typeof r=="string"&&Object.keys(Ft).includes(r))return r;if(typeof r>"u")return Ft.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),new TypeError(n)};function Hn(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");e==="always"?r.debug(n):e==="ifEmptyCampaign"&&r.debug("".concat(n," with empty campaign parameters"))}var so=["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"],uo=function(e){var t,r,n=e||((r=(t=F())===null||t===void 0?void 0:t.location)===null||r===void 0?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],a=i[i.length-2];return so.find(function(s){return n.endsWith(".".concat(s))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Qu=function(e,t){var r=F();if(!r)return!1;var n=(t||"").trim()||uo(r.location.hostname);return Xu(e,n)},Zu=(function(e){Ge(t,e);function t(r,n,i,o,a,s,l,u,c,d,f,v,h,g,y,m,p,b,E,T,S,k,O,C,M,I,N,R,L,q,V,K,le,he,we,U,G,$,te,oe,ce,re,pe,ie){i===void 0&&(i=new Hr),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),u===void 0&&(u=1e3),c===void 0&&(c=5),d===void 0&&(d=30),f===void 0&&(f=Kt),m===void 0&&(m=new Fr),p===void 0&&(p=fe.Warn),E===void 0&&(E=!1),T===void 0&&(T=!1),O===void 0&&(O=""),C===void 0&&(C=ao),N===void 0&&(N=1800*1e3),R===void 0&&(R=new oo({loggerProvider:m})),L===void 0&&(L={ipAddress:!0,language:!0,platform:!0}),q===void 0&&(q="fetch"),V===void 0&&(V=!1),K===void 0&&(K=!0),$===void 0&&($=!0),te===void 0&&(te=0),pe===void 0&&(pe=!1);var P=this,ae;P=e.call(this,{apiKey:r,storageProvider:R,transportProvider:lo(q)}
5)||this,P.apiKey=r,P.appVersion=n,P.cookieOptions=o,P.defaultTracking=a,P.autocapture=s,P.flushIntervalMillis=u,P.flushMaxRetries=c,P.flushQueueSize=d,P.identityStorage=f,P.ingestionMetadata=v,P.instanceName=h,P.loggerProvider=m,P.logLevel=p,P.minIdLength=b,P.offline=E,P.partnerId=S,P.plan=k,P.serverUrl=O,P.serverZone=C,P.sessionTimeout=N,P.storageProvider=R,P.trackingOptions=L,P.transport=q,P.useBatch=V,P.fetchRemoteConfig=K,P.networkTrackingOptions=U,P.identify=G,P.enableDiagnostics=$,P.diagnosticsSampleRate=te,P.diagnosticsClient=oe,P.remoteConfig=ce,P.topLevelDomain=re,P.enableRequestBodyCompression=pe,P.customEnrichment=ie,P.version=Xr,P._optOut=!1,P._cookieStorage=i,P.deviceId=l,P.lastEventId=g,P.lastEventTime=y,P.optOut=T,P.deferredSessionId=I,P.sessionId=M,P.pageCounter=he,P.userId=le,P.debugLogsEnabled=we,P.loggerProvider.enable(we?fe.Debug:P.logLevel),P.networkTrackingOptions=U,P.identify=G,P.enableDiagnostics=$,P.diagnosticsSampleRate=te,P.diagnosticsClient=oe;var se=(ae=ce?.fetchRemoteConfig)!==null&&ae!==void 0?ae:K;return P.remoteConfig=P.remoteConfig||{},P.remoteConfig.fetchRemoteConfig=se,P.fetchRemoteConfig=se,P.topLevelDomain=re||uo(),P}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,r!==void 0&&this._deferredSessionId!==void 0&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(r){this._deferredSessionId!==r&&r!==this.sessionId&&(this._deferredSessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var r={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 Wt&&(r.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Ci(this.apiKey),r)},t})(Ia),el=function(e,t,r,n,i){return t===void 0&&(t={}),A(void 0,void 0,void 0,function(){var o,a,s,l,u,c,d,f,v,h,g,y,m,p,b,E,T,S,k,O,C,M,I,N,R,L,q,V,K,le,he,we,U,G,$,te,oe,ce,re,pe,ie,P,ae,se,me,j,ge,be,Ae,Ne,Me;return w(this,function(Ce){switch(Ce.label){case 0:return o=t.identityStorage||Kt,a="",o===Kt&&!(!((M=t.cookieOptions)===null||M===void 0)&&M.domain)&&((I=t.cookieOptions)===null||I===void 0?void 0:I.domain)!==""?[4,nl(void 0,n)]:[3,2];case 1:a=Ce.sent(),Ce.label=2;case 2:return s=_({domain:(R=(N=t.cookieOptions)===null||N===void 0?void 0:N.domain)!==null&&R!==void 0?R:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(tt){var je=Di(tt);
5if(!je)return!1;var rt=JSON.parse(je);return xi(rt.cookieDomain,s.domain)},diagnosticsClient:n},u=tl(t.identityStorage,s,l),[4,Nu(e,u,(q=(L=t.cookieOptions)===null||L===void 0?void 0:L.upgrade)!==null&&q!==void 0?q:!0)];case 3:return c=Ce.sent(),[4,u.get(Ci(e))];case 4:return d=Ce.sent(),f=Gt(),v=f.ampTimestamp?Number(f.ampTimestamp):void 0,h=v?Date.now()<v:!0,g=(we=(he=(le=(V=t.deviceId)!==null&&V!==void 0?V:h?(K=f.ampDeviceId)!==null&&K!==void 0?K:f.deviceId:void 0)!==null&&le!==void 0?le:d?.deviceId)!==null&&he!==void 0?he:c.deviceId)!==null&&we!==void 0?we:Se(),y=(U=d?.lastEventId)!==null&&U!==void 0?U:c.lastEventId,m=(G=d?.lastEventTime)!==null&&G!==void 0?G:c.lastEventTime,p=(te=($=t.optOut)!==null&&$!==void 0?$:d?.optOut)!==null&&te!==void 0?te:c.optOut,b=(oe=d?.sessionId)!==null&&oe!==void 0?oe:c.sessionId,E=d?.deferredSessionId,T=(re=(ce=t.userId)!==null&&ce!==void 0?ce:d?.userId)!==null&&re!==void 0?re:c.userId,r.previousSessionDeviceId=(pe=d?.deviceId)!==null&&pe!==void 0?pe:c.deviceId,r.previousSessionUserId=(ie=d?.userId)!==null&&ie!==void 0?ie:c.userId,S={ipAddress:(ae=(P=t.trackingOptions)===null||P===void 0?void 0:P.ipAddress)!==null&&ae!==void 0?ae:!0,language:(me=(se=t.trackingOptions)===null||se===void 0?void 0:se.language)!==null&&me!==void 0?me:!0,platform:(ge=(j=t.trackingOptions)===null||j===void 0?void 0:j.platform)!==null&&ge!==void 0?ge:!0},k=d?.pageCounter,O=d?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),C=new Zu(e,t.appVersion,u,s,t.defaultTracking,t.autocapture,g,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,y,m,(be=i?.loggerProvider)!==null&&be!==void 0?be:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,p,t.partnerId,t.plan,t.serverUrl,(Ae=i?.serverZone)!==null&&Ae!==void 0?Ae:t.serverZone,b,E,t.sessionTimeout,t.storageProvider,S,t.transport,t.useBatch,t.fetchRemoteConfig,T,k,O,t.networkTrackingOptions,t.identify,(Ne=i?.enableDiagnostics)!==null&&Ne!==void 0?Ne:t.enableDiagnostics,(Me=i?.diagnosticsSampleRate)!==null&&Me!==void 0?Me:r._diagnosticsSampleRate,n,t.remoteConfig,a,t.enableRequestBodyCompression,t.customEnrichment),[4,C.storageProvider.isEnabled()];case 5:return Ce.sent()||(C.loggerProvider.warn("Storage provider ".concat(C.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),C.storageProvider=new Hr),[2,C]}})})},tl=function(e,t,r){switch(e===void 0&&(e=Kt),t===void 0&&(t={}),e){case"localStorage":return new oo;case"sessionStorage":return new Cu;case"none":return new Hr;default:return new Wt(_(_({},t),{expirationDays:t.expiration}),r)}},rl=function(e){var t,r;return e===void 0&&(e={}),((t=e.remoteConfig)===null||t===void 0?void 0:t.fetchRemoteConfig)===!0?!0:!(((r=e.remoteConfig)===null||r===void 0?void 0:r.fetchRemoteConfig)===!1||e.fetchRemoteConfig===!1)},lo=function(e){var t=typeof e=="object"?e.type:e,r=typeof e=="object"?e.headers:void 0,n=typeof e=="object"?e.enableKeepalive:void 0,i=typeof e=="object"?e.referrerPolicy:void 0;return t==="xhr"?new Ru(r):t==="beacon"?new Lu:new xu(r,n,i)},nl=function(e,t){return A(void 0,void 0,void 0,function(){var r,n,i,o,a,a,s,l,u;return w(this,function(c){switch(c.label){case 0:return[4,new Wt(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!c.sent()||typeof location>"u"||!location.hostname)return[2,""];if(r=location.hostname,n=r.split("."),n.length===1)return[2,""];for(i=[],o=1,so.find(function(d){return r.endsWith(".".concat(d))})&&(o=2),a=n.length-o-1;a>=0;--a)i.push(n.slice(a).join("."));a=0,c.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],c.label=3;case 3:return c.trys.push([3,5,,6]),[4,Wt.isDomainWritable(s)];case 4:return l=c.sent(),l?[2,"."+s]:[3,6];case 5:return u=c.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:u instanceof Error?u.message:String(u)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(r)}),[2,""]}})})},il="[Amplitude] Page Viewed",hr="AMP_PAGE_VIEW",Bn=function(e){e===void 0&&(e={});var t,r=F(),n=void 0,i=!1,o,a,s=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,c=u===void 0?il:u,d=function(p){var b=p;try{b=decodeURI(p)}catch(E){n?.error("Malformed URI sequence: ",E)}return b},f=function(p){return A(void 0,void 0,void 0,function(){var b,E,T;return w(this,function(S){switch(S.label){case 0:return b=d(typeof location<"u"&&location.href||""),T={event_type:c},E=[{}],[4,ol()];case 1:return[2,(T.event_properties=_.apply(void 0,[_.apply(void 0,E.concat([S.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":b,"[Amplitude] Page Path":typeof location<"u"&&d(location.pathname)||"","[Amplitude] Page Title":Kr(jr),"[Amplitude] Page URL":b.split("?")[0],"[Amplitude] Page View ID":p}]),T)]}})})},v=function(){return typeof s>"u"||typeof s=="function"&&s()},h=typeof location<"u"?location.href:null,g=function(){return A(void 0,void 0,void 0,function(){var p,b,E,T,S;return w(this,function(k){switch(k.label){case 0:return p=location.href,b=sl(l,p,h||"")&&v(),h=p,b?(E=void 0,a&&(E=Se(),a.set(hr,{pageViewId:E})),n?.log("Tracking page view event"),t!=null?[3,1]:[3,3]):[3,4];case 1:return S=(T=t).track,[4,f(E)];case 2:S.apply(T,[k.sent()]),k.label=3;case 3:k.label=4;case 4:return[2]}})})},y=function(){g()},m={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(p,b){return A(void 0,void 0,void 0,function(){var E,T,S;return w(this,function(k){switch(k.label){case 0:if(t=b,o=p,n=p.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),i=!0,r){try{a=new Jt(r.sessionStorage)}catch{n?.debug("sessionStorage is not available in this environment.")}r.addEventListener("popstate",y),r.history.pushState=new Proxy(r.history.pushState,{apply:function(O,C,M){var I=D(M,3),N=I[0],R=I[1],L=I[2];O.apply(C,[N,R,L]),i&&y()}})}return v()?(n.log("Tracking page view event"),E=void 0,a&&(E=Se(),a.set(hr,{pageViewId:E})),S=(T=t).track,[4,f(E)]):[3,2];case 1:S.apply(T,[k.sent()]),k.label=2;case 2:return[2]}})})},execute:function(p){return A(void 0,void 0,void 0,function(){var b,E,T;return w(this,function(S){switch(S.label){case 0:return s==="attribution"&&al(p)?(n?.log("Enriching c
5ampaign event to page view event with campaign parameters"),b=void 0,a?[4,a.get(hr)]:[3,2]):[3,4];case 1:E=S.sent(),b=E?.pageViewId,S.label=2;case 2:return[4,f(b)];case 3:T=S.sent(),p.event_type=T.event_type,p.event_properties=_(_({},p.event_properties),T.event_properties),S.label=4;case 4:return o&&p.event_type===c&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,p.event_properties=_(_({},p.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,p]}})})},teardown:function(){return A(void 0,void 0,void 0,function(){return w(this,function(p){return r&&(r.removeEventListener("popstate",y),i=!1),[2]})})}};return m},ol=function(){return A(void 0,void 0,void 0,function(){var e;return w(this,function(t){switch(t.label){case 0:return e=Ri,[4,new Wr().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},al=function(e){if(e.event_type==="$identify"&&e.user_properties){var t=e.user_properties,r=t[Re.SET]||{},n=t[Re.UNSET]||{},i=H(H([],D(Object.keys(r)),!1),D(Object.keys(n)),!1);return Object.keys(Yt).every(function(o){return i.includes(o)})}return!1},sl=function(e,t,r){switch(e){case"pathOnly":{if(r=="")return!0;var n=new URL(t),i=new URL(r),o=n.origin+n.pathname,a=i.origin+i.pathname;return o!==a}default:return t!==r}},ul=function(){var e,t=[],r=function(c,d,f){c.addEventListener(d,f),t.push({element:c,type:d,handler:f})},n=function(){t.forEach(function(c){var d=c.element,f=c.type,v=c.handler;d?.removeEventListener(f,v)}),t=[]},i,o="@amplitude/plugin-form-interaction-tracking-browser",a="enrichment",s=function(c,d){return A(void 0,void 0,void 0,function(){var f,v;return w(this,function(h){return i=Tu(c),f=function(){if(!d){c.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var g=new WeakSet,y=function(p){if(!g.has(p)){g.add(p);var b=!1;r(p,"change",function(){var E,T=qn(p);b||d.track(Mn,(E={},E[dr]=Ke(p.id),E[fr]=Ke(p.name),E[vr]=T,E)),b=!0}),r(p,"submit",function(E){var T,S,k=qn(p);if(b||d.track(Mn,(T={},T[dr]=Ke(p.id),T[fr]=Ke(p.name),T[vr]=k,T)),b=!0,i?.shouldTrackSubmit!==void 0)if(typeof i.shouldTrackSubmit=="function"&&typeof SubmitEvent<"u"&&E instanceof SubmitEvent)try{var O=i.shouldTrackSubmit(E);if(!O)return}catch{c.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else c.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");d.track(Uu,(S={},S[dr]=Ke(p.id),S[fr]=Ke(p.name),S[vr]=k,S)),b=!1})}},m=Array.from(document.getElementsByTagName("form"));m.forEach(y),typeof MutationObserver<"u"&&(e=new MutationObserver(function(p){p.forEach(function(b){b.addedNodes.forEach(function(E){try{if(E.nodeName==="FORM"&&y(E),"querySelectorAll"in E&&typeof E.querySelectorAll=="function"){var T=E,S=T.querySelectorAll("form");S?.forEach(y)}}catch(k){c.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(k)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?f():(v=F(),v?v.addEventListener("load",f):c.loggerProvider.debug("Form interaction tracking is not installed because global is undefined.")),[2]})})},l=function(c){return A(void 0,void 0,void 0,function(){return w(this,function(d){return[2,c]})})},u=function(){return A(void 0,void 0,void 0,function(){return w(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:a,setup:s,execute:l,teardown:u}},Ke=function(e){if(typeof e=="string")return e},qn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(t??""),window.location.href).href}catch{}return t},ll=function(){var e,t=[],r=function(u,c,d){u.addEventListener(c,d),t.push({element:u,type:c,handler:d})},n=function(){t.forEach(function(u){var c=u.element,d=u.type,f=u.handler;c?.removeEventListener(d,f)}),t=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",a=function(u,c){return A(void 0,void 0,void 0,function(){var d,f;return w(this,function(v){return d=function(){if(!c){u.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var h=function(m){var p;try{p=new URL(m.href,window.location.href)}catch{return}var b=g.exec(p.href),E=b?.[1];E&&r(m,"click",function(){var T;E&&c.track(Fu,(T={},T[Vu]=E,T[Hu]=p.pathname,T[Bu]=m.id,T[qu]=m.text,T[Gu]=m.href,T))})},g=/\.(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)(\?.+)?$/,y=Array.from(document.getElementsByTagName("a"));
5y.forEach(h),typeof MutationObserver<"u"&&(e=new MutationObserver(function(m){m.forEach(function(p){p.addedNodes.forEach(function(b){try{if(b.nodeName==="A"&&h(b),"querySelectorAll"in b&&typeof b.querySelectorAll=="function"){var E=b,T=E.querySelectorAll("a");T?.forEach(h)}}catch(S){u.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(S)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?d():(f=F(),f?f.addEventListener("load",d):u.loggerProvider.debug("File download tracking is not installed because global is undefined.")),[2]})})},s=function(u){return A(void 0,void 0,void 0,function(){return w(this,function(c){return[2,u]})})},l=function(){return A(void 0,void 0,void 0,function(){return w(this,function(u){return e?.disconnect(),n(),[2]})})};return{name:i,type:o,setup:a,execute:s,teardown:l}},Gn=!1,cl=function(e){if(!(Gn||e.defaultTracking!==void 0)){var t=`\`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:
6
7amplitude.init(<YOUR_API_KEY>, {
8  defaultTracking: true,
9});
10
11Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;e.loggerProvider.warn(t),Gn=!0}},dl=function(){var e="@amplitude/plugin-network-checker-browser",t="before",r=F(),n=[],i=function(l,u){r?.addEventListener&&(r?.addEventListener(l,u),n.push({type:l,handler:u}))},o=function(){n.forEach(function(l){var u=l.type,c=l.handler;r?.removeEventListener(u,c)}),n=[]},a=function(l,u){return A(void 0,void 0,void 0,function(){return w(this,function(c){return typeof navigator>"u"?(l.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),l.offline=!1,[2]):(l.offline=!navigator.onLine,i("online",function(){l.offline!==!1&&(l.loggerProvider.debug("Network connectivity changed to online."),l.offline=!1,setTimeout(function(){u.flush()},l.flushIntervalMillis))}),i("offline",function(){l.loggerProvider.debug("Network connectivity changed to offline."),l.offline=!0}),[2])})})},s=function(){return A(void 0,void 0,void 0,function(){return w(this,function(l){return o(),[2]})})};return{name:e,type:t,setup:a,teardown:s}};function fl(e,t){var r,n;if(e){Ji(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",kr(e));var i=e;if(i&&"autocapture"in i){if(typeof i.autocapture=="boolean"&&(t.autocapture=i.autocapture),typeof i.autocapture=="object"&&i.autocapture!==null){var o=_({},i.autocapture);if(t.autocapture===void 0&&(t.autocapture=i.autocapture),typeof i.autocapture.elementInteractions=="object"&&i.autocapture.elementInteractions!==null&&(!((r=i.autocapture.elementInteractions.pageUrlAllowlistRegex)===null||r===void 0)&&r.length)){o.elementInteractions=_({},i.autocapture.elementInteractions);var a=o.elementInteractions,s=(n=a.pageUrlAllowlist)!==null&&n!==void 0?n:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Yi(s,l,t.loggerProvider),delete a.pageUrlAllowlistRegex}var u=cu(i.autocapture.networkTracking,t.loggerProvider);u&&(o.networkTracking=u),typeof t.autocapture=="boolean"&&(t.autocapture=_({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},o)),typeof t.autocapture=="object"&&(t.autocapture=_(_({},t.autocapture),o))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&i.customEnrichment!==null&&t.customEnrichment!==!1&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",kr(t))}catch(c){t.loggerProvider.error("Failed to apply remote configuration because of error: ",c)}}}var co="1.29.0",vl="@amplitude/plugin-autocapture-browser",hl="@amplitude/plugin-frustration-browser",pl="@amplitude/plugin-performance-browser",fo="[Amplitude] Element Clicked",gl="[Amplitude] Dead Click",ml="[Amplitude] Rage Click",bl="[Amplitude] Error Click",yl="[Amplitude] Element Changed",El="[Amplitude] Thrashed Cursor",Tl="[Amplitude] Main Thread Block",Sl="[Amplitude] Element ID",_l="[Amplitude] Element Class",Wn="[Amplitude] Element Tag",jn="[Amplitude] Element Text",wl="[Amplitude] Element Hierarchy",Al="[Amplitude] Element Href",kl="[Amplitude] Element Position Left",Il="[Amplitude] Element Position Top",Pl="[Amplitude] Element Aria Label",Ol="[Amplitude] Element Attributes",Cl="[Amplitude] Element Path",Rl="[Amplitude] Element Parent Label",Cr="[Amplitude] Page URL",Dl="[Amplitude] Page Title",vo="[Amplitude] Viewport Height",ho="[Amplitude] Viewport Width",xl="[Amplitude] Max Page X",Ll="[Amplitude] Max Page Y",po="[Amplitude] Page View ID",Nl="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",Ml="amp-visual-tagging-selector-highlight",go="data-amp-mask-attributes",mo="data-amp-internal-shadow",Ul=25,bo=128,Fl="AMP_PAGE_VIEW",Vl=18e3,Hl=150,Bl=4e3,ql=50,Gl=[/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/];function Wl(e,t){var r,n,i=[];try{for(var o=x(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(u){var l=u instanceof Error?u.message:String(u);t?.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(l,")"))}}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function jl(e,t){var r,n;if(e==null||e==="")return!1;try{for(var i=x(t),o=i.next();!o.done;o=i.next()){var a=o.value;if(a.test(e))return!1}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}var Kl=[/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/];function zl(e,t){var r,n,i=[];try{for(var o=x(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(u){var l=u instanceof Error?u.message:String(u);t?.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(l,")"))}}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function yo(e,t){var r=e.getAttribute(t.explicitTrackingAttribute);if(r!==null&&r==="")return null;var n=e.getAttribute("id");return n===null||n===""||!jl(n,t.autogeneratedIdPatterns)?null:n}function Xl(e,t){return t.map($l).join(" > ")}function $l(e){var t=e.tagName.toLowerCase(),r=e.parentElement;if(r===null)return t;var n=Yl(e,r);return"".concat(t,":nth-of-type(").concat(n,")")}function Yl(e,t){for(var r=0,n=0;n<t.children.length;n++){var i=t.children[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var Jl=" >>> ",Eo=":scope > ";function De(e){return typeof ShadowRoot<"u"&&e instanceof ShadowRoot}function Ql(e,t,r){return e&&r&&De(t)?"".concat(Eo).concat(e):e}function Zl(e){for(var t=e;t!==null;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}function ec(e){var t,r=e.getRootNode();return De(r)?r:(t=e.ownerDocument)!==null&&t!==void 0?t:document}function tc(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return De(t)?t.host:null}var To=1024,rc=5e4;function So(e,t){var r,n,i,o;return w(this,function(a){switch(a.label){case 0:r=e,n=0,i=0,a.label=1;case 1:return r!==null&&i<To?(i+=1,[4,r]):[3,3];case 2:return a.sent(),r.parentElement?(r=r.parentElement,[3,1]):n<t&&typeof r.getRootNode=="function"&&(o=tc(r),o&&o!==r)?(n+=1,r=o,[3,1]):[3,3];case 3:return[2]}})}function _o(e,t){var r=[];if(t<=0)return r;for(var n=[[e,0]],i=0;n.length&&i<rc;){i+=1;var o=D(n.pop(),2),a=o[0],s=o[1],l=a.shadowRoot;if(l&&s+1<=t){r.push({root:l,depth:s+1});for(var u=l.children,c=0;c<u.length;c++)n.push([u[c],s+1])}for(var d=a.children,c=0;c<d.length;c++)n.push([d[c],s])}return r}function wo(e,t){for(var r=[],n=e,i=0;n!==null&&i<To;){i+=1;var o=ec(n);r.push({root:o,target:n});var a=n.getRootNode();if(!De(a))break;n=a.host}var s=r.length-1,l=!1,u=r;return s>t&&(u=r.slice(s-t),l=!0),{segments:u.reverse(),truncated:l}}function nc(e,t){var r=e.tagName.toLowerCase(),n=e.parentElement;if(n===null){var i=e.getRootNode();return t&&De(i)?"".concat(r,":nth-of-type(").concat(Kn(e,i.children),")"):r}return"".concat(r,":nth-of-type(").concat(Kn(e,n.children),")")}function Kn(e,t){for(var r=0,n=0;n<t.length;n++){var i=t[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var ic={name:"explicitTrackingAttribute",try:function(e,t){var r=t.config.explicitTrackingAttribute,n=e.getAttribute(r);return n===null||n===""?null:"[".concat(r,"=").concat(JSON.stringify(n),"]")}};function zt(e){var t=globalThis.CSS;if(t&&typeof t.escape=="function")return t.escape(e);for(var r=String(e),n=r.length,i="",o=0;o<n;o++){var a=r.charCodeAt(o);if(a===0){i+="�";continue}if(a>=1&&a<=31||a===127||o===0&&a>=48&&a<=57||o===1&&a>=48&&a<=57&&r.charCodeAt(0)===45){i+="\\".concat(a.toString(16)," ");continue}if(o===0&&n===1&&a===45){i+="\\-";continue}if(a>=128||a===45||a===95||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122){i+=r.charAt(o);continue}i+="\\".concat(r.charAt(o))}return i}function Ao(e){return zt(e)}var oc={name:"stableId",try:function(e,t){var r=yo(e,t.config);return r===null?null:"".concat(e.tagName.toLowerCase(),"#").concat(Ao(r))}},ko=!1,Io=1,ac=10,Fe=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:H([],D(Gl),!1),unstableClassPatterns:H([],D(Kl),
11!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:ko,maxShadowDomDepth:Io});function Tt(e){var t;return _(_({},e),{shadowDomEnabled:(t=e.shadowDomEnabled)!==null&&t!==void 0?t:ko,maxShadowDomDepth:Oo(e.maxShadowDomDepth)})}function Po(e,t){if(!e)return zn();var r=zn();return typeof e.enabled=="boolean"&&(r.enabled=e.enabled),typeof e.explicitTrackingAttribute=="string"&&e.explicitTrackingAttribute!==""&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=Wl(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=zl(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth=sc(e.maxAncestorWalkDepth),typeof e.shadowDomEnabled=="boolean"&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Oo(e.maxShadowDomDepth),Tt(r)}function sc(e){if(typeof e=="number"&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}function Oo(e){return typeof e!="number"||!Number.isFinite(e)?Io:Math.min(Math.max(Math.floor(e),1),ac)}function zn(){return{enabled:Fe.enabled,explicitTrackingAttribute:Fe.explicitTrackingAttribute,autogeneratedIdPatterns:H([],D(Fe.autogeneratedIdPatterns),!1),unstableClassPatterns:H([],D(Fe.unstableClassPatterns),!1),maxAncestorWalkDepth:Fe.maxAncestorWalkDepth,shadowDomEnabled:Fe.shadowDomEnabled,maxShadowDomDepth:Fe.maxShadowDomDepth}}var uc=[ic,oc];function lc(e,t,r){var n,i,o,a,s;r===void 0&&(r={});var l=Tt(t),u=(o=r.strategies)!==null&&o!==void 0?o:uc,c=(s=(a=r.scope)!==null&&a!==void 0?a:e.ownerDocument)!==null&&s!==void 0?s:document,d={scope:c,config:l},f=cc(e,l.maxAncestorWalkDepth);try{for(var v=x(u),h=v.next();!h.done;h=v.next())for(var g=h.value,y=0;y<f.length;y++){var m=f[y],p=g.try(m,d);if(p!==null){if(y===0){if(Xn(c,p,e,g.name,r.logger))return p;continue}var b=f.slice(0,y).reverse(),E=Xl(m,b),T="".concat(p," > ").concat(E);if(Xn(c,T,e,g.name,r.logger))return T}}}catch(S){n={error:S}}finally{try{h&&!h.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}return null}function cc(e,t){for(var r=[],n=e;n!==null&&(r.push(n),!(t!==void 0&&r.length>t));)n=n.parentElement;return r}function Xn(e,t,r,n,i){var o;try{o=e.querySelectorAll(t)}catch(s){var a=s instanceof Error?s.message:String(s);return i?.debug('@amplitude/element-selector: strategy "'.concat(n,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return o.length===1&&o[0]===r}function dc(e,t,r){var n,i;r===void 0&&(r={});for(var o=Tt(t),a=(i=(n=r.scope)!==null&&n!==void 0?n:e.ownerDocument)!==null&&i!==void 0?i:document,s=De(a),l=[],u=e,c=0,d=!(o.shadowDomEnabled&&s);u!==null&&!(d&&o.maxAncestorWalkDepth!==void 0&&c>o.maxAncestorWalkDepth);){var f=yo(u,o);if(f!==null){var v="".concat(u.tagName.toLowerCase(),"#").concat(Ao(f)),h=H([v],D(l),!1).join(" > ");if(fc(a,h,e))return h}l.unshift(nc(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var g=l.join(" > ");return o.shadowDomEnabled&&s&&u===null?"".concat(Eo).concat(g):g}function fc(e,t,r){var n;try{n=e.querySelectorAll(t)}catch{return!1}return n.length===1&&n[0]===r}var ft=(function(){function e(t,r){this.value=t,this.optimized=r}return e.prototype.toString=function(){return this.value},e})(),vc=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=hc(n,!!t,n===e);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},hc=function(e,t,r){var n,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new ft(Yn(o),!0);var a=e.tagName.toLowerCase();if(a==="body"||a==="head"||a==="html")return new ft(a,!0)}var s=e.tagName.toLowerCase();if(o)return new ft(s+Yn(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new ft(s,!0);for(var u=$n(e),c=!1,d=!1,f=-1,v=-1,h=l.children,g=0;h&&(f===-1||!d)&&g<h.length;++g){var y=h[g];if(y.nodeType===Node.ELEMENT_NODE){if(v+=1,y===e){f=v;continue}if(!d&&y.tagName.toLowerCase()===s){c=!0;var m=new Set(u);if(!m.size){d=!0;continue}for(var p=$n(y),b=0;b<p.length;++b){var E=p[b];if(m.has(E)&&(m.delete(E),!m.size)){d=!0;break}}}}}var T=s;if(r&&s.toLowerCase()==="input"&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(T+="[type="+zt(e.getAttribute("type")||"")+"]"),d)T+=":nth-child("+String(f+1)+")";else if(c)try{for(var S=x(u),k=S.next();!k.done;k=S.next()){var O=k.value;T+="."+zt(O.slice(1))}}catch(C){n={error:C}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(n)throw n.error}}return new ft(T,!1)},$n=function(e){var t=e.getAttribute("class");
11return t?t.split(/\s+/g).filter(Boolean).map(function(r){return"$"+r}):[]},Yn=function(e){return"#"+zt(e)};function Jn(e,t){try{return vc(e)}catch(n){var r=n instanceof Error?n.message:String(n);return t?.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(r)),""}}function pc(e,t){t===void 0&&(t={});var r=Tt(e),n=new Set,i=t.logger,o=function(u){return Jn(u,i)},a=function(u,c){var d;return(d=lc(u,r,{strategies:t.strategies,scope:c,logger:i}))!==null&&d!==void 0?d:dc(u,r,{scope:c})},s=function(u,c){return Ql(o(u),c,Zl(u))};function l(u,c){var d=wo(u,r.maxShadowDomDepth),f=d.segments,v=d.truncated;return v&&i?.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(r.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host")),f.map(function(h){var g=h.target,y=h.root;return c(g,y)}).join(Jl)}return{generate:function(u){var c,d;try{if(!r.shadowDomEnabled){var f=r.enabled?a:o;return f(u,(d=(c=t.scope)!==null&&c!==void 0?c:u.ownerDocument)!==null&&d!==void 0?d:document)}return l(u,r.enabled?a:s)}catch(h){var v=h instanceof Error?h.message:String(h);return i?.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(v)),Jn(u,i)}},getConfig:function(){return r},updateConfig:function(u){var c,d;r=Tt(u);try{for(var f=x(n),v=f.next();!v.done;v=f.next()){var h=v.value;try{h(r)}catch(y){var g=y instanceof Error?y.message:String(y);i?.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(g))}}}catch(y){c={error:y}}finally{try{v&&!v.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}},onConfigChange:function(u){return n.add(u),function(){n.delete(u)}}}}var gc=1,We=Object.freeze({enabled:!1,maxDepth:0}),mc=function(e){var t,r=(t=e.maxShadowDomDepth)!==null&&t!==void 0?t:gc;return!e.shadowDomEnabled||r<=0?We:Object.freeze({enabled:!0,maxDepth:r})},bc=function(){var e=We,t=new Set,r=function(n){var i,o;try{for(var a=x(H([],D(t),!1)),s=a.next();!s.done;s=a.next()){var l=s.value;try{l(n)}catch{}}}catch(u){i={error:u}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}t.clear()};return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,r(n)),e},onArm:function(n){if(e.enabled){var i=e;try{n(i)}catch{}return function(){}}return t.add(n),function(){t.delete(n)}}}},pr,yc=function(){return pr||(pr=bc()),pr},Ec=["input","select","textarea"],Tc=function(e,t){var r,n=(r=window?.getComputedStyle)===null||r===void 0?void 0:r.call(window,e);return n?.getPropertyValue("cursor")==="pointer"&&t==="click"},$r=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&_r(window.location.href,r)||!_r(window.location.href,t))},Ye=function(e,t){return function(r,n){var i,o,a=e.shouldTrackEventResolver,s=(o=(i=n?.tagName)===null||i===void 0?void 0:i.toLowerCase)===null||o===void 0?void 0:o.call(i);if(!s)return!1;if(a)return a(r,n);if(!$r(e))return!1;var l=String(n?.getAttribute("type"))||"";if(typeof l=="string")switch(l.toLowerCase()){case"hidden":return!1;case"password":return!1}if(t){var u=t.some(function(c){var d;return!!(!((d=n?.matches)===null||d===void 0)&&d.call(n,c))});if(!u)return!1}switch(s){case"input":case"select":case"textarea":return r==="change"||r==="click";default:return r==="click"}}},Sc=function(e){var t,r,n,i=(r=(t=e?.tagName)===null||t===void 0?void 0:t.toLowerCase)===null||r===void 0?void 0:r.call(t),o=e instanceof HTMLElement?((n=e.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":!1;return!Ec.includes(i)&&!o},_c=function(e){return e?e.split(",").map(function(t){return t.trim()}).filter(function(t){return t.length>0&&t!=="id"&&t!=="class"}):[]},wc=function(e,t){return Object.entries(e).reduce(function(r,n){var i=D(n,2),o=i[0],a=i[1];if(o.startsWith(t)){var s=o.replace(t,"");s&&(r[s]=a||"")}return r},{})},Ac=function(e){return e==null||typeof e=="object"&&Object.keys(e).length===0||typeof e=="string"&&e.trim().length===0},Qn=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return Ac(n)||(t[r]=n),t},{})},Co=function(){var e;try{var t=F(),r=(e=t?.sessionStorage)===null||e===void 0?void 0:e.getItem(Fl);if(!r)return;var n=JSON.parse(r);if(typeof n.pageViewId=="string")return n.pageViewId}catch{}},Ro=function(e,t,r){return r===void 0&&(r=We),r.enabled?kc(e,t,r.maxDepth):Do(e,t)},Do=function(e,t){return e?t.some(function(r){var n;return(n=e?.matches)===null||n===void 0?void 0:n.call(e,r)})?e:Do(e?.parentElement,t):null},kc=function(e,t,r){var n,i;if(!e)return null;var o=function(c){if(t.some(function(d){var f;return(f=c?.matches)===null||f===void 0?void 0:f.call(c,d)}))return{value:c}};try{for(var a=x(So(e,r)),s=a.next();!s.done;s=a.next()){var l=s.value,u=o(l);if(typeof u=="object")return u.value}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return null},Zn=function(e,t,r){return r===void 0&&(r=We),r.enabled?Ic(e,t,r.maxDepth):xo(e,t)},xo=function(e,t){var r=[];return t&&e.querySelectorAll(t).forEach(function(n){return r.push(n)}),r},Ic=function(e,t,r){var n=xo(e,t),i=e instanceof Document?e.documentElement:e;return i&&_o(i,r).forEach(function(o){var a=o.root;a.querySelectorAll(t).forEach(function(s){return n.push(s)})}),n},Pc=function(e,t){var r,n;if(t===void 0&&(t=We),!t.enabled)return e.target;var i=(r=e.composedPath)===null||r===void 0?void 0:r.call(e),o=(n=e.target)!==null&&n!==void 0?n:null;if(!i||i.length===0)return o;var a=i[0];if(!(a instanceof Element))return a??o;var s=wo(a,t.maxDepth),l=s.segments,u=s.truncated;return u&&l.length>0?l[l.length-1].target:a},St=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function Oc(e){return e.type==="click"||e.type==="change"}function Yr(e){if(!e)return"";try{var t=new URL(e);return t.search="",Te(t.href)}catch{return Te(e)}}function Je(e){var t,r;return e===void 0&&(e=F()),Yr((r=(t=e?.location)===null||t===void 0?void 0:t.href)!==null&&r!==void 0?r:"")}function Cc(e,t){var r;if(t===void 0&&(t=F()),e==null||e==="")return Je(t);var n=((r=t?.location)===null||r===void 0?void 0:r.href)||"http://localhost/";try{return Yr(new URL(e,n).href)}catch{return Je(t)}}var Xt;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"})(Xt||(Xt={}));var ei="__AMPLITUDE_VISUAL_TAGGING__";function Rc(e,t){var r=e;if(r[ei]!==!0){r[ei]=!0;
11var n=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,l=function(c){e.notify({action:"element-selected",data:c})},u=function(c,d){c==="selector-mode-changed"?e.notify({action:"track-selector-mode-changed",data:d}):c==="selector-moved"&&e.notify({action:"track-selector-moved",data:d})};e.registerActionHandler("initialize-visual-tagging-selector",function(c){e.loadScriptOnce(Nl).then(function(){var d;s=(d=window?.amplitudeVisualTaggingSelector)===null||d===void 0?void 0:d.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(f){return i?i(c?.actionType||"click",f):!0},onTrack:u,onSelect:l,visualHighlightClass:Ml,messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:co}}}),e.notify({action:"selector-loaded"})}).catch(function(){var d;(d=e.logger)===null||d===void 0||d.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var c;(c=s?.close)===null||c===void 0||c.call(s)})}}function Dc(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackEvent,i=e.evaluateTriggers,o=r.clickObservable,a=o.filter(St).filter(function(l){return n("click",l.closestTrackedAncestor)}).map(function(l){return i(l)}),s=a;return s.subscribe(function(l){t?.track(fo,l.targetElementProperties)})}function xc(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers,a=r.changeObservable,s=a.filter(St).filter(function(l){return i("change",l.closestTrackedAncestor)}).map(function(l){return o(l)});return s.subscribe(function(l){t?.track(yl,n("change",l.closestTrackedAncestor))})}function Lc(e){var t=e.amplitude,r=e.allObservables,n=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=s.filter(function(y){return!o("click",y.closestTrackedAncestor)}).map(function(y){var m=Ro(y.event.target,n.actionClickAllowlist);return y.closestTrackedAncestor=m,y.closestTrackedAncestor!==null&&(y.targetElementProperties=i(y.type,y.closestTrackedAncestor)),y}).filter(St).filter(function(y){return a("click",y.closestTrackedAncestor)}),d=u?qe(l,u):l,f=qe(c,d),v=null,h=null,g=zr(f,function(y){if(v&&(clearTimeout(v),v=null),y.type==="click")return h=y,v=setTimeout(function(){v=null,h=null},500),Promise.resolve(null);if(h){var m=h;return h=null,Promise.resolve(m)}return Promise.resolve(null)});return g.subscribe(function(y){y&&t?.track(fo,i("click",y.closestTrackedAncestor))})}function Nc(e){var t=e.allObservables,r=t.scrollObservable,n={maxX:0,maxY:0},i=r.subscribe(function(){var o,a,s,l,u=F(),c=Math.floor((a=(o=u?.scrollX)!==null&&o!==void 0?o:u?.pageXOffset)!==null&&a!==void 0?a:0),d=Math.floor((l=(s=u?.scrollY)!==null&&s!==void 0?s:u?.pageYOffset)!==null&&l!==void 0?l:0);n.maxX=Math.max(n.maxX,c),n.maxY=Math.max(n.maxY,d)});return{unsubscribe:function(){i.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}var Qe=F(),pt=function(e){return e.get()},Mc={childList:!0,attributes:!0,characterData:!0,subtree:!0},Lo=function(e){return e?new ne(function(t){var r=new WeakSet,n=new WeakMap,i=function(c,d){r.has(c)||(r.add(c),De(c)&&n.set(c,d),s.observe(c,Mc))},o=function(c,d,f){var v=f-d;v<=0||_o(c,v).forEach(function(h){var g=h.root,y=h.depth;return i(g,d+y)})},a=function(c){var d=c.getRootNode();if(!De(d))return 0;var f=n.get(d);return f??0},s=new MutationObserver(function(c){var d,f;t.next(c);try{var v=pt(e);if(!v.enabled)return;var h=function(p){var b=a(p.target);p.addedNodes.forEach(function(E){E instanceof Element&&o(E,b,v.maxDepth)})};try{for(var g=x(c),y=g.next();!y.done;y=g.next()){var m=y.value;h(m)}}catch(p){d={error:p}}finally{try{y&&!y.done&&(f=g.return)&&f.call(g)}finally{if(d)throw d.error}}}catch{}}),l;if(document.body){var u=document.body;i(u,0),l=e.onArm(function(c){o(u,0,c.maxDepth)})}return function(){l?.(),s.disconnect()}}):new ne(function(t){var r=new MutationObserver(function(n){t.next(n)});return document.body&&r.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return r.disconnect()}})},No=function(e){return e===void 0&&(e="click"),new ne(function(t){var r,n=function(i){t.next(i)};return(r=F())===null||r===void 0||r.document.addEventListener(e,n,{capture:!0}),function(){var i;(i=F())===null||i===void 0||i.document.removeEventListener(e,n,{capture:!0})}})},Uc=function(){return new ne(function(e){var t,r=function(n){e.next(n)};return(t=F())===null||t===void 0||t.addEventListener("scroll",r),function(){var n;(n=F())===null||n===void 0||n.removeEventListener("scroll",r)}})},Fc=function(){return new ne(function(e){var t=function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=void 0;Array.isArray(n[0])&&typeof n[0][0]=="string"&&(o=n[0][0]),e.next({kind:"console",message:o})};return An.addListener("error",t),function(){An.removeListener(t)}})},Vc=function(e,t,r,n){var i=typeof r=="function"?r:void 0,o=typeof r=="function"?n:r;return new ne(function(a){var s=F();if(!s?.IntersectionObserver)return function(){};var l=new IntersectionObserver(function(g){g.forEach(function(y){a.next(y)})},{root:null,rootMargin:"0px",threshold:1}),u=t.join(","),c=function(g){g instanceof Element&&g.matches(u)&&l.observe(g),g.querySelectorAll(u).forEach(function(y){l.observe(y)})}
11,d=function(g){if(o)try{Zn(g,u,pt(o)).forEach(function(y){l.observe(y)})}catch{}},f=function(){var g=s?.document;if(g){var y=[];try{o&&pt(o).enabled?y=Zn(g,u,pt(o)):y=g.querySelectorAll(u)}catch{return}Array.from(y).forEach(function(m){l.unobserve(m),l.observe(m)})}};i?.(f),f();var v=o?.onArm(function(){s?.document&&d(s.document)}),h=e.subscribe(function(g){var y=g.event;return y.forEach(function(m){var p=m.addedNodes;return p.forEach(function(b){if(b instanceof DocumentFragment){c(b);return}if(b instanceof Element){if(!o||!pt(o).enabled){c(b);return}try{b.matches(u)&&l.observe(b)}catch{}d(b)}})})});return function(){i?.(void 0),v?.(),h.unsubscribe(),l.disconnect()}})},Hc=function(){return new ne(function(e){var t=function(r){if(r instanceof ErrorEvent){var n={kind:"error"};r.error instanceof Error||r.error instanceof DOMException?n=_(_({},n),{message:r.error.message,stack:r.error.stack,filename:r.filename,lineNumber:r.lineno,columnNumber:r.colno}):typeof r.error=="string"&&(n.message=r.error),e.next(n)}};return Qe.addEventListener("error",t),function(){Qe.removeEventListener("error",t)}})},Bc=function(){return new ne(function(e){var t=function(r){var n={kind:"unhandledrejection"};r.reason instanceof Error||r.reason instanceof DOMException?(n.message=r.reason.message,n.stack=r.reason.stack):typeof r.reason=="string"&&(n.message=r.reason),e.next(n)};return Qe.addEventListener("unhandledrejection",t),function(){Qe.removeEventListener("unhandledrejection",t)}})},qc=function(){var e=qe(Hc(),Bc());return qe(e,Fc())},Gc=function(){return new ne(function(e){var t=function(n){e.next(n)},r={capture:!0};return Qe.document.addEventListener("mousemove",t,r),function(){Qe.document.removeEventListener("mousemove",t,r)}})},Wc=function(e,t){try{if(t.subprop_key==="[Amplitude] Element Text")return t.subprop_op==="is"&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if(t.subprop_key==="[Amplitude] Element Hierarchy")return t.subprop_op==="autotrack css match"&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(r){return console.error("Error matching event to filter",r),!1}return!1},jc=function(e,t){try{if(e.sourceType==="DOM_ELEMENT"){var r=document.documentElement;return e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector?r.querySelector(e.selector):r}}catch{return}},Kc=function(e,t,r){e.forEach(function(n){if(typeof n!="string"&&n.actionType==="ATTACH_EVENT_PROPERTY"){var i=r.extractDataFromDataSource(n.dataSource,t.closestTrackedAncestor);t.targetElementProperties[n.destinationKey]=i}})},Rr={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},ti=function(e){var t,r,n,i,o=Object.values(Rr).reduce(function(v,h){return v[h]=new Set,v},{});if(!e)return o;try{for(var a=x(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{try{for(var u=(n=void 0,x(l.definition)),c=u.next();!c.done;c=u.next()){var d=c.value,f=Rr[d.event_type];f&&o[f].add(l.id)}}catch(v){n={error:v}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(v){console.warn("Skipping Labeled Event due to malformed definition",l?.id,v)}}}catch(v){t={error:v}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},ri=function(e){var t,r,n,i,o=new Map;try{for(var a=x(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{for(var u=(n=void 0,x(l.conditions)),c=u.next();!c.done;c=u.next()){var d=c.value;if(d.type==="LABELED_EVENT"){var f=d.match.eventId,v=o.get(f);v||(v=[],o.set(f,v)),v.push(l)}}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(h){t={error:h}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},zc=function(e,t){return t.filter(function(r){return r.definition.some(function(n){return Rr[n.event_type]===e.type&&n.filters.every(function(i){return Wc(e,i)})})})},Xc=function(e,t){var r,n,i,o,a=new Set;try{for(var s=x(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=t.get(u.id);if(c)try{for(var d=(i=void 0,x(c)),f=d.next();!f.done;f=d.next()){var v=f.value;a.add(v)}}catch(h){i={error:h}}
11finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(h){r={error:h}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return Array.from(a)},$c=(function(){function e(t,r,n,i){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=r,this.dataExtractor=n,this.options=i}return e.prototype.evaluate=function(t){var r,n,i=this.options.pageActions;if(!i)return t;var o=zc(t,Array.from(this.groupedLabeledEvents[t.type]).map(function(c){return i.labeledEvents[c]})),a=Xc(o,this.labeledEventToTriggerMap);try{for(var s=x(a),l=s.next();!l.done;l=s.next()){var u=l.value;Kc(u.actions,t,this.dataExtractor)}}catch(c){r={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return t},e.prototype.update=function(t,r,n){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=r,this.options=n},e})(),Yc=function(e,t,r,n){return new $c(e,t,r,n)},Jc=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",go,Le,mo]),Qc=["type"],Zc=["svg","path","g"],ed=["password","hidden"];function td(e,t){if(e.parentElement)return e.parentElement.children;var r=e.getRootNode();return t&&De(r)?r.children:[]}function rd(e,t,r){var n,i,o,a,s;if(r===void 0&&(r=We),e===null)return null;var l=String(e.tagName).toLowerCase(),u={tag:l},c=Array.from(td(e,r.enabled));c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(T){return T.tagName===e.tagName}).indexOf(e));var d=(s=(a=e.previousElementSibling)===null||a===void 0?void 0:a.tagName)===null||s===void 0?void 0:s.toLowerCase();d&&(u.prevSib=String(d));var f=e.getAttribute("id");f&&(u.id=String(f));var v=Array.from(e.classList);v.length&&(u.classes=v);var h={},g=Array.from(e.attributes),y=g.filter(function(T){return!Jc.has(T.name)}),m=!Sc(e);if(!ed.includes(String(e.getAttribute("type")))&&!Zc.includes(l))try{for(var p=x(y),b=p.next();!b.done;b=p.next()){var E=b.value;
11if(!(m&&!Qc.includes(E.name))){if(t.has(E.name)){h[E.name]=xe;continue}h[E.name]=String(E.value).substring(0,bo)}}}catch(T){n={error:T}}finally{try{b&&!b.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}return Object.keys(h).length&&(u.attrs=h),e.shadowRoot&&(u.attrs=_(_({},u.attrs||{}),(o={},o[mo]="true",o)),u.shadow=!0),u}function Mo(e,t){return t===void 0&&(t=We),e?t.enabled?id(e,t.maxDepth):nd(e):[]}function nd(e){var t=[];t.push(e);for(var r=e.parentElement;r&&r.tagName!=="HTML";)t.push(r),r=r.parentElement;return t}function id(e,t){var r,n,i=[];try{for(var o=x(So(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.tagName==="HTML")break;i.push(s)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}var od=function(e){return e.closest("[".concat(Le,"]"))!==null},ad=function(e,t){var r,n;return Mo(e,t).some(function(i){return i.hasAttribute(Le)})?!0:(n=(r=document.documentElement)===null||r===void 0?void 0:r.hasAttribute(Le))!==null&&n!==void 0?n:!1},gr;function sd(){return gr||(gr=pc(Po())),gr}var Uo=(function(){function e(t,r){var n,i,o=this,a;this.replaceSensitiveString=function(f){return jr(f,o.additionalMaskTextPatterns)},this.getHierarchy=function(f){var v,h,g,y,m=performance.now(),p=[];if(!f)return[];for(var b=o.getShadowMode(),E=Mo(f,b),T=new Map,S=E.length-1;S>=0;S--){var k=E[S];if(k){var O=_c(k.getAttribute(go)),C=S===E.length-1?[]:(g=T.get(E[S+1]))!==null&&g!==void 0?g:new Set,M=new Set(H(H([],D(C),!1),D(O),!1));T.set(k,M)}}p=E.map(function(V){var K;return rd(V,(K=T.get(V))!==null&&K!==void 0?K:new Set,b)});var I=function(V){V?.attrs&&Object.entries(V.attrs).forEach(function(K){var le=D(K,2),he=le[0],we=le[1];V.attrs&&(V.attrs[he]=o.replaceSensitiveString(we))})};try{for(var N=x(p),R=N.next();!R.done;R=N.next()){var L=R.value;I(L)}}catch(V){v={error:V}}finally{try{R&&!R.done&&(h=N.return)&&h.call(N)}finally{if(v)throw v.error}}var q=performance.now();return(y=o.diagnosticsClient)===null||y===void 0||y.recordHistogram("autocapturePlugin.getHierarchy",q-m),p},this.getNearestLabel=function(f){var v=f.parentElement;if(!v)return"";var h;try{h=v.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{h=null}return h?o.getText(h):o.getNearestLabel(v)},this.getElementPath=function(f){var v;if(!f)return"";var h=performance.now(),g=o.selectorEngine.generate(f),y=performance.now();return(v=o.diagnosticsClient)===null||v===void 0||v.recordHistogram("autocapturePlugin.getElementPath",y-h),g},this.updateSelectorConfig=function(f,v){var h;if(f!=null){var g=typeof f.enabled=="boolean",y=typeof f.shadowDomEnabled=="boolean";if(!g&&!y){v?.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.");return}var m=Po(f,v),p=o.selectorEngine.getConfig().enabled,b=o.shadowGate.get().enabled,E=o.shadowGate.arm(mc(m));o.selectorEngine.updateConfig(_(_(_({},g?m:o.selectorEngine.getConfig()),{shadowDomEnabled:E.enabled}),E.enabled&&{maxShadowDomDepth:E.maxDepth})),g&&p!==m.enabled&&v?.debug(m.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths."),!b&&E.enabled&&((h=o.diagnosticsClient)===null||h===void 0||h.setTag("plugin.autocapture.shadowDom","enabled:".concat(E.maxDepth)))}}
11,this.getShadowMode=function(){return o.shadowGate.get()},this.getEventProperties=function(f,v,h){var g,y,m,p,b=(m=(y=v?.tagName)===null||y===void 0?void 0:y.toLowerCase)===null||m===void 0?void 0:m.call(y),E=typeof v.getBoundingClientRect=="function"?v.getBoundingClientRect():{left:null,top:null},T=o.getHierarchy(v),S=(p=T[0])===null||p===void 0?void 0:p.attrs,k=o.getNearestLabel(v),O=wc(S??{},h),C=(g={},g[wl]=T,g[Wn]=b,g[jn]=o.getText(v),g[kl]=E.left==null?null:Math.round(E.left),g[Il]=E.top==null?null:Math.round(E.top),g[Ol]=O,g[Cl]=o.getElementPath(v),g[Rl]=k,g[Cr]=Te(window.location.href.split("?")[0]),g[Dl]=Kr(o.replaceSensitiveString),g[vo]=window.innerHeight,g[ho]=window.innerWidth,g),M=Co();if(M&&(C[po]=M),C[Sl]=v.getAttribute("id")||"",C[_l]=v.getAttribute("class"),C[Pl]=S?.["aria-label"],b==="a"&&f==="click"&&v instanceof HTMLAnchorElement){var I=v.href.substring(0,bo);C[Al]=o.replaceSensitiveString(I)}return Qn(C)},this.addTypeAndTimestamp=function(f,v){return{event:f,timestamp:Date.now(),type:v}},this.addAdditionalEventProperties=function(f,v,h,g,y){y===void 0&&(y=!1);var m=o.addTypeAndTimestamp(f,v);try{if(Oc(m)&&m.event.target!==null){var p=o.getShadowMode(),b=Pc(m.event,p);if(y){var E=Tc(b,m.type);if(E)return m.closestTrackedAncestor=b,m.targetElementProperties=o.getEventProperties(m.type,m.closestTrackedAncestor,g),m}var T=Ro(b,h,p);T&&(m.closestTrackedAncestor=T,m.targetElementProperties=o.getEventProperties(m.type,T,g))}}catch{}return m},this.extractDataFromDataSource=function(f,v){if(f.sourceType==="DOM_ELEMENT"){var h=jc(f,v);return h?f.elementExtractType==="TEXT"?o.getText(h):f.elementExtractType==="ATTRIBUTE"&&f.attribute?h.getAttribute(f.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(f){var v,h,g="[".concat(Le,"], [contenteditable]");if(!f.querySelector(g))return f.innerText;var y="",m=Array.from(f.childNodes);try{for(var p=x(m),b=p.next();!b.done;b=p.next()){var E=b.value;if(E.nodeType===Node.TEXT_NODE){y+=E.textContent||"";continue}if(E instanceof Element){if(E.hasAttribute(Le)||E.hasAttribute("contenteditable")){y+=xe;continue}y+=o.getTextWithMaskedDescendants(E)}}}catch(T){v={error:T}}finally{try{b&&!b.done&&(h=p.return)&&h.call(p)}finally{if(v)throw v.error}}return y},this.hasMaskedAncestor=function(f){var v=o.getShadowMode();return v.enabled?ad(f,v):od(f)},this.getText=function(f){var v=o.hasMaskedAncestor(f);if(v)return xe;var h="";return f.querySelector("[".concat(Le,"], [contenteditable]"))?h=o.getTextWithMaskedDescendants(f):h=f.innerText||"",o.replaceSensitiveString(h.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(f){var v,h,g;if(!f)return{};var y=(g=(h=f?.tagName)===null||h===void 0?void 0:h.toLowerCase)===null||g===void 0?void 0:g.call(h),m=(v={},v[Wn]=y,v[jn]=o.getText(f),v[Cr]=window.location.href.split("?")[0],v);return Qn(m)},this.diagnosticsClient=r?.diagnosticsClient,this.selectorEngine=sd(),this.shadowGate=yc();var s=(a=t.maskTextRegex)!==null&&a!==void 0?a:[],l=[];try{for(var u=x(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(l.length>=Ul)break;if(d instanceof RegExp)l.push(d);else if("pattern"in d&&typeof d.pattern=="string")try{l.push(new RegExp(d.pattern,"i"))}catch{}}}catch(f){n={error:f}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=l}return e})(),ud="configs.analyticsSDK.browserSDK.autocapture.elementSelector";function Fo(e,t){var r=e.remoteConfigClient;if(!(!e.fetchRemoteConfig||!r)){var n=r.subscribe(ud,"all",function(i,o){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(o),") ").concat(JSON.stringify(i))),t.updateSelectorConfig(i,e.loggerProvider)});return function(){r.unsubscribe(n)}}}function ld(e){var t=e.allObservables,r=e.onExposure,n=e.dataExtractor,i=e.exposureDuration,o=i===void 0?Hi:i,a=new Map,s=new Map,l=t.exposureObservable,u=l.subscribe(function(c){var d=c,f=d.target;if(d.isIntersecting){if(!a.get(f)){var v=s.get(f);v&&clearTimeout(v);var h=setTimeout(function(){a.set(f,!0);var g=n.getElementPath(f);r(g),s.set(f,null)},o);s.set(f,h)}}else if(!d.isIntersecting&&d.intersectionRatio<1){var h=s.get(f);h&&(clearTimeout(h),s.set(f,null))}});return{unsubscribe:function(){u.unsubscribe()}
11,reset:function(){s.forEach(function(c){c&&clearTimeout(c)}),s.clear(),a.clear()}}}function cd(e){var t,r,n,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=o.getState(),v=F(),h=(r=v?.innerWidth)!==null&&r!==void 0?r:0,g=(n=v?.innerHeight)!==null&&n!==void 0?n:0,y=Array.from(a).filter(function(E){return!l.has(E)}),m=(t={},t[Cr]=Je(v),t[xl]=f.maxX+h,t[Ll]=f.maxY+g,t[vo]=g,t[ho]=h,t["[Amplitude] Element Exposed"]=y,t),p=Co();p&&(m[po]=p);var b=function(){o.reset();var E=o.getState();d.maxX=E.maxX,d.maxY=E.maxY,s.clear(),l.clear(),u?.reset()};if(y.length===0&&f.maxX===d.maxX&&f.maxY===d.maxY){c&&b();return}i?.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,y.forEach(function(E){l.add(E)}),a.clear(),c&&b()}function dd(e,t,r,n,i){if(!(t.has(e)||r.has(e))){t.add(e),n.add(e);var o=Array.from(n),a=JSON.stringify(o);a.length>=Vl&&i(!1)}}function fd(e){var t=e.mutationObservable,r=e.onRescan,n=e.onFlush,i=e.exposureDuration,o=e.quietMs,a=o===void 0?Hl:o,s=e.maxWaitMs,l=s===void 0?Bl:s,u=!1,c,d,f,v,h,g=function(){c&&(clearTimeout(c),c=void 0),d&&(clearTimeout(d),d=void 0),f&&(clearTimeout(f),f=void 0)},y=function(){h&&(document.removeEventListener("DOMContentLoaded",h),h=void 0)},m=function(){return typeof document<"u"&&document.readyState!=="loading"},p=function(){if(!u){if(!m()){h||(h=function(){h=void 0,b()},document.addEventListener("DOMContentLoaded",h));return}u=!0,g(),y(),r(),f=setTimeout(function(){f=void 0,n()},i+ql)}},b=function(){u||(c&&clearTimeout(c),c=setTimeout(p,a))},E=function(){g(),y(),u=!1,b(),d=setTimeout(p,l)};return{start:function(){v||(v=t.subscribe(function(){b()}),E())},reset:function(){E()},stop:function(){v?.unsubscribe(),v=void 0,g(),y()}}}var ue;(function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"})(ue||(ue={}));var vd=function(e,t){var r,n,i,o,a,s,l,u,c,d,f,v;e===void 0&&(e={}),t?.diagnosticsClient.setTag("plugin.autocapture.version",co);var h=e.dataAttributePrefix,g=h===void 0?qr:h,y=e.visualTaggingOptions,m=y===void 0?{enabled:!0}:y;e.cssSelectorAllowlist=(r=e.cssSelectorAllowlist)!==null&&r!==void 0?r:Fi,e.actionClickAllowlist=(n=e.actionClickAllowlist)!==null&&n!==void 0?n:Vi,e.debounceTime=(i=e.debounceTime)!==null&&i!==void 0?i:0;var p=((o=e.viewportContentUpdated)===null||o===void 0?void 0:o.enabled)!==!1,b=(l=(s=(a=e.viewportContentUpdated)===null||a===void 0?void 0:a.exposureDuration)!==null&&s!==void 0?s:e.exposureDuration)!==null&&l!==void 0?l:Hi;e.viewportContentUpdated=_(_({},e.viewportContentUpdated),{exposureDuration:b}),e.pageUrlExcludelist=(u=e.pageUrlExcludelist)===null||u===void 0?void 0:u.reduce(function(U,G){if(typeof G=="string"&&U.push(G),G instanceof RegExp&&U.push(G),typeof G=="object"&&G!==null&&"pattern"in G)try{U.push(new RegExp(G.pattern))}catch($){return console.warn("Invalid regex pattern: ".concat(G.pattern),$),U}return U},[]);var E=vl,T="enrichment",S=[],k=new Uo(e,t),O=new Set,C=new Set,M=new Set,I,N,R=function(){var U,G=Ie(No().map(function(ie){return k.addAdditionalEventProperties(ie,"click",e.cssSelectorAllowlist,g)})),$=Ie(new ne(function(ie){var P,ae=function(se){var me=k.addAdditionalEventProperties(se,"change",e.cssSelectorAllowlist,g);ie.next(me)};return(P=F())===null||P===void 0||P.document.addEventListener("change",ae,{capture:!0}),function(){var se;return(se=F())===null||se===void 0?void 0:se.document.removeEventListener("change",ae)}})),te;window.navigation&&(te=Ie(new ne(function(ie){var P=function(ae){var se=k.addAdditionalEventProperties(ae,"navigate",e.cssSelectorAllowlist,g);ie.next(se)};return window.navigation.addEventListener("navigate",P),function(){window.navigation.removeEventListener("navigate",P)}})));var oe=k.shadowGate,ce=Ie(Lo(oe).map(function(ie){return k.addAdditionalEventProperties(ie,"mutation",e.cssSelectorAllowlist,g)})),re=Uc(),pe=Vc(ce,e.cssSelectorAllowlist,function(ie){N=ie},oe);return U={},U[ue.ChangeObservable]=$,U[ue.ClickObservable]=G,U[ue.MutationObservable]=ce,U[ue.NavigateObservable]=te,U[ue.ScrollObservable]=re,U[ue.ExposureObservable]=pe,U},L=ti(Object.values((d=(c=e.pageActions)===null||c===void 0?void 0:c.labeledEvents)!==null&&d!==void 0?d:{})),q=ri((v=(f=e.pageActions)===null||f===void 0?void 0:f.triggers)!==null&&v!==void 0?v:[]),V=Yc(L,q,k,e),K=function(U){var G,$;U&&(e.pageActions=_(_({},e.pageActions),U),L=ti(Object.values((G=e.pageActions.labeledEvents)!==null&&G!==void 0?G:{})),q=ri(($=e.pageActions.triggers)!==null&&$!==void 0?$:[]),V.update(L,q,e))},le=function(U,G){return A(void 0,void 0,void 0,function(){var $,te,oe,ce,re,pe,ie,P,ae,se,me,j,ge,be,Ae,Ne,Me,Ce,tt,je,rt,nt,it,tr,rr,At,nr;return w(this,function(bf){return typeof document>"u"?[2]:($=!1,U.fetchRemoteConfig&&(U.remoteConfigClient?U.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(B){K(B)}):U.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),te=Fo(U,k),te&&S.push({unsubscribe:te}),oe=Ye(e,e.cssSelectorAllowlist),ce=Ye(e,e.actionClickAllowlist),re=R(),pe=Dc({allObservables:re,amplitude:G,shouldTrackEvent:oe,evaluateTriggers:V.evaluate.bind(V)}),S.push(pe),ie=xc({allObservables:re,getEventProperties:function(){for(var B=[],z=0;z<arguments.length;z++)B[z]=arguments[z];return k.getEventProperties.apply(k,H(H([],D(B),!1),[g],!1))},amplitude:G,shouldTrackEvent:oe,evaluateTriggers:V.evaluate.bind(V)}),S.push(ie),P=Lc({allObservables:re,options:e,getEventProperties:function(){for(var B=[],z=0;z<arguments.length;z++)B[z]=arguments[z];return k.getEventProperties.apply(k,H(H([],D(B),!1),[g],!1))},amplitude:G,shouldTrackEvent:oe,shouldTrackActionClick:ce}),P&&S.push(P),ae=Nc({allObservables:re}),S.push(ae),se=_({},ae.getState()),me={},j=F(),be=function(B){B&&ge?.reset(),!(B&&$)&&(B&&($=!0,setTimeout(function(){$=!1},100)),cd({amplitude:G,scrollTracker:ae,currentElementExposed:M,elementExposedForPage:O,elementExposedInSentEvents:C,exposureTracker:me.exposure,isPageEnd:B,lastScroll:se}))},Ae=Je(j),Ne=function(){var B=Je(j);B!==Ae&&(Ae=B,be(!0))},Me=function(B,z){var ye=Je(j),ot=Cc(z,j);if(ye===ot){B();return}Ae=ot,be(!0),B()},Ce=function(B){dd(B,O,C,M,be)},p&&(me.exposure=ld({allObservables:re,onExposure:Ce,dataExtractor:k,exposureDuration:b}),me.exposure&&S.push(me.exposure),ge=fd({mutationObservable:re[ue.MutationObservable],onRescan:function(){var B,z;(z=(B=U.loggerProvider)===null||B===void 0?void 0:B.debug)===null||z===void 0||z.call(B,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),N?.()},onFlush:function(){var B,z;(z=(B=U.loggerProvider)===null||B===void 0?void 0:B.debug)===null||z===void 0||z.call(B,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),be(!1)},exposureDuration:b}),ge.start(),S.push({unsubscribe:function(){ge?.stop()}}),tt=function(){be(!0)},j?.addEventListener("beforeunload",tt),I=function(){j?.removeEventListener("beforeunload",tt)},S.push({unsubscribe:function(){return I()}}),je=re[ue.NavigateObservable],je?S.push(je.subscribe(function(B){var z,ye,ot=(ye=(z=B.event)===null||z===void 0?void 0:z.destination)===null||ye===void 0?void 0:ye.url;if(ot){var nn=Yr(ot);if(nn===Ae)return;Ae=nn,be(!0);return}Ne()})):j&&(rt=function(){Ne()},j.addEventListener("popstate",rt),nt=j.history.pushState,it=j.history.replaceState,j.history&&nt&&(j.history.pushState=new Proxy(nt,{apply:function(B,z,ye){Me(function(){B.apply(z,ye)},ye[2])}})),j.history&&it&&(j.history.replaceState=new Proxy(it,{apply:function(B,z,ye){Me(function(){B.apply(z,ye)},ye[2])}})),S.push({unsubscribe:function(){j.removeEventListener("popstate",rt),j.history&&nt&&(j.history.pushState=nt),j.history&&it&&(j.history.replaceState=it)}}
11))),(nr=U?.loggerProvider)===null||nr===void 0||nr.log("".concat(E," has been successfully added.")),window.opener&&m.enabled&&(tr=e.cssSelectorAllowlist,rr=e.actionClickAllowlist,At=ru(),Rc(At,{dataExtractor:k,isElementSelectable:Ye(e,H(H([],D(tr),!1),D(rr),!1)),cssSelectorAllowlist:tr,actionClickAllowlist:rr}),nu(At),At.setup(_({logger:U?.loggerProvider},U?.serverZone&&{endpoint:Ys[U.serverZone]}))),[2])})})},he=function(U){return A(void 0,void 0,void 0,function(){return w(this,function(G){return[2,U]})})},we=function(){return A(void 0,void 0,void 0,function(){var U,G,$,te,oe;return w(this,function(ce){try{for(U=x(S),G=U.next();!G.done;G=U.next())$=G.value,$.unsubscribe()}catch(re){te={error:re}}finally{try{G&&!G.done&&(oe=U.return)&&oe.call(U)}finally{if(te)throw te.error}}return[2]})})};return{name:E,type:T,setup:le,execute:he,teardown:we}},hd=3e3,pd=["mutation","navigate"];function gd(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,s=r.navigateObservable,l=o.filter(function(v){return St(v)&&i("click",v.closestTrackedAncestor)&&v.event.target instanceof Element&&v.event.target.closest('a[target="_blank"]')===null&&v.event.button===Xt.LEFT_OR_TOUCH_CONTACT}),u=s?qe(a,s):a,c=qe(l,u),d=null,f=zr(c,function(v){return d&&pd.includes(v.type)?(clearTimeout(d),d=null,Promise.resolve(null)):v.type==="click"?d?Promise.resolve(null):new Promise(function(h){d=setTimeout(function(){h(v),d=null},hd)}):Promise.resolve(null)});return f.subscribe(function(v){if(v){var h={"[Amplitude] X":v.event.clientX,"[Amplitude] Y":v.event.clientY};t.track(gl,_(_({},n("click",v.closestTrackedAncestor)),h),{time:v.timestamp})}})}var Vo=Is,Ho=ks,ni=Ps;function ii(e,t){var r,n,i,o,a=t.event,s=a.pageX,l=a.pageY;e.yMin=Math.min((r=e.yMin)!==null&&r!==void 0?r:l,l),e.yMax=Math.max((n=e.yMax)!==null&&n!==void 0?n:l,l),e.xMin=Math.min((i=e.xMin)!==null&&i!==void 0?i:s,s),e.xMax=Math.max((o=e.xMax)!==null&&o!==void 0?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>ni||e.xMax-e.xMin>ni}function oi(e){if(e.length===0)return null;var t=e[0],r=e[e.length-1],n=_({"[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(i){return{X:i.event.pageX,Y:i.event.pageY,Time:i.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties);return{rageClickEvent:n,time:t.timestamp}}function md(e,t){var r=Math.max(0,e.length-Vo+1),n=e[r];return t.timestamp-n.timestamp>=Ho}function bd(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function yd(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.pointerDownObservable,a=n.selectionObservable,s=[],l={},u=null;function c(h){s=[],l={},h&&(ii(l,h),s.push(h))}var d=zr(o.filter(function(h){return i("click",h.closestTrackedAncestor)}),function(h){return A(t,void 0,void 0,function(){var g;return w(this,function(y){return ii(l,h),g=null,s.length===0||bd(s,h)||md(s,h)||l.isOutOfBounds?(u&&(g=oi(s)),c(h)):s.push(h),u&&(clearTimeout(u.timerId),u.resolve(g),u=null),s.length>=Vo?[2,new Promise(function(m){u={resolve:m,timerId:setTimeout(function(){m(oi(s))},Ho)}})]:[2,null]})})}),f=a?.subscribe(function(){c()}),v=d.subscribe(function(h){h!==null&&r.track(ml,h.rageClickEvent,{time:h.time})});return{unsubscribe:function(){v.unsubscribe(),f?.unsubscribe()}}}var Ed=2e3;function Td(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackErrorClick,i=r.pointerDownObservable,o=r.browserErrorObservable,a=i.filter(function(c){return St(c)&&n("click",c.closestTrackedAncestor)&&c.event.target instanceof Element&&c.event.target.closest('a[target="_blank"]')===null&&c.event.button===Xt.LEFT_OR_TOUCH_CONTACT}),s=null,l=null,u=function(){s!==null&&(clearTimeout(s),s=null),l=null};return qe(a,o).subscribe(function(c){var d;if(c.type==="click"){u(),l=c,s=setTimeout(u,Ed);return}c.type==="error"&&l&&(t.track(bl,_((d={},d["[Amplitude] Kind"]=c.event.kind,d["[Amplitude] Message"]=c.event.message,d["[Amplitude] Stack"]=c.event.stack,d["[Amplitude] Filename"]=c.event.filename,d["[Amplitude] Line Number"]=c.event.lineNumber,d["[Amplitude] Column Number"]=c.event.columnNumber,d),l.targetElementProperties)),u())})}var ke;(function(e){e.INCREASING="increasing",e.DECREASING="decreasing"})(ke||(ke={}));var He;(function(e){e.X="x",e.Y="y"})(He||(He={}));var Sd=function(e){var t=e.allWindowObservables,r=t.mouseMoveObservable;return new ne(function(n){var i=null,o=null,a=null;return r.subscribe(function(s){var l={x:s.clientX,y:s.clientY};if(i===null){i=l;return}l.x>i.x?(o===ke.DECREASING&&n.next(He.X),o=ke.INCREASING):l.x<i.x&&(o===ke.INCREASING&&n.next(He.X),o=ke.DECREASING),l.y>i.y?(a===ke.DECREASING&&n.next(He.Y),a=ke.INCREASING):l.y<i.y&&(a===ke.INCREASING&&n.next(He.Y),a=ke.DECREASING),i=l})})};function _d(e){var t=+Date.now();e.startTime=e.startTime||t;var r=e.changes,n=e.changesThreshold;r.push(t),r.length>n&&r.shift()}function ai(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;if(t.length<r)return!1;var i=t[t.length-1]-t[0];return i<n}function si(e){e.changes=[],e.startTime=void 0}function ui(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length;n++){var o=i-t[n];if(o<r)break}n!==0&&(e.startTime=t[n],e.changes.splice(0,n))}function wd(e,t){var r=void 0;if(ai(e)&&(r=e.startTime),ai(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}var Bo=20,qo=2e3,Ad=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=r===void 0?Bo:r,i=e.thresholdMs,o=i===void 0?qo:i;return new ne(function(a){var s={changes:[],changesThreshold:n,thresholdMs:o},l={changes:[],changesThreshold:n,thresholdMs:o},u=void 0,c=null;function d(){u!==void 0&&(a.next(u),u=void 0,c!==null&&clearTimeout(c),si(s),si(l))}return t.subscribe(function(f){c!==null&&clearTimeout(c),_d(f===He.X?s:l);var v=wd(s,l);return v?(u=u||v,c=setTimeout(function(){d(),c=null},o)):d(),ui(s),ui(l),function(){c!==null&&(clearTimeout(c),c=null)}})})},kd=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=i===void 0?Bo:i,a=e.thresholdMs,s=a===void 0?qo:a,l=Sd({allWindowObservables:n}),u=Ad({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:s});return u.subscribe(function(c){$r(r)&&t.track(El,void 0,{time:c})})};function mr(e,t,r,n){if(!n)return[];var i=e[t];return typeof i=="object"&&i!==null&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var Ct=5,Rt=4e3,Id=function(e){var t;e===void 0&&(e={});var r=hl,n="enrichment",i=[],o=e.errorClicks!==!1;e.errorClicks||(o=!1);var a=e.deadClicks!==!1&&e.deadClicks!==null,s=e.rageClicks!==!1&&e.rageClicks!==null,l=e.thrashedCursor!==!1&&e.thrashedCursor!==null;e.thrashedCursor||(l=!1);var u=mr(e,"rageClicks",As,s),c=mr(e,"deadClicks",_s,a),d=mr(e,"errorClicks",ws,o),f=(t=e.dataAttributePrefix)!==null&&t!==void 0?t:qr,v=new Uo(e),h=H([],D(new Set(H(H(H([],D(u),!1),D(c),!1),D(d),!1))),!1),g=function(){var b,E=function(R){return Ie(No(R).map(function(L){return v.addAdditionalEventProperties(L,"click",h,f,!0)}))},T=E("click"),S=E("pointerdown"),k=Ie(qc().map(function(R){return v.addTypeAndTimestamp(R,"error")})),O=Ie(Lo(v.shadowGate).map(function(R){return v.addAdditionalEventProperties(R,"mutation",h,f)})),C;if(window.navigation){var M=new ne(function(R){var L=function(q){R.next(_(_({},q),{type:"navigate"}))};return window.navigation.addEventListener("navigate",L),function(){window.navigation.removeEventListener("navigate",L)}});C=Ie(M.map(function(R){return v.addAdditionalEventProperties(R,"navigate",h,f)}
11))}var I=Ie(new ne(function(R){var L=function(){var q=document.activeElement;if(q&&(q.tagName==="TEXTAREA"||q.tagName==="INPUT")){var V=void 0,K=void 0;try{if(V=q.selectionStart,K=q.selectionEnd,V===K)return}catch{return}return R.next()}var le=window.getSelection();if(!(!le||le.isCollapsed))return R.next()};return window.document.addEventListener("selectionchange",L),function(){window.document.removeEventListener("selectionchange",L)}})),N=Ie(Gc());return b={},b[ue.ClickObservable]=T,b[ue.PointerDownObservable]=S,b[ue.MutationObservable]=O,b[ue.NavigateObservable]=C,b[ue.BrowserErrorObservable]=k,b[ue.SelectionObservable]=I,b[ue.MouseMoveObservable]=N,b},y=function(b,E){return A(void 0,void 0,void 0,function(){var T,S,k,O,C,M,I,N,R,L,q,V;return w(this,function(K){return typeof document>"u"?[2]:(T=g(),S=Fo(b,v),S&&i.push({unsubscribe:S}),s&&(k=Ye(e,u),O=yd({allObservables:T,amplitude:E,shouldTrackRageClick:k}),i.push(O)),a&&(C=Ye(e,c),M=gd({amplitude:E,allObservables:T,getEventProperties:function(le,he){return v.getEventProperties(le,he,f)},shouldTrackDeadClick:C}),i.push(M)),o&&(I=Ye(e,d),N=Td({amplitude:E,allObservables:T,shouldTrackErrorClick:I}),i.push(N)),l&&(R=void 0,L=void 0,typeof e.thrashedCursor=="object"&&(R=e.thrashedCursor.directionChanges,L=e.thrashedCursor.threshold,R&&R<Ct&&(b.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(R," is below the minimum of ").concat(Ct,", setting to ").concat(Ct)),R=Ct),L&&L>Rt&&(b.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(L," is above the maximum of ").concat(Rt,", setting to ").concat(Rt)),L=Rt)),q=kd({amplitude:E,options:e,allObservables:T,directionChanges:R,thresholdMs:L}),i.push(q)),(V=b?.loggerProvider)===null||V===void 0||V.log("".concat(r," has been successfully added.")),[2])})})},m=function(b){return A(void 0,void 0,void 0,function(){return w(this,function(E){return[2,b]})})},p=function(){return A(void 0,void 0,void 0,function(){var b,E,T,S,k;return w(this,function(O){try{for(b=x(i),E=b.next();!E.done;E=b.next())T=E.value,T.unsubscribe()}catch(C){S={error:C}}finally{try{E&&!E.done&&(k=b.return)&&k.call(b)}finally{if(S)throw S.error}}return[2]})})};return{name:r,type:n,setup:y,execute:m,teardown:p}},Pd=100,Od=1e4;function Go(e,t){var r=e.startTime+e.duration;return t.filter(function(n){return n.startTime<r&&n.startTime+n.duration>e.startTime}).map(function(n){return n.name})}function Cd(e,t){var r,n=Go(e,t),i=(r=e.scripts)!==null&&r!==void 0?r:[],o=i.map(function(c){return c.sourceURL}).filter(Boolean),a=i.map(function(c){return c.sourceFunctionName}).filter(Boolean),s=i.map(function(c){return c.sourceCharPosition}).filter(function(c){return typeof c=="number"&&c>=0}),l=i.map(function(c){return c.invokerType}).filter(Boolean),u=i.map(function(c){return c.invoker}).filter(Boolean);return _(_(_(_(_(_(_({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),a.length>0&&{"[Amplitude] Main Thread Block Script Functions":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Positions":s}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),u.length>0&&{"[Amplitude] Main Thread Block Invokers":u})}function Rd(e,t){var r,n=Go(e,t),i=(r=e.attribution)!==null&&r!==void 0?r:[];return _(_({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(o){return o.name})})}function Dd(){if(typeof PerformanceObserver>"u")return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch{}return null}function xd(e){var t=e.amplitude,r=e.options,n=e.durationThreshold,i=n===void 0?Pd:n,o=Dd();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(u){var c,d,f=performance.now();try{for(var v=x(u.getEntries()),h=v.next();!h.done;h=v.next()){var g=h.value;a.push(g)}}catch(m){c={error:m}}finally{try{h&&!h.done&&(d=v.return)&&d.call(v)}finally{if(c)throw c.error}}for(var y=f-Od;a.length>0&&a[0].startTime<y;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch{}var l=new PerformanceObserver(function(u){var c,d;try{for(var f=x(u.getEntries()),v=f.next();!v.done;v=f.next()){var h=v.value;if(!$r(r))return;
11if(!(h.duration<i)){var g=o==="long-animation-frame"?Cd(h,a):Rd(h,a);t.track(Tl,g)}}}catch(y){c={error:y}}finally{try{v&&!v.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}});try{l.observe({entryTypes:[o]})}catch{return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),s.disconnect()}}}var Ld=100,Nd=function(e){e===void 0&&(e={});var t=pl,r="enrichment",n=[],i=e.mainThreadBlock===!0||typeof e.mainThreadBlock=="object"&&e.mainThreadBlock!==null,o=function(l,u){return A(void 0,void 0,void 0,function(){var c,d,f;return w(this,function(v){return typeof document>"u"?[2]:(i&&(c=Ld,typeof e.mainThreadBlock=="object"&&e.mainThreadBlock.durationThreshold!==void 0&&(c=e.mainThreadBlock.durationThreshold),d=xd({amplitude:u,options:e,durationThreshold:c}),n.push(d)),(f=l?.loggerProvider)===null||f===void 0||f.log("".concat(t," performance tracking has been successfully added.")),[2])})})},a=function(l){return A(void 0,void 0,void 0,function(){return w(this,function(u){return[2,l]})})},s=function(){return A(void 0,void 0,void 0,function(){var l,u,c,d,f;return w(this,function(v){try{for(l=x(n),u=l.next();!u.done;u=l.next())c=u.value,c.unsubscribe()}catch(h){d={error:h}}finally{try{u&&!u.done&&(f=l.return)&&f.call(l)}finally{if(d)throw d.error}}return[2]})})};return{name:t,type:r,setup:o,execute:a,teardown:s}},Md="@amplitude/plugin-network-capture-browser",Wo="[Amplitude] Network Request",jo="500-599";function Ht(e,t){var r=t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&"),n="^"+r.replace(/\*/g,".*")+"$",i=new RegExp(n);return i.test(e)}function Ko(e,t){var r,n,i=t.split(",");try{for(var o=x(i),a=o.next();!a.done;a=o.next()){var s=a.value,l=D(s.split("-").map(Number),2),u=l[0],c=l[1];if(e===u&&c===void 0||e>=u&&e<=c)return!0}}catch(d){r={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function Ud(e,t,r,n,i){if(!(e.hosts&&!e.hosts.find(function(a){return Ht(t,a)}))&&!(n&&e.urls&&!_r(n,e.urls))&&!(i&&e.methods&&!e.methods.find(function(a){return i.toLowerCase()===a.toLowerCase()||a==="*"}))){if(r||r===0){var o=e.statusCodeRange||jo;if(!Ko(r,o))return!1}return!0}}function Fd(e){var t,r=e.indexOf("#"),n=r>=0?e.slice(r+1):"",i=r>=0?e.slice(0,r):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,l=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i),u=(t=l?.[1])!==null&&t!==void 0?t:"";return{query:a,fragment:n,href:e,hrefWithoutQueryOrHash:s,host:u}}function zo(e){var t;if(e)try{var r=(t=F())===null||t===void 0?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),a=n.href,s=n.host;n.hash="",n.search="";var l=n.href;return{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:l,host:s}}catch{try{return Fd(e)}catch{return}}}function Vd(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if(typeof r!="string")return!1;var n=JSON.parse(r),i=n.events;if(i.find(function(o){return o.event_type===Wo}))return!0}catch{}return!1}function li(e){if(typeof e!="object"||e===null){if(e)return H([],D(qt),!1);if(e===void 0){var t=void 0;return t}return}if(e.length!==0)return e}function ci(e){var t,r,n;return!(!((t=e?.allowlist)===null||t===void 0)&&t.length)&&!(!((r=e?.blocklist)===null||r===void 0)&&r.length)&&!(!((n=e?.excludelist)===null||n===void 0)&&n.length)}function Hd(e,t){var r;t===void 0&&(t={});var n=zo(e.url);if(!n)return!1;var i=n.host;if(t.ignoreAmplitudeRequests!==!1&&(Ht(i,"*.amplitude.com")||Ht(i,"amplitude.com"))||!((r=t.ignoreHosts)===null||r===void 0)&&r.find(function(a){return Ht(i,a)})||!t.captureRules&&e.status!==void 0&&!Ko(e.status,jo))return!1;if(t.captureRules){var o;if(H([],D(t.captureRules),!1).reverse().find(function(a){if(o=Ud(a,i,e.status,e.url,e.method),o){var s=li(a.responseHeaders);if(e.responseWrapper&&s){var l=e.responseWrapper.headers(s);l&&(e.responseHeaders=l)}var u=li(a.requestHeaders);if(e.requestWrapper&&u){var c=e.requestWrapper.headers(u);c&&(e.requestHeaders=c)}if(e.responseWrapper&&a.responseBody&&!ci(a.responseBody)){var d=a.responseBody.excludelist||a.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(a.responseBody.allowlist,d)}if(e.requestWrapper&&a.requestBody&&!ci(a.requestBody)){var d=a.requestBody.excludelist||a.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(a.requestBody.allowlist,d)}}return o!==void 0}),!o)return!1}return!(e.requestWrapper&&Vd(i,e.requestWrapper))}function Bd(e,t,r,n){return A(this,void 0,void 0,function(){var i,o,a;return w(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=D.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(l){n?.debug("Failed to stringify request body",l)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch{n?.debug("Failed to stringify response body")}s.label=2;case 2:return r?.track(Wo,e),[2]}})})}function qd(e){var t=e.allObservables,r=e.networkTrackingOptions,n=e.amplitude,i=e.loggerProvider,o=t.networkObservable,a=o.filter(function(s){return Hd(s.event,r)});return a.subscribe(function(s){var l,u,c,d=s.event,f=zo(d.url);if(f){var v=(u=d.responseWrapper)===null||u===void 0?void 0:u.bodySize,h=(c=d.requestWrapper)===null||c===void 0?void 0:c.bodySize,g=(l={},l["[Amplitude] URL"]=f.hrefWithoutQueryOrHash,l["[Amplitude] URL Query"]=f.query,l["[Amplitude] URL Fragment"]=f.fragment,l["[Amplitude] Request Method"]=d.method,l["[Amplitude] Status Code"]=d.status,l["[Amplitude] Start Time"]=d.startTime,l["[Amplitude] Completion Time"]=d.endTime,l["[Amplitude] Duration"]=d.duration,l["[Amplitude] Request Body Size"]=h,l["[Amplitude] Response Body Size"]=v,l["[Amplitude] Request Type"]=d.type,l["[Amplitude] Request Headers"]=d.requestHeaders,l["[Amplitude] Response Headers"]=d.responseHeaders,l);Bd(g,d,n,i)}})}var Dr;(function(e){e.NetworkObservable="networkObservable"})(Dr||(Dr={}));var di,Gd=function(e){e===void 0&&(e={});var t=Md,r="enrichment",n,i=function(u,c){var d={event:u,timestamp:Date.now(),type:c};return d},o=function(){var u,c=new ne(function(d){var f=new Us(function(v){var h=i(v,"network");d.next(h)});return On.subscribe(f,n),function(){On.unsubscribe(f)}});return u={},u[Dr.NetworkObservable]=c,u},a=function(u,c){return A(void 0,void 0,void 0,function(){var d;return w(this,function(f){return typeof document>"u"&&!lu()?[2]:(d=o(),n=u?.loggerProvider,di=qd({allObservables:d,networkTrackingOptions:e,amplitude:c,loggerProvider:n}),n?.log("".concat(t," has been successfully added.")),[2])})})},s=function(u){return A(void 0,void 0,void 0,function(){return w(this,function(c){return[2,u]})})},l=function(){return A(void 0,void 0,void 0,function(){return w(this,function(u){return di.unsubscribe(),[2]})})};return{name:t,type:r,setup:a,execute:s,teardown:l}},Wd="web-vitals-browser",jd="[Amplitude] Web Vitals";let Xo=-1;const et=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Xo=t.timeStamp,e(t))}),!0)},Pe=(e,t,r,n)=>{let i,o;return a=>{t.value>=0&&(a||n)&&(o=t.value-(i??0),(o||i===void 0)&&(i=t.value,t.delta=o,t.rating=((s,l)=>s>l[1]?"poor":s>l[0]?"needs-improvement":"good")(t.value,r),e(t)))}},Jr=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Qr=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},_t=()=>Qr()?.activationStart??0,Oe=(e,t=-1)=>{const r=Qr();let n="navigate";return Xo>=0?n="back-forward-cache":r&&(document.prerendering||_t()>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(8999999999999*Math.random())+1e12}`,navigationType:n}},br=new WeakMap;function Zr(e,t){return br.get(e)||br.set(e,new t),br.get(e)}class Kd{t;i=0;o=[];h(t){if(t.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),this.t?.(t)}}const wt=(e,t,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{t(i.getEntries())}))}));return n.observe({type:e,buffered:!0,...r}),n}}catch{}},en=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let $e=-1;const $o=new Set,fi=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,xr=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of $o)t();isFinite($e)||($e=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",xr,!0))}},Zt=()=>{if($e<0){const e=_t();$e=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((r=>r.name==="hidden"&&r.startTime>e))[0]?.startTime)??fi(),addEventListener("visibilitychange",xr,!0),addEventListener("prerenderingchange",xr,!0),et((()=>{setTimeout((()=>{$e=fi()}))}))}return{get firstHiddenTime(){return $e},onHidden(e){$o.add(e)}}},er=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},vi=[1800,3e3],Yo=(e,t={})=>{er((()=>{const r=Zt();let n,i=Oe("FCP");const o=wt("paint",(a=>{for(const s of a)s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-_t(),0),i.entries.push(s),n(!0)))}));o&&(n=Pe(e,i,vi,t.reportAllChanges),et((a=>{i=Oe("FCP"),n=Pe(e,i,vi,t.reportAllChanges),Jr((()=>{i.value=performance.now()-a.timeStamp,n(!0)}))})))}))},hi=[.1,.25],zd=(e,t={})=>{const r=Zt();Yo(en((()=>{let n,i=Oe("CLS",0);const o=Zr(t,Kd),a=l=>{for(const u of l)o.h(u);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},s=wt("layout-shift",a);s&&(n=Pe(e,i,hi,t.reportAllChanges),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),et((()=>{o.i=0,i=Oe("CLS",0),n=Pe(e,i,hi,t.reportAllChanges),Jr((()=>n()))})),setTimeout(n))})))};let Jo=0,yr=1/0,Dt=0;const Xd=e=>{for(const t of e)t.interactionId&&(yr=Math.min(yr,t.interactionId),Dt=Math.max(Dt,t.interactionId),Jo=Dt?(Dt-yr)/7+1:0)};let Lr;const pi=()=>Lr?Jo:performance.interactionCount??0,$d=()=>{"interactionCount"in performance||Lr||(Lr=wt("event",Xd,{type:"event",buffered:!0,durationThreshold:0}))};let gi=0;class Yd{u=[];l=new Map;m;p;v(){gi=pi(),this.u.length=0,this.l.clear()}L(){const t=Math.min(this.u.length-1,Math.floor((pi()-gi)/50));return this.u[t]}h(t){if(this.m?.(t),!t.interactionId&&t.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.l.get(t.interactionId);if(n||this.u.length<10||t.duration>r.P){if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,o)=>o.P-i.P)),this.u.length>10){const i=this.u.splice(10);for(const o of i)this.l.delete(o.id)}this.p?.(n)}}}const Qo=e=>{const t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=en(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}
11)))},mi=[200,500],Jd=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=Zt();er((()=>{$d();let n,i=Oe("INP");const o=Zr(t,Yd),a=l=>{Qo((()=>{for(const c of l)o.h(c);const u=o.L();u&&u.P!==i.value&&(i.value=u.P,i.entries=u.entries,n())}))},s=wt("event",a,{durationThreshold:t.durationThreshold??40});n=Pe(e,i,mi,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),et((()=>{o.v(),i=Oe("INP"),n=Pe(e,i,mi,t.reportAllChanges)})))}))};class Qd{m;h(t){this.m?.(t)}}const bi=[2500,4e3],Zd=(e,t={})=>{er((()=>{const r=Zt();let n,i=Oe("LCP");const o=Zr(t,Qd),a=l=>{t.reportAllChanges||(l=l.slice(-1));for(const u of l)o.h(u),u.startTime<r.firstHiddenTime&&(i.value=Math.max(u.startTime-_t(),0),i.entries=[u],n())},s=wt("largest-contentful-paint",a);if(s){n=Pe(e,i,bi,t.reportAllChanges);const l=en((()=>{a(s.takeRecords()),s.disconnect(),n(!0)})),u=c=>{c.isTrusted&&(Qo(l),removeEventListener(c.type,u,{capture:!0}))};for(const c of["keydown","click","visibilitychange"])addEventListener(c,u,{capture:!0});et((c=>{i=Oe("LCP"),n=Pe(e,i,bi,t.reportAllChanges),Jr((()=>{i.value=performance.now()-c.timeStamp,n(!0)}))}))}}))},yi=[800,1800],Nr=e=>{document.prerendering?er((()=>Nr(e))):document.readyState!=="complete"?addEventListener("load",(()=>Nr(e)),!0):setTimeout(e)},ef=(e,t={})=>{let r=Oe("TTFB"),n=Pe(e,r,yi,t.reportAllChanges);Nr((()=>{const i=Qr();i&&(r.value=Math.max(i.responseStart-_t(),0),r.entries=[i],n(!0),et((()=>{r=Oe("TTFB",0),n=Pe(e,r,yi,t.reportAllChanges),n(!0)})))}))};function tf(e){var t,r=((t=e.entries[0])===null||t===void 0?void 0:t.startTime)||0;return performance.timeOrigin+r}function vt(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(tf(e)),navigationStart:Math.floor(performance.timeOrigin)}}var rf=function(){var e=null,t=F(),r=t?.document,n=t?.location,i=function(s,l){return A(void 0,void 0,void 0,function(){var u,c;return w(this,function(d){return r===void 0?[2]:(u=Te(n?.href||"",s.loggerProvider),c={"[Amplitude] Page Domain":n?.hostname||"","[Amplitude] Page Location":u,"[Amplitude] Page Path":Te(n?.pathname||"",s.loggerProvider),"[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":Te(u.split("?")[0],s.loggerProvider)},Zd(function(f){c["[Amplitude] LCP"]=vt(f)}),Yo(function(f){c["[Amplitude] FCP"]=vt(f)}),Jd(function(f){c["[Amplitude] INP"]=vt(f)}),zd(function(f){c["[Amplitude] CLS"]=vt(f)}),ef(function(f){c["[Amplitude] TTFB"]=vt(f)}),e=function(){r.visibilityState==="hidden"&&e&&(l.track(jd,c),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e),[2])})})},o=function(s){return A(void 0,void 0,void 0,function(){return w(this,function(l){return[2,s]})})},a=function(){return A(void 0,void 0,void 0,function(){return w(this,function(s){return e&&r?.removeEventListener("visibilitychange",e),[2]})})};return{name:Wd,type:"enrichment",setup:i,execute:o,teardown:a}},Ei=(function(){function e(t,r){var n;this.shouldTrackNewCampaign=!1,this.options=_({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:Yu(((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)||r.topLevelDomain),optOut:r.optOut},t),this.storage=r.cookieStorage,this.storageKey=Tn(r.apiKey,"MKTG"),this.webExpStorageKey=Tn(r.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=Yt,this.sessionTimeout=r.sessionTimeout,this.lastEventTime=r.lastEventTime,this.logger=r.loggerProvider,this.topLevelDomain=r.topLevelDomain,r.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return A(this,void 0,void 0,function(){var t,r;return w(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return r=D.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1],t=this.lastEventTime?Oi(this.sessionTimeout,this.lastEventTime):!0,Ku(this.currentCampaign,this.previousCampaign,this.options,this.logger,t,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return A(this,void 0,void 0,function(){var t;return w(this,function(r){switch(r.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return t=r.sent(),t?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,Promise.all([t||new Wr().parse(),this.storage.get(this.storageKey)])];case 4:return[2,r.sent()]}})})},e.prototype.generateCampaignEvent=function(t){this.shouldTrackNewCampaign=!1;var r=$u(this.currentCampaign,this.options);return t&&(r.event_id=t),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e})(),nf="[Amplitude] Attribution",of=new Set([ve.IDENTIFY,ve.GROUP_IDENTIFY]),af=function(e){return Ri(e)},sf=function(e){var t;e===void 0&&(e={});var r=(t=e.fallbackAttributionEvent)!==null&&t!==void 0?t:!1,n=F(),i,o,a={},s=!1,l=!1,u,c,d,f,v=function(){return A(void 0,void 0,void 0,function(){var y;return w(this,function(m){switch(m.label){case 0:return[4,new Wr().parse()];case 1:return y=m.sent(),a=af(y),r&&(o?.log("Tracking attribution fallback event."),i?.track(nf,a)),[2]}})})},h=function(){v()},g=function(y){return new Proxy(y,{apply:function(m,p,b){Reflect.apply(m,p,b),s&&h()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(y,m){return A(void 0,void 0,void 0,function(){return w(this,function(p){switch(p.label){case 0:return i=m,o=y.loggerProvider,s=!0,o.log("Installing event property attribution tracking."),[4,v()];case 1:if(p.sent(),!n)return[2];if(n.addEventListener("popstate",h),!l){if(u=Reflect.get(n.history,"pushState"),c=Reflect.get(n.history,"replaceState"),!u||!c)return[2];d=g(u),n.history.pushState=d,f=g(c),n.history.replaceState=f,l=!0}return[2]}})})},execute:function(y){return A(void 0,void 0,void 0,function(){return w(this,function(m){return of.has(y.event_type)?[2,y]:(y.event_properties=_(_({},a),y.event_properties),[2,y])})})},teardown:function(){return A(void 0,void 0,void 0,function(){var y,m;return w(this,function(p){return n&&(n.removeEventListener("popstate",h),y=Reflect.get(n.history,"pushState"),m=Reflect.get(n.history,"replaceState"),l&&y===d&&u&&(n.history.pushState=u),l&&m===f&&c&&(n.history.replaceState=c)),s=!1,l=!1,u=void 0,c=void 0,d=void 0,f=void 0,a={},[2]})})}}},xt="AMP_CURRENT_PAGE",Lt="AMP_PREVIOUS_PAGE",ze="AMP_URL_INFO",yt;(function(e){e.Direct="direct",e.Internal="internal",e.External="external"})(yt||(yt={}));var uf=new Set([ve.IDENTIFY,ve.GROUP_IDENTIFY,ve.REVENUE]),lf=function(e){var t={},r=t.internalDomains,n=r===void 0?[]:r,i=F(),o=void 0,a=!1,s=void 0,l=!1,u=!1,
11c=function(g){var y;try{var m=Te(g,s);y=new URL(m).hostname}catch(p){s?.error("Could not parse URL: ",p)}return y},d=function(g){var y=typeof location<"u"&&location.hostname||"",m=g?c(g):void 0;if(!m)return yt.Direct;var p=n.some(function(E){return y.indexOf(E)!==-1}),b=n.some(function(E){return m.indexOf(E)!==-1});return y===m||b&&p?yt.Internal:yt.External},f=function(){return A(void 0,void 0,void 0,function(){var g,y,m,p,b;return w(this,function(E){switch(E.label){case 0:return o&&a?[4,o.get(ze)]:[3,3];case 1:return g=E.sent(),y=Te(typeof location<"u"&&location.href||""),m=g?.[xt]||"",p=void 0,y===m?p=g?.[Lt]||"":m?p=m:p=document.referrer||"",[4,o.set(ze,(b={},b[xt]=y,b[Lt]=p,b))];case 2:E.sent(),E.label=3;case 3:return[2]}})})},v=function(){f()},h={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(g,y){return A(void 0,void 0,void 0,function(){var m,p,b,E,T,S,k,O,C;return w(this,function(M){switch(M.label){case 0:if(s=g.loggerProvider,s.log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!i)return[3,7];try{o=new Jt(i.sessionStorage)}catch{s?.debug("sessionStorage is not available in this environment.")}return[4,o?.isEnabled()];case 1:return a=(C=M.sent())!==null&&C!==void 0?C:!1,o&&a?(m=typeof document<"u"&&document.referrer||"",p=m?c(m):void 0,b=typeof location<"u"&&location.hostname||"",E=Te(typeof location<"u"&&location.href||""),[4,o.get(ze)]):[3,6];case 2:return T=M.sent(),S=T?.[xt]||"",k=!!p&&p!==b&&S!==E,k?[4,o.set(ze,(O={},O[xt]=E,O[Lt]=m,O))]:[3,4];case 3:return M.sent(),[3,6];case 4:return[4,f()];case 5:M.sent(),M.label=6;case 6:i.addEventListener("popstate",v),l||(i.history.pushState=new Proxy(i.history.pushState,{apply:function(I,N,R){var L=D(R,3),q=L[0],V=L[1],K=L[2];I.apply(N,[q,V,K]),u&&v()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(I,N,R){var L=D(R,3),q=L[0],V=L[1],K=L[2];I.apply(N,[q,V,K]),u&&v()}}),l=!0),M.label=7;case 7:return[2]}})})},execute:function(g){return A(void 0,void 0,void 0,function(){var y,m,p;return w(this,function(b){switch(b.label){case 0:return y=Te(typeof location<"u"&&location.href||""),o&&a?[4,o.get(ze)]:[3,2];case 1:if(m=b.sent(),p=m?.[Lt]||"",uf.has(g.event_type))return[2,g];g.event_properties=_(_({},g.event_properties||{}),{"[Amplitude] Page Domain":ht(g,"[Amplitude] Page Domain",typeof location<"u"&&location.hostname||""),"[Amplitude] Page Location":ht(g,"[Amplitude] Page Location",y),"[Amplitude] Page Path":ht(g,"[Amplitude] Page Path",typeof location<"u"&&Te(location.pathname)||""),"[Amplitude] Page Title":ht(g,"[Amplitude] Page Title",Kr(jr)),"[Amplitude] Page URL":ht(g,"[Amplitude] Page URL",y.split("?")[0]),"[Amplitude] Previous Page Location":p,"[Amplitude] Previous Page Type":d(p)}),b.label=2;case 2:return[2,g]}})})},teardown:function(){return A(void 0,void 0,void 0,function(){return w(this,function(g){switch(g.label){case 0:return i&&(i.removeEventListener("popstate",v),u=!1),o&&a?[4,o.set(ze,{})]:[3,2];case 1:g.sent(),g.label=2;case 2:return[2]}})})}};return h};function ht(e,t,r){return e.event_properties||(e.event_properties={}),e.event_properties[t]===void 0?r:e.event_properties[t]}var cf=function(){var e,t,r;function n(a){return typeof a!="object"||a===null?!1:"body"in a&&typeof a.body=="string"}function i(a){if(a)try{var s=new Function("return "+a)();if(typeof s=="function")return s;e?.error("Custom enrichment body did not evaluate to a function")}catch(l){e?.error("Could not create custom enrichment function",l)}return function(l){return l}}var o={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(a,s){return A(void 0,void 0,void 0,function(){var l,u;return w(this,function(c){return e=a.loggerProvider,e?.log("Installing @amplitude/plugin-custom-enrichment-browser"),!((u=a.remoteConfig)===null||u===void 0)&&u.fetchRemoteConfig&&(a.remoteConfigClient?(l=a.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(d){d&&n(d)?r=i(d.body||""):r=i("")}),t=function(){var d;return(d=a.remoteConfigClient)===null||d===void 0?void 0:d.unsubscribe(l)}):e?.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(a){return A(void 0,void 0,void 0,function(){var s;return w(this,function(l){if(r)try{return[2,(s=r(a))!==null&&s!==void 0?s:null]}catch(u){return e?.error("Could not execute custom enrichment function",u),[2,a]}return[2,a]})})},teardown:function(){return A(void 0,void 0,void 0,function(){return w(this,function(a){return t&&t(),[2]})})}};return o},tn="userProperty",rn="eventProperty",df=function(e){return e===tn||e===rn},ff=[tn,rn],vf=function(e){var t=H([],D(new Set((Array.isArray(e)?e:[e]).filter(df))),!1);return t.length>0?t:H([],D(ff),!1)},Zo=function(e,t){return vf(e.trackingMethod).includes(t)},Ti=function(e){return Zo(e,tn)},hf=function(e){return Zo(e,rn)},Er=-1,pf=(function(e){Ge(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._diagnosticsSampleRate=0,r}return t.prototype.init=function(r,n,i){r===void 0&&(r="");var o,a;return arguments.length>2?(o=n,a=i):typeof n=="string"?(o=n,a=void 0):(o=n?.userId,a=n),de(this._init(_(_({},a),{userId:o,apiKey:r})))},t.prototype._init=function(r){var n,i,o,a,s,l,u,c;return A(this,void 0,void 0,function(){var d,f,v,h,g,y,m,p,b,E,T,S,k,O,C,M=this;return w(this,function(I){switch(I.label){case 0:return this.initializing?[2]:(this.initializing=!0,d=rl(r),f=(n=r.loggerProvider)!==null&&n!==void 0?n:new Fr,r.loggerProvider||f.enable((i=r.logLevel)!==null&&i!==void 0?i:fe.Warn),v=(o=r.serverZone)!==null&&o!==void 0?o:ao,g=this._diagnosticsSampleRate,y=(a=r.enableDiagnostics)!==null&&a!==void 0?a:!0,d?(h=new ms(r.apiKey,f,v,(s=r.remoteConfig)===null||s===void 0?void 0:s.serverUrl),[4,new Promise(function(N){h?.subscribe("configs.diagnostics.browserSDK","all",function(R,L,q){if(f.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:R,source:L,lastFetch:q},null,2)),R){var V=R.sampleRate;typeof V=="number"&&!isNaN(V)&&(g=V);var K=R.enabled;typeof K=="boolean"&&(y=K)}N()})})]):[3,2]);case 1:I.sent(),I.label=2;case 2:return m=new ls(r.apiKey,f,v,{enabled:y,sampleRate:g}),m.setTag("library","".concat(no,"/").concat(Xr)),m.setTag("platform",io),m.setTag("web_environment",Iu()),typeof navigator<"u"&&m.setTag("user_agent",navigator.userAgent),[4,el(r.apiKey,r,this,m,{loggerProvider:f,serverZone:v,enableDiagnostics:y,diagnosticsSampleRate:g})];case 3:return p=I.sent(),d&&h?[4,new Promise(function(N){h?.subscribe("configs.analyticsSDK.browserSDK","all",function(R,L,q){p.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:R,source:L,lastFetch:q},null,2)),R&&fl(R,p),N()})})]:[3,5];case 4:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,p)];case 6:return I.sent(),this.logBrowserOptions(p),this.config.remoteConfigClient=h,b=Eu(this.config),Or(this.config.defaultTracking)&&Ti(b)?(this.config.optOut&&this.timeline.addOptOutListener(function(N){return A(M,void 0,void 0,function(){return w(this,function(R){switch(R.label){case 0:return N?[3,2]:(this.webAttribution=new Ei(b,this.config),[4,this.webAttribution.init()]);case 1:R.sent(),R.label=2;case 2:return[2]}})})}),this.webAttribution=new Ei(b,this.config),[4,this.webAttribution.init()]):[3,8];case 7:I.sent(),I.label=8;case 8:return E=Gt(),T=E.ampTimestamp?Number(E.ampTimestamp):void 0,S=T?Date.now()<T:!0,k=S&&!Number.isNaN(Number(E.ampSessionId))?Number(E.ampSessionId):void 0,O=this.config.deferredSessionId,O===Er&&!this.config.optOut&&(O=Date.now()),this.setSessionId((c=(u=(l=r.sessionId)!==null&&l!==void 0?l:k)!==null&&u!==void 0?u:O)!==null&&c!==void 0?c:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(N){return A(M,void 0,void 0,function(){return w(this,function(R){return!N&&this.config.deferredSessionId&&(this.config.deferredSessionId===Er?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),C=Et(r.instanceName),C.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Ui?[3,10]:[4,this.add(dl()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new La({diagnosticsClient:m})).promise];case 11:return I.sent(),[4,this.add(new Ou).promise];case 12:return I.sent(),[4,this.add(new Wa).promise];case 13:return I.sent(),cl(this.config),du(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(ll()).promise]):[3,15];case 14:I.sent(),I.label=15;case 15:return Qi(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(ul()).promise]):[3,17];case 16:I.sent(),I.label=17;case 17:return Zi(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Bn(Nn(this.config))).promise]):[3,20];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(N){return A(M,void 0,void 0,function(){return w(this,function(R){switch(R.label){case 0:return N?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Bn(Nn(this.config))).promise]);case 1:return R.sent(),[2]}})})}),I.label=20;case 20:return Or(this.config.defaultTracking)&&hf(b)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(sf(b)).promise]):[3,22];case 21:I.sent(),I.label=22;case 22:return to(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(vd(mu(this.config),{diagnosticsClient:m})).promise]):[3,24];case 23:I.sent(),I.label=24;case 24:return ro(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Id(bu(this.config))).promise]):[3,26];
11case 25:I.sent(),I.label=26;case 26:return eo(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Gd(yu(this.config))).promise]):[3,28];case 27:I.sent(),I.label=28;case 28:return vu(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(rf()).promise]):[3,30];case 29:I.sent(),I.label=30;case 30:return hu(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(Nd(pu(this.config))).promise]):[3,32];case 31:I.sent(),I.label=32;case 32:return fu(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(lf()).promise]):[3,34];case 33:I.sent(),I.label=34;case 34:return gu(this.config.customEnrichment)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(cf()).promise]):[3,36];case 35:I.sent(),I.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return I.sent(),C.eventBridge.setEventReceiver(function(N){var R=N.eventProperties||{},L=R.time,q=Bt(R,["time"]),V=typeof L=="number"?{time:L}:void 0;M.track(N.eventType,q,V)}),[2]}})})},t.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId},t.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}this.config.loggerProvider.debug("function setUserId: ",r),(r!==this.config.userId||r===void 0)&&(this.config.userId=r,this.timeline.onIdentityChanged({userId:r}),qa(r,this.config.instanceName))},t.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId},t.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.loggerProvider.debug("function setDeviceId: ",r),r!==this.config.deviceId&&(this.config.deviceId=r,this.timeline.onIdentityChanged({deviceId:r}),Ga(r,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(Se()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var r,n;return{deviceId:(r=this.config)===null||r===void 0?void 0:r.deviceId,userId:(n=this.config)===null||n===void 0?void 0:n.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(r){var n,i,o;if("userId"in r&&this.setUserId(r.userId),"deviceId"in r&&r.deviceId&&this.setDeviceId(r.deviceId),"userProperties"in r){this.userProperties=r.userProperties;var a=new gt,s=(o=r.userProperties)!==null&&o!==void 0?o:{};try{for(var l=x(Object.entries(s)),u=l.next();!u.done;u=l.next()){var c=D(u.value,2),d=c[0],f=c[1];a.set(d,f)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}this.identify(a)}},t.prototype.getOptOut=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.optOut},t.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId},t.prototype.setSessionId=function(r){var n,i=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,r)),de(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=r??Er,de(Promise.resolve());if(r===void 0&&(r=Date.now()),r===this.config.sessionId)return de(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",r);var o=this.getSessionId();o!==r&&this.timeline.onSessionIdChanged(r);var a=this.config.lastEventTime,s=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r,this.config.lastEventTime=void 0,this.config.pageCounter=0,Ln(this.config.defaultTracking)&&(o&&a&&i.push(this.track(Fn,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:o,time:a+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var l=this.trackCampaignEventIfNeeded(++s,i);return this.config.identify&&i.push(this.track(Ur(this.config.identify)).promise),Ln(this.config.defaultTracking)&&i.push(this.track(Un,void 0,{event_id:l?++s:s,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,de(Promise.all(i))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}
11this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=lo(r)},t.prototype.identify=function(r,n){if(lr(r)){var i=r._q;r._q=[],r=Vt(new gt,i)}return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,r,n)},t.prototype.groupIdentify=function(r,n,i,o){if(lr(i)){var a=i._q;i._q=[],i=Vt(new gt,a)}return e.prototype.groupIdentify.call(this,r,n,i,o)},t.prototype.revenue=function(r,n){if(lr(r)){var i=r._q;r._q=[],r=Vt(new Aa,i)}return e.prototype.revenue.call(this,r,n)},t.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!Ti(this.webAttribution.options))return!1;var i=this.webAttribution.generateCampaignEvent(r);return n?n.push(this.track(i).promise):this.track(i),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(r){return A(this,void 0,void 0,function(){var n,i,o;return w(this,function(a){return n=Date.now(),i=Oi(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),r.event_type!==Un&&r.event_type!==Fn&&(!r.session_id||r.session_id===this.getSessionId())&&(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,r)]})})},t.prototype.logBrowserOptions=function(r){try{var n=_(_({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",kr(n))}catch(i){this.config.loggerProvider.error("Error logging browser config",i)}},t.prototype._setDiagnosticsSampleRate=function(r){if(!(r>1||r<0)&&!this.config){this._diagnosticsSampleRate=r;return}},t})(wa),gf=function(){var e=new pf;return{init:Q(e.init.bind(e),"init",Y(e),J(e,["config"])),add:Q(e.add.bind(e),"add",Y(e),J(e,["config.apiKey","timeline.plugins"])),remove:Q(e.remove.bind(e),"remove",Y(e),J(e,["config.apiKey","timeline.plugins"])),track:Q(e.track.bind(e),"track",Y(e),J(e,["config.apiKey","timeline.queue.length"])),logEvent:Q(e.logEvent.bind(e),"logEvent",Y(e),J(e,["config.apiKey","timeline.queue.length"])),identify:Q(e.identify.bind(e),"identify",Y(e),J(e,["config.apiKey","timeline.queue.length"])),groupIdentify:Q(e.groupIdentify.bind(e),"groupIdentify",Y(e),J(e,["config.apiKey","timeline.queue.length"])),setGroup:Q(e.setGroup.bind(e),"setGroup",Y(e),J(e,["config.apiKey","timeline.queue.length"])),revenue:Q(e.revenue.bind(e),"revenue",Y(e),J(e,["config.apiKey","timeline.queue.length"])),flush:Q(e.flush.bind(e),"flush",Y(e),J(e,["config.apiKey","timeline.queue.length"])),getUserId:Q(e.getUserId.bind(e),"getUserId",Y(e),J(e,["config","config.userId"])),setUserId:Q(e.setUserId.bind(e),"setUserId",Y(e),J(e,["config","config.userId"])),getDeviceId:Q(e.getDeviceId.bind(e),"getDeviceId",Y(e),J(e,["config","config.deviceId"])),setDeviceId:Q(e.setDeviceId.bind(e),"setDeviceId",Y(e),J(e,["config","config.deviceId"])),reset:Q(e.reset.bind(e),"reset",Y(e),J(e,["config","config.userId","config.deviceId"])),getSessionId:Q(e.getSessionId.bind(e),"getSessionId",Y(e),J(e,["config"])),setSessionId:Q(e.setSessionId.bind(e),"setSessionId",Y(e),J(e,["config"])),extendSession:Q(e.extendSession.bind(e),"extendSession",Y(e),J(e,["config"])),setOptOut:Q(e.setOptOut.bind(e),"setOptOut",Y(e),J(e,["config"])),setTransport:Q(e.setTransport.bind(e),"setTransport",Y(e),J(e,["config"])),getIdentity:Q(e.getIdentity.bind(e),"getIdentity",Y(e),J(e,["config"])),setIdentity:Q(e.setIdentity.bind(e),"setIdentity",Y(e),J(e,["config","config.userId","config.deviceId"])),getOptOut:Q(e.getOptOut.bind(e),"getOptOut",Y(e),J(e,["config"])),_setDiagnosticsSampleRate:Q(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",Y(e),J(e,["config"]))}};const Z=gf();var mf=(function(){function e(t){this.amplitude=t,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(t){return this.videoEl=t,this},e.prototype.withEmbeddedPlayer=function(t){return this.embeddedVideoPlayer=t,this},e.prototype.withVendor=function(t){return this.vendor=t,this},e.prototype.withExtraEventProperties=function(t){return this.extraEventProperties=t,this},e.prototype.captureVideoStarted=function(){var t=this;return this.listeners.push(function(r,n){r.playbackState!=="playing"&&n.playbackState==="playing"&&t.amplitude.track("Video Content Started",_(_({},n.lastEvent),t.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var t=this;return this.listeners.push(function(r,n){r.playbackState==="playing"&&n.playbackState!=="playing"&&t.amplitude.track("Video Content Stopped",_(_(_({},n.lastEvent),{watch_duration:n.watchTime}),t.extraEventProperties))}),this},e.prototype.start=function(){var t=this,r,n=(r=this.videoEl)!==null&&r!==void 0?r:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var i=new su({videoEl:n,onStateChange:function(o,a){t.listeners.forEac
11h(function(s){return s(o,a)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){i.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(t){return t()}),this.onRemoveListeners=[]},e})();function kf(e,t,r){var n;r===void 0&&(r={});var i=new mf(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),r.vendor&&i.withVendor(r.vendor);var o=(n=r.extraEventProperties)!==null&&n!==void 0?n:{};try{i.withExtraEventProperties(_({view_session_id:Se()},o)).captureVideoStarted().captureVideoStopped().start()}catch(a){return a}return function(){return i.stop()}}var If=Z.add,Pf=Z.extendSession,Of=Z.flush,Cf=Z.getDeviceId,Rf=Z.getIdentity,Df=Z.getOptOut,xf=Z.getSessionId,Lf=Z.getUserId,Nf=Z.groupIdentify,Mf=Z.identify,Uf=Z.init,Ff=Z.logEvent,Vf=Z.remove,Hf=Z.reset,Bf=Z.revenue,qf=Z.setDeviceId,Gf=Z.setGroup,Wf=Z.setIdentity,jf=Z.setOptOut,Kf=Z.setSessionId,zf=Z.setTransport,Xf=Z.setUserId,$f=Z.track,Yf=Z._setDiagnosticsSampleRate;export{pf as AmplitudeBrowser,gt as Identify,Aa as Revenue,Af as Types,Yf as _setDiagnosticsSampleRate,If as add,gf as createInstance,Pf as extendSession,Of as flush,Cf as getDeviceId,Rf as getIdentity,Df as getOptOut,xf as getSessionId,Lf as getUserId,Nf as groupIdentify,Mf as identify,Uf as init,Ff as logEvent,Vf as remove,Hf as reset,Bf as revenue,wf as runQueuedFunctions,qf as setDeviceId,Gf as setGroup,Wf as setIdentity,jf as setOptOut,Kf as setSessionId,zf as setTransport,Xf as setUserId,$f as track,kf as trackVideo};

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.